diff --git a/PREUPLOAD.cfg b/PREUPLOAD.cfg index 2116e21c5a058ec71400dc7057d75f822ecf3830..de7aa354bdfadce0d0f5ca3273c7bdf3f2d529e0 100644 --- a/PREUPLOAD.cfg +++ b/PREUPLOAD.cfg @@ -10,3 +10,4 @@ aidl_format = true aosp_hook_confirmationui = ${REPO_ROOT}/frameworks/base/tools/aosp/aosp_sha.sh ${PREUPLOAD_COMMIT} confirmationui aosp_hook_gatekeeper = ${REPO_ROOT}/frameworks/base/tools/aosp/aosp_sha.sh ${PREUPLOAD_COMMIT} gatekeeper aosp_hook_keymaster = ${REPO_ROOT}/frameworks/base/tools/aosp/aosp_sha.sh ${PREUPLOAD_COMMIT} keymaster +generate_vehicle_property_enums = ${REPO_ROOT}/hardware/interfaces/automotive/vehicle/tools/generate_annotation_enums.py --android_build_top ${REPO_ROOT} --preupload_files ${PREUPLOAD_FILES} --check_only diff --git a/audio/aidl/default/Android.bp b/audio/aidl/default/Android.bp index fe386a2c8010973cb0babad4142c766fd75922b1..e65ee771e6093bdd3aa9785889dcabf79bff416b 100644 --- a/audio/aidl/default/Android.bp +++ b/audio/aidl/default/Android.bp @@ -96,8 +96,11 @@ cc_library { shared_libs: [ "android.hardware.bluetooth.audio-impl", "libaudio_aidl_conversion_common_ndk", + "libaudioutils", "libbluetooth_audio_session_aidl", + "liblog", "libmedia_helper", + "libmediautils_vendor", "libstagefright_foundation", ], export_shared_lib_headers: [ @@ -129,6 +132,7 @@ cc_binary { "android.hardware.bluetooth.audio-impl", "libaudio_aidl_conversion_common_ndk", "libbluetooth_audio_session_aidl", + "liblog", "libmedia_helper", "libstagefright_foundation", ], diff --git a/audio/aidl/default/Module.cpp b/audio/aidl/default/Module.cpp index b8e1df809af064ec55489cc4ef59a5cccf643aaa..94aa4dc6578453d5515a02b0cfcd9996a14eacaf 100644 --- a/audio/aidl/default/Module.cpp +++ b/audio/aidl/default/Module.cpp @@ -212,6 +212,11 @@ ndk::ScopedAStatus Module::createStreamContext( StreamContext::DebugParameters params{mDebug.streamTransientStateDelayMs, mVendorDebug.forceTransientBurst, mVendorDebug.forceSynchronousDrain}; + std::shared_ptr soundDose; + if (!getSoundDose(&soundDose).isOk()) { + LOG(ERROR) << __func__ << ": could not create sound dose instance"; + return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_STATE); + } StreamContext temp( std::make_unique(1, true /*configureEventFlagWord*/), std::make_unique(1, true /*configureEventFlagWord*/), @@ -219,8 +224,7 @@ ndk::ScopedAStatus Module::createStreamContext( portConfigIt->sampleRate.value().value, flags, nominalLatencyMs, portConfigIt->ext.get().handle, std::make_unique(frameSize * in_bufferSizeFrames), - asyncCallback, outEventCallback, - std::weak_ptr{}, params); + asyncCallback, outEventCallback, mSoundDose.getInstance(), params); if (temp.isValid()) { *out_context = std::move(temp); } else { diff --git a/audio/aidl/default/SoundDose.cpp b/audio/aidl/default/SoundDose.cpp index f12ce5d806f7a18f3f2aae06653c29395ea17670..1c9e0813530f39119c85d986ca79371b7fe41a68 100644 --- a/audio/aidl/default/SoundDose.cpp +++ b/audio/aidl/default/SoundDose.cpp @@ -18,7 +18,15 @@ #include "core-impl/SoundDose.h" +#include #include +#include +#include + +using aidl::android::hardware::audio::core::sounddose::ISoundDose; +using aidl::android::media::audio::common::AudioDevice; +using aidl::android::media::audio::common::AudioDeviceDescription; +using aidl::android::media::audio::common::AudioFormatDescription; namespace aidl::android::hardware::audio::core::sounddose { @@ -28,11 +36,16 @@ ndk::ScopedAStatus SoundDose::setOutputRs2UpperBound(float in_rs2ValueDbA) { return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); } + ::android::audio_utils::lock_guard l(mMutex); mRs2Value = in_rs2ValueDbA; + if (mMelProcessor != nullptr) { + mMelProcessor->setOutputRs2UpperBound(in_rs2ValueDbA); + } return ndk::ScopedAStatus::ok(); } ndk::ScopedAStatus SoundDose::getOutputRs2UpperBound(float* _aidl_return) { + ::android::audio_utils::lock_guard l(mMutex); *_aidl_return = mRs2Value; LOG(DEBUG) << __func__ << ": returning " << *_aidl_return; return ndk::ScopedAStatus::ok(); @@ -44,6 +57,8 @@ ndk::ScopedAStatus SoundDose::registerSoundDoseCallback( LOG(ERROR) << __func__ << ": Callback is nullptr"; return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); } + + ::android::audio_utils::lock_guard l(mCbMutex); if (mCallback != nullptr) { LOG(ERROR) << __func__ << ": Sound dose callback was already registered"; return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_STATE); @@ -51,7 +66,81 @@ ndk::ScopedAStatus SoundDose::registerSoundDoseCallback( mCallback = in_callback; LOG(DEBUG) << __func__ << ": Registered sound dose callback "; + return ndk::ScopedAStatus::ok(); } +void SoundDose::setAudioDevice(const AudioDevice& audioDevice) { + ::android::audio_utils::lock_guard l(mCbMutex); + mAudioDevice = audioDevice; +} + +void SoundDose::startDataProcessor(uint32_t sampleRate, uint32_t channelCount, + const AudioFormatDescription& aidlFormat) { + ::android::audio_utils::lock_guard l(mMutex); + const auto result = aidl2legacy_AudioFormatDescription_audio_format_t(aidlFormat); + const audio_format_t format = result.value_or(AUDIO_FORMAT_INVALID); + + if (mMelProcessor == nullptr) { + // we don't have the deviceId concept on the vendor side so just pass 0 + mMelProcessor = ::android::sp<::android::audio_utils::MelProcessor>::make( + sampleRate, channelCount, format, mMelCallback, /*deviceId=*/0, mRs2Value); + } else { + mMelProcessor->updateAudioFormat(sampleRate, channelCount, format); + } +} + +void SoundDose::process(const void* buffer, size_t bytes) { + ::android::audio_utils::lock_guard l(mMutex); + if (mMelProcessor != nullptr) { + mMelProcessor->process(buffer, bytes); + } +} + +void SoundDose::onNewMelValues(const std::vector& mels, size_t offset, size_t length, + audio_port_handle_t deviceId __attribute__((__unused__))) const { + ::android::audio_utils::lock_guard l(mCbMutex); + if (!mAudioDevice.has_value()) { + LOG(WARNING) << __func__ << ": New mel values without a registered device"; + return; + } + if (mCallback == nullptr) { + LOG(ERROR) << __func__ << ": New mel values without a registered callback"; + return; + } + + ISoundDose::IHalSoundDoseCallback::MelRecord melRecord; + melRecord.timestamp = nanoseconds_to_seconds(systemTime()); + melRecord.melValues = std::vector(mels.begin() + offset, mels.begin() + offset + length); + + mCallback->onNewMelValues(melRecord, mAudioDevice.value()); +} + +void SoundDose::MelCallback::onNewMelValues(const std::vector& mels, size_t offset, + size_t length, + audio_port_handle_t deviceId + __attribute__((__unused__))) const { + mSoundDose.onNewMelValues(mels, offset, length, deviceId); +} + +void SoundDose::onMomentaryExposure(float currentMel, audio_port_handle_t deviceId + __attribute__((__unused__))) const { + ::android::audio_utils::lock_guard l(mCbMutex); + if (!mAudioDevice.has_value()) { + LOG(WARNING) << __func__ << ": Momentary exposure without a registered device"; + return; + } + if (mCallback == nullptr) { + LOG(ERROR) << __func__ << ": Momentary exposure without a registered callback"; + return; + } + + mCallback->onMomentaryExposureWarning(currentMel, mAudioDevice.value()); +} + +void SoundDose::MelCallback::onMomentaryExposure(float currentMel, audio_port_handle_t deviceId + __attribute__((__unused__))) const { + mSoundDose.onMomentaryExposure(currentMel, deviceId); +} + } // namespace aidl::android::hardware::audio::core::sounddose diff --git a/audio/aidl/default/include/core-impl/SoundDose.h b/audio/aidl/default/include/core-impl/SoundDose.h index c0edc9fe221bcab4b4cd3746a3411d150f7a191f..82c1077f1b97919dba093f16bc959b5b55c3cf2e 100644 --- a/audio/aidl/default/include/core-impl/SoundDose.h +++ b/audio/aidl/default/include/core-impl/SoundDose.h @@ -21,6 +21,8 @@ #include #include #include +#include +#include namespace aidl::android::hardware::audio::core::sounddose { @@ -37,18 +39,49 @@ class StreamDataProcessorInterface { virtual void process(const void* buffer, size_t size) = 0; }; -class SoundDose : public BnSoundDose { +class SoundDose final : public BnSoundDose, public StreamDataProcessorInterface { public: - SoundDose() : mRs2Value(DEFAULT_MAX_RS2){}; + SoundDose() : mMelCallback(::android::sp::make(this)){}; + // -------------------------------------- BnSoundDose ------------------------------------------ ndk::ScopedAStatus setOutputRs2UpperBound(float in_rs2ValueDbA) override; ndk::ScopedAStatus getOutputRs2UpperBound(float* _aidl_return) override; ndk::ScopedAStatus registerSoundDoseCallback( const std::shared_ptr& in_callback) override; + // ----------------------------- StreamDataProcessorInterface ---------------------------------- + void setAudioDevice( + const ::aidl::android::media::audio::common::AudioDevice& audioDevice) override; + void startDataProcessor( + uint32_t samplerate, uint32_t channelCount, + const ::aidl::android::media::audio::common::AudioFormatDescription& format) override; + void process(const void* buffer, size_t size) override; + private: - std::shared_ptr mCallback; - float mRs2Value; + class MelCallback : public ::android::audio_utils::MelProcessor::MelCallback { + public: + explicit MelCallback(SoundDose* soundDose) : mSoundDose(*soundDose) {} + + // ------------------------------------ MelCallback ---------------------------------------- + void onNewMelValues(const std::vector& mels, size_t offset, size_t length, + audio_port_handle_t deviceId) const override; + void onMomentaryExposure(float currentMel, audio_port_handle_t deviceId) const override; + + SoundDose& mSoundDose; // must outlive MelCallback, not owning + }; + + void onNewMelValues(const std::vector& mels, size_t offset, size_t length, + audio_port_handle_t deviceId) const; + void onMomentaryExposure(float currentMel, audio_port_handle_t deviceId) const; + + mutable ::android::audio_utils::mutex mCbMutex; + std::shared_ptr mCallback GUARDED_BY(mCbMutex); + std::optional<::aidl::android::media::audio::common::AudioDevice> mAudioDevice + GUARDED_BY(mCbMutex); + mutable ::android::audio_utils::mutex mMutex; + float mRs2Value GUARDED_BY(mMutex) = DEFAULT_MAX_RS2; + ::android::sp<::android::audio_utils::MelProcessor> mMelProcessor GUARDED_BY(mMutex); + ::android::sp mMelCallback GUARDED_BY(mMutex); }; } // namespace aidl::android::hardware::audio::core::sounddose diff --git a/audio/effect/all-versions/default/Effect.cpp b/audio/effect/all-versions/default/Effect.cpp index 5aecd324ebe10b8ef48ddf9ca2a0d0315b85272d..4a9e1446272c96d08841ecfd7d34507b4168438a 100644 --- a/audio/effect/all-versions/default/Effect.cpp +++ b/audio/effect/all-versions/default/Effect.cpp @@ -315,7 +315,7 @@ Effect::Effect(bool isInput, effect_handle_t handle) Effect::~Effect() { ATRACE_CALL(); - (void)close(); + auto [_, handle] = closeImpl(); if (mProcessThread.get()) { ATRACE_NAME("mProcessThread->join"); status_t status = mProcessThread->join(); @@ -328,11 +328,10 @@ Effect::~Effect() { mInBuffer.clear(); mOutBuffer.clear(); #if MAJOR_VERSION <= 5 - int status = EffectRelease(mHandle); - ALOGW_IF(status, "Error releasing effect %p: %s", mHandle, strerror(-status)); + int status = EffectRelease(handle); + ALOGW_IF(status, "Error releasing effect %p: %s", handle, strerror(-status)); #endif - EffectMap::getInstance().remove(mHandle); - mHandle = 0; + EffectMap::getInstance().remove(handle); } // static @@ -459,7 +458,19 @@ Result Effect::analyzeStatus(const char* funcName, const char* subFuncName, } } -void Effect::getConfigImpl(int commandCode, const char* commandName, GetConfigCallback cb) { +#define RETURN_IF_EFFECT_CLOSED() \ + if (mHandle == kInvalidEffectHandle) { \ + return Result::INVALID_STATE; \ + } +#define RETURN_RESULT_IF_EFFECT_CLOSED(result) \ + if (mHandle == kInvalidEffectHandle) { \ + _hidl_cb(Result::INVALID_STATE, result); \ + return Void(); \ + } + +Return Effect::getConfigImpl(int commandCode, const char* commandName, + GetConfigCallback _hidl_cb) { + RETURN_RESULT_IF_EFFECT_CLOSED(EffectConfig()); uint32_t halResultSize = sizeof(effect_config_t); effect_config_t halConfig{}; status_t status = @@ -468,7 +479,8 @@ void Effect::getConfigImpl(int commandCode, const char* commandName, GetConfigCa if (status == OK) { status = EffectUtils::effectConfigFromHal(halConfig, mIsInput, &config); } - cb(analyzeCommandStatus(commandName, sContextCallToCommand, status), config); + _hidl_cb(analyzeCommandStatus(commandName, sContextCallToCommand, status), config); + return Void(); } Result Effect::getCurrentConfigImpl(uint32_t featureId, uint32_t configSize, @@ -530,6 +542,7 @@ Result Effect::getSupportedConfigsImpl(uint32_t featureId, uint32_t maxConfigs, } Return Effect::prepareForProcessing(prepareForProcessing_cb _hidl_cb) { + RETURN_RESULT_IF_EFFECT_CLOSED(StatusMQ::Descriptor()); status_t status; // Create message queue. if (mStatusMQ) { @@ -576,6 +589,7 @@ Return Effect::prepareForProcessing(prepareForProcessing_cb _hidl_cb) { Return Effect::setProcessBuffers(const AudioBuffer& inBuffer, const AudioBuffer& outBuffer) { + RETURN_IF_EFFECT_CLOSED(); AudioBufferManager& manager = AudioBufferManager::getInstance(); sp tempInBuffer, tempOutBuffer; if (!manager.wrap(inBuffer, &tempInBuffer)) { @@ -600,6 +614,7 @@ Result Effect::sendCommand(int commandCode, const char* commandName) { } Result Effect::sendCommand(int commandCode, const char* commandName, uint32_t size, void* data) { + RETURN_IF_EFFECT_CLOSED(); status_t status = (*mHandle)->command(mHandle, commandCode, size, data, 0, NULL); return analyzeCommandStatus(commandName, sContextCallToCommand, status); } @@ -611,6 +626,7 @@ Result Effect::sendCommandReturningData(int commandCode, const char* commandName Result Effect::sendCommandReturningData(int commandCode, const char* commandName, uint32_t size, void* data, uint32_t* replySize, void* replyData) { + RETURN_IF_EFFECT_CLOSED(); uint32_t expectedReplySize = *replySize; status_t status = (*mHandle)->command(mHandle, commandCode, size, data, replySize, replyData); if (status == OK && *replySize != expectedReplySize) { @@ -635,6 +651,7 @@ Result Effect::sendCommandReturningStatusAndData(int commandCode, const char* co uint32_t size, void* data, uint32_t* replySize, void* replyData, uint32_t minReplySize, CommandSuccessCallback onSuccess) { + RETURN_IF_EFFECT_CLOSED(); status_t status = (*mHandle)->command(mHandle, commandCode, size, data, replySize, replyData); Result retval; if (status == OK && minReplySize >= sizeof(uint32_t) && *replySize >= minReplySize) { @@ -792,13 +809,11 @@ Return Effect::setConfigReverse( } Return Effect::getConfig(getConfig_cb _hidl_cb) { - getConfigImpl(EFFECT_CMD_GET_CONFIG, "GET_CONFIG", _hidl_cb); - return Void(); + return getConfigImpl(EFFECT_CMD_GET_CONFIG, "GET_CONFIG", _hidl_cb); } Return Effect::getConfigReverse(getConfigReverse_cb _hidl_cb) { - getConfigImpl(EFFECT_CMD_GET_CONFIG_REVERSE, "GET_CONFIG_REVERSE", _hidl_cb); - return Void(); + return getConfigImpl(EFFECT_CMD_GET_CONFIG_REVERSE, "GET_CONFIG_REVERSE", _hidl_cb); } Return Effect::getSupportedAuxChannelsConfigs(uint32_t maxConfigs, @@ -845,6 +860,7 @@ Return Effect::offload(const EffectOffloadParameter& param) { } Return Effect::getDescriptor(getDescriptor_cb _hidl_cb) { + RETURN_RESULT_IF_EFFECT_CLOSED(EffectDescriptor()); effect_descriptor_t halDescriptor; memset(&halDescriptor, 0, sizeof(effect_descriptor_t)); status_t status = (*mHandle)->get_descriptor(mHandle, &halDescriptor); @@ -858,6 +874,10 @@ Return Effect::getDescriptor(getDescriptor_cb _hidl_cb) { Return Effect::command(uint32_t commandId, const hidl_vec& data, uint32_t resultMaxSize, command_cb _hidl_cb) { + if (mHandle == kInvalidEffectHandle) { + _hidl_cb(-ENODATA, hidl_vec()); + return Void(); + } uint32_t halDataSize; std::unique_ptr halData = hidlVecToHal(data, &halDataSize); uint32_t halResultSize = resultMaxSize; @@ -942,26 +962,33 @@ Return Effect::setCurrentConfigForFeature(uint32_t featureId, halCmd.size(), &halCmd[0]); } -Return Effect::close() { +std::tuple Effect::closeImpl() { if (mStopProcessThread.load(std::memory_order_relaxed)) { // only this thread modifies - return Result::INVALID_STATE; + return {Result::INVALID_STATE, kInvalidEffectHandle}; } mStopProcessThread.store(true, std::memory_order_release); if (mEfGroup) { mEfGroup->wake(static_cast(MessageQueueFlagBits::REQUEST_QUIT)); } + effect_handle_t handle = mHandle; + mHandle = kInvalidEffectHandle; #if MAJOR_VERSION <= 5 - return Result::OK; + return {Result::OK, handle}; #elif MAJOR_VERSION >= 6 // No need to join the processing thread, it is part of the API contract that the client // must finish processing before closing the effect. - Result retval = - analyzeStatus("EffectRelease", "", sContextCallFunction, EffectRelease(mHandle)); - EffectMap::getInstance().remove(mHandle); - return retval; + Result retval = analyzeStatus("EffectRelease", "", sContextCallFunction, EffectRelease(handle)); + EffectMap::getInstance().remove(handle); + return {retval, handle}; #endif } +Return Effect::close() { + RETURN_IF_EFFECT_CLOSED(); + auto [result, _] = closeImpl(); + return result; +} + Return Effect::debug(const hidl_handle& fd, const hidl_vec& /* options */) { if (fd.getNativeHandle() != nullptr && fd->numFds == 1) { uint32_t cmdData = fd->data[0]; diff --git a/audio/effect/all-versions/default/Effect.h b/audio/effect/all-versions/default/Effect.h index 5d8dcccba6b2f30761bd1dac49e8a2b2f2f994b4..2bcecec4c70c7ea870686debb1981f90076b7802 100644 --- a/audio/effect/all-versions/default/Effect.h +++ b/audio/effect/all-versions/default/Effect.h @@ -23,6 +23,7 @@ #include #include +#include #include #include @@ -186,6 +187,7 @@ struct Effect : public IEffect { // Sets the limit on the maximum size of vendor-provided data structures. static constexpr size_t kMaxDataSize = 1 << 20; + static constexpr effect_handle_t kInvalidEffectHandle = nullptr; static const char* sContextResultOfCommand; static const char* sContextCallToCommand; @@ -208,6 +210,7 @@ struct Effect : public IEffect { static size_t alignedSizeIn(size_t s); template std::unique_ptr hidlVecToHal(const hidl_vec& vec, uint32_t* halDataSize); + std::tuple closeImpl(); void effectAuxChannelsConfigFromHal(const channel_config_t& halConfig, EffectAuxChannelsConfig* config); static void effectAuxChannelsConfigToHal(const EffectAuxChannelsConfig& config, @@ -218,7 +221,8 @@ struct Effect : public IEffect { const void** valueData, std::vector* halParamBuffer); Result analyzeCommandStatus(const char* commandName, const char* context, status_t status); - void getConfigImpl(int commandCode, const char* commandName, GetConfigCallback cb); + Return getConfigImpl(int commandCode, const char* commandName, + GetConfigCallback _hidl_cb); Result getCurrentConfigImpl(uint32_t featureId, uint32_t configSize, GetCurrentConfigSuccessCallback onSuccess); Result getSupportedConfigsImpl(uint32_t featureId, uint32_t maxConfigs, uint32_t configSize, diff --git a/audio/effect/all-versions/vts/functional/VtsHalAudioEffectTargetTest.cpp b/audio/effect/all-versions/vts/functional/VtsHalAudioEffectTargetTest.cpp index d95bb06c3ad66e7a4369211cc05e6e05a5192d0b..ff84f9d5623c9f3c4c8005a22262e5f51dd1991f 100644 --- a/audio/effect/all-versions/vts/functional/VtsHalAudioEffectTargetTest.cpp +++ b/audio/effect/all-versions/vts/functional/VtsHalAudioEffectTargetTest.cpp @@ -169,13 +169,15 @@ static const Uuid LOUDNESS_ENHANCER_EFFECT_TYPE = { 0xfe3199be, 0xaed0, 0x413f, 0x87bb, std::array{{0x11, 0x26, 0x0e, 0xb6, 0x3c, 0xf1}}}; -enum { PARAM_FACTORY_NAME, PARAM_EFFECT_UUID }; -using EffectParameter = std::tuple; +enum { PARAM_FACTORY_NAME, PARAM_EFFECT_UUID, PARAM_USE_AFTER_CLOSE }; +using EffectParameter = std::tuple; static inline std::string EffectParameterToString( const ::testing::TestParamInfo& info) { - return ::android::hardware::PrintInstanceNameToString(::testing::TestParamInfo{ - std::get(info.param), info.index}); + std::string prefix = std::get(info.param) ? "UseAfterClose_" : ""; + return prefix.append( + ::android::hardware::PrintInstanceNameToString(::testing::TestParamInfo{ + std::get(info.param), info.index})); } // The main test class for Audio Effect HIDL HAL. @@ -191,6 +193,13 @@ class AudioEffectHidlTest : public ::testing::TestWithParam { Return ret = effect->init(); ASSERT_TRUE(ret.isOk()); ASSERT_EQ(Result::OK, ret); + + useAfterClose = std::get(GetParam()); + if (useAfterClose) { + Return ret = effect->close(); + ASSERT_TRUE(ret.isOk()); + ASSERT_EQ(Result::OK, ret); + } } void TearDown() override { @@ -205,14 +214,34 @@ class AudioEffectHidlTest : public ::testing::TestWithParam { Uuid getEffectType() const { return std::get(GetParam()); } + void checkResult(const Result& result); + void checkResultForUseAfterClose(const Result& result); void findAndCreateEffect(const Uuid& type); void findEffectInstance(const Uuid& type, Uuid* uuid); void getChannelCount(uint32_t* channelCount); sp effectsFactory; sp effect; + bool useAfterClose; }; +void AudioEffectHidlTest::checkResult(const Result& result) { + if (!useAfterClose) { + ASSERT_EQ(Result::OK, result); + } else { + ASSERT_NO_FATAL_FAILURE(checkResultForUseAfterClose(result)); + } +} + +void AudioEffectHidlTest::checkResultForUseAfterClose(const Result& result) { + if (useAfterClose) { + // The actual error does not matter. It's important that the effect did not crash + // while executing any command after a call to "close", and that the returned status + // is not OK. + ASSERT_NE(Result::OK, result); + } +} + void AudioEffectHidlTest::findAndCreateEffect(const Uuid& type) { Uuid effectUuid; ASSERT_NO_FATAL_FAILURE(findEffectInstance(type, &effectUuid)); @@ -257,7 +286,11 @@ void AudioEffectHidlTest::getChannelCount(uint32_t* channelCount) { } }); ASSERT_TRUE(ret.isOk()); - ASSERT_EQ(Result::OK, retval); + ASSERT_NO_FATAL_FAILURE(checkResult(retval)); + if (useAfterClose) { + *channelCount = 1; + return; + } #if MAJOR_VERSION <= 6 ASSERT_TRUE(audio_channel_mask_is_valid( static_cast(currentConfig.outputCfg.channels))); @@ -276,7 +309,7 @@ TEST_P(AudioEffectHidlTest, Close) { description("Verify that an effect can be closed"); Return ret = effect->close(); EXPECT_TRUE(ret.isOk()); - EXPECT_EQ(Result::OK, ret); + ASSERT_NO_FATAL_FAILURE(checkResult(ret)); } TEST_P(AudioEffectHidlTest, GetDescriptor) { @@ -290,7 +323,8 @@ TEST_P(AudioEffectHidlTest, GetDescriptor) { } }); EXPECT_TRUE(ret.isOk()); - EXPECT_EQ(Result::OK, retval); + ASSERT_NO_FATAL_FAILURE(checkResult(retval)); + if (useAfterClose) return; EXPECT_EQ(getEffectType(), actualType); } @@ -307,7 +341,8 @@ TEST_P(AudioEffectHidlTest, GetSetConfig) { } }); EXPECT_TRUE(ret.isOk()); - EXPECT_EQ(Result::OK, retval); + EXPECT_NO_FATAL_FAILURE(checkResult(retval)); + if (useAfterClose) return; Return ret2 = effect->setConfig(currentConfig, nullptr, nullptr); EXPECT_TRUE(ret2.isOk()); EXPECT_EQ(Result::OK, ret2); @@ -336,7 +371,8 @@ TEST_P(AudioEffectHidlTest, SetConfigInvalidArguments) { } }); EXPECT_TRUE(ret.isOk()); - EXPECT_EQ(Result::OK, retval); + EXPECT_NO_FATAL_FAILURE(checkResult(retval)); + if (useAfterClose) return; for (const auto& invalidInputCfg : generateInvalidConfigs(currentConfig.inputCfg)) { EffectConfig invalidConfig = currentConfig; invalidConfig.inputCfg = invalidInputCfg; @@ -356,27 +392,35 @@ TEST_P(AudioEffectHidlTest, SetConfigInvalidArguments) { TEST_P(AudioEffectHidlTest, GetConfigReverse) { description("Verify that GetConfigReverse does not crash"); - Return ret = effect->getConfigReverse([&](Result, const EffectConfig&) {}); + Result retval = Result::OK; + Return ret = effect->getConfigReverse([&](Result r, const EffectConfig&) { retval = r; }); EXPECT_TRUE(ret.isOk()); + EXPECT_NO_FATAL_FAILURE(checkResultForUseAfterClose(retval)); } TEST_P(AudioEffectHidlTest, GetSupportedAuxChannelsConfigs) { description("Verify that GetSupportedAuxChannelsConfigs does not crash"); + Result retval = Result::OK; Return ret = effect->getSupportedAuxChannelsConfigs( - 0, [&](Result, const hidl_vec&) {}); + 0, [&](Result r, const hidl_vec&) { retval = r; }); EXPECT_TRUE(ret.isOk()); + EXPECT_NO_FATAL_FAILURE(checkResultForUseAfterClose(retval)); } TEST_P(AudioEffectHidlTest, GetAuxChannelsConfig) { description("Verify that GetAuxChannelsConfig does not crash"); - Return ret = effect->getAuxChannelsConfig([&](Result, const EffectAuxChannelsConfig&) {}); + Result retval = Result::OK; + Return ret = effect->getAuxChannelsConfig( + [&](Result r, const EffectAuxChannelsConfig&) { retval = r; }); EXPECT_TRUE(ret.isOk()); + EXPECT_NO_FATAL_FAILURE(checkResultForUseAfterClose(retval)); } TEST_P(AudioEffectHidlTest, SetAuxChannelsConfig) { description("Verify that SetAuxChannelsConfig does not crash"); Return ret = effect->setAuxChannelsConfig(EffectAuxChannelsConfig()); EXPECT_TRUE(ret.isOk()); + EXPECT_NO_FATAL_FAILURE(checkResultForUseAfterClose(ret)); } // Not generated automatically because AudioBuffer contains @@ -427,45 +471,56 @@ TEST_P(AudioEffectHidlTest, Reset) { description("Verify that Reset preserves effect configuration"); Result retval = Result::NOT_INITIALIZED; EffectConfig originalConfig; - Return ret = effect->getConfig([&](Result r, const EffectConfig& conf) { - retval = r; - if (r == Result::OK) { - originalConfig = conf; - } - }); - ASSERT_TRUE(ret.isOk()); - ASSERT_EQ(Result::OK, retval); + if (!useAfterClose) { + Return ret = effect->getConfig([&](Result r, const EffectConfig& conf) { + retval = r; + if (r == Result::OK) { + originalConfig = conf; + } + }); + ASSERT_TRUE(ret.isOk()); + ASSERT_EQ(Result::OK, retval); + } Return ret2 = effect->reset(); EXPECT_TRUE(ret2.isOk()); - EXPECT_EQ(Result::OK, ret2); - EffectConfig configAfterReset; - ret = effect->getConfig([&](Result r, const EffectConfig& conf) { - retval = r; - if (r == Result::OK) { - configAfterReset = conf; - } - }); - EXPECT_EQ(originalConfig, configAfterReset); + EXPECT_NO_FATAL_FAILURE(checkResult(ret2)); + if (!useAfterClose) { + EffectConfig configAfterReset; + Return ret = effect->getConfig([&](Result r, const EffectConfig& conf) { + retval = r; + if (r == Result::OK) { + configAfterReset = conf; + } + }); + EXPECT_EQ(originalConfig, configAfterReset); + } } TEST_P(AudioEffectHidlTest, DisableEnableDisable) { description("Verify Disable -> Enable -> Disable sequence for an effect"); Return ret = effect->disable(); EXPECT_TRUE(ret.isOk()); - // Note: some legacy effects may return -EINVAL (INVALID_ARGUMENTS), - // more canonical is to return -ENOSYS (NOT_SUPPORTED) - EXPECT_TRUE(ret == Result::NOT_SUPPORTED || ret == Result::INVALID_ARGUMENTS); + if (!useAfterClose) { + // Note: some legacy effects may return -EINVAL (INVALID_ARGUMENTS), + // more canonical is to return -ENOSYS (NOT_SUPPORTED) + EXPECT_TRUE(ret == Result::NOT_SUPPORTED || ret == Result::INVALID_ARGUMENTS); + } else { + EXPECT_NO_FATAL_FAILURE(checkResultForUseAfterClose(ret)); + } ret = effect->enable(); EXPECT_TRUE(ret.isOk()); - EXPECT_EQ(Result::OK, ret); + EXPECT_NO_FATAL_FAILURE(checkResult(ret)); ret = effect->disable(); EXPECT_TRUE(ret.isOk()); - EXPECT_EQ(Result::OK, ret); + EXPECT_NO_FATAL_FAILURE(checkResult(ret)); } #if MAJOR_VERSION >= 7 TEST_P(AudioEffectHidlTest, SetDeviceInvalidDeviceAddress) { description("Verify that invalid device address is rejected by SetDevice"); + if (useAfterClose) { + GTEST_SKIP() << "Does not make sense for the useAfterClose case"; + } DeviceAddress device{.deviceType = "random_string"}; Return ret = effect->setDevice(device); EXPECT_TRUE(ret.isOk()); @@ -482,13 +537,13 @@ TEST_P(AudioEffectHidlTest, SetDevice) { Return ret = effect->setDevice(device); #endif EXPECT_TRUE(ret.isOk()); - EXPECT_EQ(Result::OK, ret); + EXPECT_NO_FATAL_FAILURE(checkResult(ret)); } TEST_P(AudioEffectHidlTest, SetAndGetVolume) { description("Verify that SetAndGetVolume method works for an effect"); uint32_t channelCount; - getChannelCount(&channelCount); + ASSERT_NO_FATAL_FAILURE(getChannelCount(&channelCount)); hidl_vec volumes; volumes.resize(channelCount); for (uint32_t i = 0; i < channelCount; ++i) { @@ -498,13 +553,13 @@ TEST_P(AudioEffectHidlTest, SetAndGetVolume) { Return ret = effect->setAndGetVolume(volumes, [&](Result r, const hidl_vec&) { retval = r; }); EXPECT_TRUE(ret.isOk()); - EXPECT_EQ(Result::OK, retval); + EXPECT_NO_FATAL_FAILURE(checkResult(retval)); } TEST_P(AudioEffectHidlTest, VolumeChangeNotification) { description("Verify that effect accepts VolumeChangeNotification"); uint32_t channelCount; - getChannelCount(&channelCount); + ASSERT_NO_FATAL_FAILURE(getChannelCount(&channelCount)); hidl_vec volumes; volumes.resize(channelCount); for (uint32_t i = 0; i < channelCount; ++i) { @@ -512,25 +567,29 @@ TEST_P(AudioEffectHidlTest, VolumeChangeNotification) { } Return ret = effect->volumeChangeNotification(volumes); EXPECT_TRUE(ret.isOk()); - EXPECT_EQ(Result::OK, ret); + EXPECT_NO_FATAL_FAILURE(checkResult(ret)); } TEST_P(AudioEffectHidlTest, SetAudioMode) { description("Verify that SetAudioMode works for an effect"); Return ret = effect->setAudioMode(AudioMode::NORMAL); EXPECT_TRUE(ret.isOk()); - EXPECT_EQ(Result::OK, ret); + EXPECT_NO_FATAL_FAILURE(checkResult(ret)); } TEST_P(AudioEffectHidlTest, SetConfigReverse) { description("Verify that SetConfigReverse does not crash"); Return ret = effect->setConfigReverse(EffectConfig(), nullptr, nullptr); EXPECT_TRUE(ret.isOk()); + EXPECT_NO_FATAL_FAILURE(checkResultForUseAfterClose(ret)); } #if MAJOR_VERSION >= 7 TEST_P(AudioEffectHidlTest, SetInputDeviceInvalidDeviceAddress) { description("Verify that invalid device address is rejected by SetInputDevice"); + if (useAfterClose) { + GTEST_SKIP() << "Does not make sense for the useAfterClose case"; + } DeviceAddress device{.deviceType = "random_string"}; Return ret = effect->setInputDevice(device); EXPECT_TRUE(ret.isOk()); @@ -548,11 +607,15 @@ TEST_P(AudioEffectHidlTest, SetInputDevice) { Return ret = effect->setInputDevice(device); #endif EXPECT_TRUE(ret.isOk()); + EXPECT_NO_FATAL_FAILURE(checkResultForUseAfterClose(ret)); } #if MAJOR_VERSION >= 7 TEST_P(AudioEffectHidlTest, SetInvalidAudioSource) { description("Verify that an invalid audio source is rejected by SetAudioSource"); + if (useAfterClose) { + GTEST_SKIP() << "Does not make sense for the useAfterClose case"; + } Return ret = effect->setAudioSource("random_string"); ASSERT_TRUE(ret.isOk()); EXPECT_TRUE(ret == Result::INVALID_ARGUMENTS || ret == Result::NOT_SUPPORTED) @@ -568,12 +631,14 @@ TEST_P(AudioEffectHidlTest, SetAudioSource) { Return ret = effect->setAudioSource(toString(xsd::AudioSource::AUDIO_SOURCE_MIC)); #endif EXPECT_TRUE(ret.isOk()); + EXPECT_NO_FATAL_FAILURE(checkResultForUseAfterClose(ret)); } TEST_P(AudioEffectHidlTest, Offload) { description("Verify that calling Offload method does not crash"); Return ret = effect->offload(EffectOffloadParameter{}); EXPECT_TRUE(ret.isOk()); + EXPECT_NO_FATAL_FAILURE(checkResultForUseAfterClose(ret)); } TEST_P(AudioEffectHidlTest, PrepareForProcessing) { @@ -582,7 +647,7 @@ TEST_P(AudioEffectHidlTest, PrepareForProcessing) { Return ret = effect->prepareForProcessing( [&](Result r, const MQDescriptorSync&) { retval = r; }); EXPECT_TRUE(ret.isOk()); - EXPECT_EQ(Result::OK, retval); + EXPECT_NO_FATAL_FAILURE(checkResult(retval)); } TEST_P(AudioEffectHidlTest, SetProcessBuffers) { @@ -601,7 +666,7 @@ TEST_P(AudioEffectHidlTest, SetProcessBuffers) { ASSERT_TRUE(success); Return ret2 = effect->setProcessBuffers(buffer, buffer); EXPECT_TRUE(ret2.isOk()); - EXPECT_EQ(Result::OK, ret2); + EXPECT_NO_FATAL_FAILURE(checkResult(ret2)); } TEST_P(AudioEffectHidlTest, Command) { @@ -615,6 +680,7 @@ TEST_P(AudioEffectHidlTest, SetParameter) { description("Verify that SetParameter does not crash"); Return ret = effect->setParameter(hidl_vec(), hidl_vec()); EXPECT_TRUE(ret.isOk()); + EXPECT_NO_FATAL_FAILURE(checkResultForUseAfterClose(ret)); } TEST_P(AudioEffectHidlTest, GetParameter) { @@ -630,6 +696,9 @@ TEST_P(AudioEffectHidlTest, GetParameterInvalidMaxReplySize) { if (!isNewDeviceLaunchingOnTPlus) { GTEST_SKIP() << "The test only applies to devices launching on T or later"; } + if (useAfterClose) { + GTEST_SKIP() << "Does not make sense for the useAfterClose case"; + } // Use a non-empty parameter to avoid being rejected by any earlier checks. hidl_vec parameter; parameter.resize(16); @@ -647,16 +716,20 @@ TEST_P(AudioEffectHidlTest, GetParameterInvalidMaxReplySize) { TEST_P(AudioEffectHidlTest, GetSupportedConfigsForFeature) { description("Verify that GetSupportedConfigsForFeature does not crash"); + Result retval = Result::OK; Return ret = effect->getSupportedConfigsForFeature( - 0, 0, 0, [&](Result, uint32_t, const hidl_vec&) {}); + 0, 0, 0, [&](Result r, uint32_t, const hidl_vec&) { retval = r; }); EXPECT_TRUE(ret.isOk()); + EXPECT_NO_FATAL_FAILURE(checkResultForUseAfterClose(retval)); } TEST_P(AudioEffectHidlTest, GetCurrentConfigForFeature) { description("Verify that GetCurrentConfigForFeature does not crash"); - Return ret = - effect->getCurrentConfigForFeature(0, 0, [&](Result, const hidl_vec&) {}); + Result retval = Result::OK; + Return ret = effect->getCurrentConfigForFeature( + 0, 0, [&](Result r, const hidl_vec&) { retval = r; }); EXPECT_TRUE(ret.isOk()); + EXPECT_NO_FATAL_FAILURE(checkResultForUseAfterClose(retval)); } TEST_P(AudioEffectHidlTest, SetCurrentConfigForFeature) { @@ -671,6 +744,9 @@ TEST_P(AudioEffectHidlTest, GetSupportedConfigsForFeatureInvalidConfigSize) { if (!isNewDeviceLaunchingOnTPlus) { GTEST_SKIP() << "The test only applies to devices launching on T or later"; } + if (useAfterClose) { + GTEST_SKIP() << "Does not make sense for the useAfterClose case"; + } // Use very large size to ensure that the service does not crash. const uint32_t veryLargeConfigSize = std::numeric_limits::max() - 100; Result retval = Result::OK; @@ -687,6 +763,9 @@ TEST_P(AudioEffectHidlTest, GetCurrentConfigForFeatureInvalidConfigSize) { if (!isNewDeviceLaunchingOnTPlus) { GTEST_SKIP() << "The test only applies to devices launching on T or later"; } + if (useAfterClose) { + GTEST_SKIP() << "Does not make sense for the useAfterClose case"; + } // Use very large size to ensure that the service does not crash. const uint32_t veryLargeConfigSize = std::numeric_limits::max() - 100; Result retval = Result::OK; @@ -729,7 +808,8 @@ void EqualizerAudioEffectHidlTest::getNumBands(uint16_t* numBands) { } }); ASSERT_TRUE(ret.isOk()); - ASSERT_EQ(Result::OK, retval); + ASSERT_NO_FATAL_FAILURE(checkResult(retval)); + if (useAfterClose) *numBands = 1; } void EqualizerAudioEffectHidlTest::getLevelRange(int16_t* minLevel, int16_t* maxLevel) { @@ -742,7 +822,11 @@ void EqualizerAudioEffectHidlTest::getLevelRange(int16_t* minLevel, int16_t* max } }); ASSERT_TRUE(ret.isOk()); - ASSERT_EQ(Result::OK, retval); + ASSERT_NO_FATAL_FAILURE(checkResult(retval)); + if (useAfterClose) { + *minLevel = 0; + *maxLevel = 255; + } } void EqualizerAudioEffectHidlTest::getBandFrequencyRange(uint16_t band, uint32_t* minFreq, @@ -757,7 +841,7 @@ void EqualizerAudioEffectHidlTest::getBandFrequencyRange(uint16_t band, uint32_t } }); ASSERT_TRUE(ret.isOk()); - ASSERT_EQ(Result::OK, retval); + ASSERT_NO_FATAL_FAILURE(checkResult(retval)); ret = equalizer->getBandCenterFrequency(band, [&](Result r, uint32_t center) { retval = r; if (retval == Result::OK) { @@ -765,7 +849,12 @@ void EqualizerAudioEffectHidlTest::getBandFrequencyRange(uint16_t band, uint32_t } }); ASSERT_TRUE(ret.isOk()); - ASSERT_EQ(Result::OK, retval); + ASSERT_NO_FATAL_FAILURE(checkResult(retval)); + if (useAfterClose) { + *minFreq = 20; + *centerFreq = 10000; + *maxFreq = 20000; + } } void EqualizerAudioEffectHidlTest::getPresetCount(size_t* count) { @@ -777,37 +866,38 @@ void EqualizerAudioEffectHidlTest::getPresetCount(size_t* count) { } }); ASSERT_TRUE(ret.isOk()); - ASSERT_EQ(Result::OK, retval); + ASSERT_NO_FATAL_FAILURE(checkResult(retval)); + if (useAfterClose) *count = 1; } TEST_P(EqualizerAudioEffectHidlTest, GetNumBands) { description("Verify that Equalizer effect reports at least one band"); uint16_t numBands = 0; - getNumBands(&numBands); + ASSERT_NO_FATAL_FAILURE(getNumBands(&numBands)); EXPECT_GT(numBands, 0); } TEST_P(EqualizerAudioEffectHidlTest, GetLevelRange) { description("Verify that Equalizer effect reports adequate band level range"); int16_t minLevel = 0x7fff, maxLevel = 0; - getLevelRange(&minLevel, &maxLevel); + ASSERT_NO_FATAL_FAILURE(getLevelRange(&minLevel, &maxLevel)); EXPECT_GT(maxLevel, minLevel); } TEST_P(EqualizerAudioEffectHidlTest, GetSetBandLevel) { description("Verify that manipulating band levels works for Equalizer effect"); uint16_t numBands = 0; - getNumBands(&numBands); + ASSERT_NO_FATAL_FAILURE(getNumBands(&numBands)); ASSERT_GT(numBands, 0); int16_t levels[3]{0x7fff, 0, 0}; - getLevelRange(&levels[0], &levels[2]); + ASSERT_NO_FATAL_FAILURE(getLevelRange(&levels[0], &levels[2])); ASSERT_GT(levels[2], levels[0]); levels[1] = (levels[2] + levels[0]) / 2; for (uint16_t i = 0; i < numBands; ++i) { for (size_t j = 0; j < ARRAY_SIZE(levels); ++j) { Return ret = equalizer->setBandLevel(i, levels[j]); EXPECT_TRUE(ret.isOk()); - EXPECT_EQ(Result::OK, ret); + EXPECT_NO_FATAL_FAILURE(checkResult(ret)); Result retval = Result::NOT_INITIALIZED; int16_t actualLevel; Return ret2 = equalizer->getBandLevel(i, [&](Result r, int16_t l) { @@ -817,8 +907,10 @@ TEST_P(EqualizerAudioEffectHidlTest, GetSetBandLevel) { } }); EXPECT_TRUE(ret2.isOk()); - EXPECT_EQ(Result::OK, retval); - EXPECT_EQ(levels[j], actualLevel); + EXPECT_NO_FATAL_FAILURE(checkResult(retval)); + if (!useAfterClose) { + EXPECT_EQ(levels[j], actualLevel); + } } } } @@ -826,11 +918,11 @@ TEST_P(EqualizerAudioEffectHidlTest, GetSetBandLevel) { TEST_P(EqualizerAudioEffectHidlTest, GetBandCenterFrequencyAndRange) { description("Verify that Equalizer effect reports adequate band frequency range"); uint16_t numBands = 0; - getNumBands(&numBands); + ASSERT_NO_FATAL_FAILURE(getNumBands(&numBands)); ASSERT_GT(numBands, 0); for (uint16_t i = 0; i < numBands; ++i) { uint32_t minFreq = 0xffffffff, centerFreq = 0xffffffff, maxFreq = 0xffffffff; - getBandFrequencyRange(i, &minFreq, ¢erFreq, &maxFreq); + ASSERT_NO_FATAL_FAILURE(getBandFrequencyRange(i, &minFreq, ¢erFreq, &maxFreq)); // Note: NXP legacy implementation reports "1" as upper bound for last band, // so this check fails. EXPECT_GE(maxFreq, centerFreq); @@ -841,7 +933,7 @@ TEST_P(EqualizerAudioEffectHidlTest, GetBandCenterFrequencyAndRange) { TEST_P(EqualizerAudioEffectHidlTest, GetBandForFrequency) { description("Verify that Equalizer effect supports GetBandForFrequency correctly"); uint16_t numBands = 0; - getNumBands(&numBands); + ASSERT_NO_FATAL_FAILURE(getNumBands(&numBands)); ASSERT_GT(numBands, 0); for (uint16_t i = 0; i < numBands; ++i) { uint32_t freqs[3]{0, 0, 0}; @@ -861,8 +953,10 @@ TEST_P(EqualizerAudioEffectHidlTest, GetBandForFrequency) { } }); EXPECT_TRUE(ret.isOk()); - EXPECT_EQ(Result::OK, retval); - EXPECT_EQ(i, actualBand) << "Frequency: " << freqs[j]; + EXPECT_NO_FATAL_FAILURE(checkResult(retval)); + if (!useAfterClose) { + EXPECT_EQ(i, actualBand) << "Frequency: " << freqs[j]; + } } } } @@ -870,19 +964,19 @@ TEST_P(EqualizerAudioEffectHidlTest, GetBandForFrequency) { TEST_P(EqualizerAudioEffectHidlTest, GetPresetNames) { description("Verify that Equalizer effect reports at least one preset"); size_t presetCount; - getPresetCount(&presetCount); + ASSERT_NO_FATAL_FAILURE(getPresetCount(&presetCount)); EXPECT_GT(presetCount, 0u); } TEST_P(EqualizerAudioEffectHidlTest, GetSetCurrentPreset) { description("Verify that manipulating the current preset for Equalizer effect"); size_t presetCount; - getPresetCount(&presetCount); + ASSERT_NO_FATAL_FAILURE(getPresetCount(&presetCount)); ASSERT_GT(presetCount, 0u); for (uint16_t i = 0; i < presetCount; ++i) { Return ret = equalizer->setCurrentPreset(i); EXPECT_TRUE(ret.isOk()); - EXPECT_EQ(Result::OK, ret); + EXPECT_NO_FATAL_FAILURE(checkResult(ret)); Result retval = Result::NOT_INITIALIZED; uint16_t actualPreset = 0xffff; Return ret2 = equalizer->getCurrentPreset([&](Result r, uint16_t p) { @@ -892,8 +986,10 @@ TEST_P(EqualizerAudioEffectHidlTest, GetSetCurrentPreset) { } }); EXPECT_TRUE(ret2.isOk()); - EXPECT_EQ(Result::OK, retval); - EXPECT_EQ(i, actualPreset); + EXPECT_NO_FATAL_FAILURE(checkResult(retval)); + if (!useAfterClose) { + EXPECT_EQ(i, actualPreset); + } } } @@ -904,7 +1000,7 @@ TEST_P(EqualizerAudioEffectHidlTest, GetSetAllProperties) { using AllProperties = ::android::hardware::audio::effect::CPP_VERSION::IEqualizerEffect::AllProperties; uint16_t numBands = 0; - getNumBands(&numBands); + ASSERT_NO_FATAL_FAILURE(getNumBands(&numBands)); ASSERT_GT(numBands, 0); AllProperties props; props.bandLevels.resize(numBands); @@ -919,7 +1015,7 @@ TEST_P(EqualizerAudioEffectHidlTest, GetSetAllProperties) { props.curPreset = -1; Return ret = equalizer->setAllProperties(props); EXPECT_TRUE(ret.isOk()); - EXPECT_EQ(Result::OK, ret); + EXPECT_NO_FATAL_FAILURE(checkResult(ret)); Return ret2 = equalizer->getAllProperties([&](Result r, AllProperties p) { retval = r; if (retval == Result::OK) { @@ -927,14 +1023,16 @@ TEST_P(EqualizerAudioEffectHidlTest, GetSetAllProperties) { } }); EXPECT_TRUE(ret2.isOk()); - EXPECT_EQ(Result::OK, retval); - EXPECT_EQ(props.bandLevels, actualProps.bandLevels); + EXPECT_NO_FATAL_FAILURE(checkResult(retval)); + if (!useAfterClose) { + EXPECT_EQ(props.bandLevels, actualProps.bandLevels); + } // Verify setting of the current preset via properties. props.curPreset = 0; // Assuming there is at least one preset. ret = equalizer->setAllProperties(props); EXPECT_TRUE(ret.isOk()); - EXPECT_EQ(Result::OK, ret); + EXPECT_NO_FATAL_FAILURE(checkResult(ret)); ret2 = equalizer->getAllProperties([&](Result r, AllProperties p) { retval = r; if (retval == Result::OK) { @@ -942,8 +1040,10 @@ TEST_P(EqualizerAudioEffectHidlTest, GetSetAllProperties) { } }); EXPECT_TRUE(ret2.isOk()); - EXPECT_EQ(Result::OK, retval); - EXPECT_EQ(props.curPreset, actualProps.curPreset); + EXPECT_NO_FATAL_FAILURE(checkResult(retval)); + if (!useAfterClose) { + EXPECT_EQ(props.curPreset, actualProps.curPreset); + } } // The main test class for Equalizer Audio Effect HIDL HAL. @@ -971,7 +1071,7 @@ TEST_P(LoudnessEnhancerAudioEffectHidlTest, GetSetTargetGain) { const int32_t gain = 100; Return ret = enhancer->setTargetGain(gain); EXPECT_TRUE(ret.isOk()); - EXPECT_EQ(Result::OK, ret); + EXPECT_NO_FATAL_FAILURE(checkResult(ret)); int32_t actualGain = 0; Result retval; Return ret2 = enhancer->getTargetGain([&](Result r, int32_t g) { @@ -981,8 +1081,10 @@ TEST_P(LoudnessEnhancerAudioEffectHidlTest, GetSetTargetGain) { } }); EXPECT_TRUE(ret2.isOk()); - EXPECT_EQ(Result::OK, retval); - EXPECT_EQ(gain, actualGain); + EXPECT_NO_FATAL_FAILURE(checkResult(retval)); + if (!useAfterClose) { + EXPECT_EQ(gain, actualGain); + } } INSTANTIATE_TEST_SUITE_P(EffectsFactory, AudioEffectsFactoryHidlTest, @@ -993,25 +1095,29 @@ INSTANTIATE_TEST_SUITE_P( Equalizer_IEffect, AudioEffectHidlTest, ::testing::Combine(::testing::ValuesIn(::android::hardware::getAllHalInstanceNames( IEffectsFactory::descriptor)), - ::testing::Values(EQUALIZER_EFFECT_TYPE)), + ::testing::Values(EQUALIZER_EFFECT_TYPE), + ::testing::Values(false, true) /*useAfterClose*/), EffectParameterToString); INSTANTIATE_TEST_SUITE_P( LoudnessEnhancer_IEffect, AudioEffectHidlTest, ::testing::Combine(::testing::ValuesIn(::android::hardware::getAllHalInstanceNames( IEffectsFactory::descriptor)), - ::testing::Values(LOUDNESS_ENHANCER_EFFECT_TYPE)), + ::testing::Values(LOUDNESS_ENHANCER_EFFECT_TYPE), + ::testing::Values(false, true) /*useAfterClose*/), EffectParameterToString); INSTANTIATE_TEST_SUITE_P( Equalizer, EqualizerAudioEffectHidlTest, ::testing::Combine(::testing::ValuesIn(::android::hardware::getAllHalInstanceNames( IEffectsFactory::descriptor)), - ::testing::Values(EQUALIZER_EFFECT_TYPE)), + ::testing::Values(EQUALIZER_EFFECT_TYPE), + ::testing::Values(false, true) /*useAfterClose*/), EffectParameterToString); INSTANTIATE_TEST_SUITE_P( LoudnessEnhancer, LoudnessEnhancerAudioEffectHidlTest, ::testing::Combine(::testing::ValuesIn(::android::hardware::getAllHalInstanceNames( IEffectsFactory::descriptor)), - ::testing::Values(LOUDNESS_ENHANCER_EFFECT_TYPE)), + ::testing::Values(LOUDNESS_ENHANCER_EFFECT_TYPE), + ::testing::Values(false, true) /*useAfterClose*/), EffectParameterToString); // When the VTS test runs on a device lacking the corresponding HAL version the parameter // list is empty, this isn't a problem. diff --git a/automotive/evs/aidl/Android.bp b/automotive/evs/aidl/Android.bp index bafb4af30f3be3a440000794686b505109e61e06..3bfe8f306985abe6ea969958aded078b9727a00c 100644 --- a/automotive/evs/aidl/Android.bp +++ b/automotive/evs/aidl/Android.bp @@ -30,7 +30,7 @@ aidl_interface { stability: "vintf", imports: [ "android.hardware.common-V2", - "android.hardware.graphics.common-V4", + "android.hardware.graphics.common-V5", ], backend: { java: { @@ -53,14 +53,14 @@ aidl_interface { version: "1", imports: [ "android.hardware.common-V2", - "android.hardware.graphics.common-V4", + "android.hardware.graphics.common-V5", ], }, { version: "2", imports: [ "android.hardware.common-V2", - "android.hardware.graphics.common-V4", + "android.hardware.graphics.common-V5", ], }, diff --git a/automotive/evs/aidl/impl/default/Android.bp b/automotive/evs/aidl/impl/default/Android.bp index 70c523b5faff4076a7e9b314ac53b349188168b7..3d5b7c4956d8cbacd32e5e98ad4b13b457588c85 100644 --- a/automotive/evs/aidl/impl/default/Android.bp +++ b/automotive/evs/aidl/impl/default/Android.bp @@ -21,24 +21,11 @@ package { default_applicable_licenses: ["hardware_interfaces_license"], } -cc_binary { - name: "android.hardware.automotive.evs-aidl-default-service", +cc_defaults { + name: "android.hardware.automotive.evs-aidl-default-service-default", defaults: ["EvsHalDefaults"], - vintf_fragments: ["manifest_evs-default-service.xml"], - init_rc: ["evs-default-service.rc"], - vendor: true, - relative_install_path: "hw", - cflags: [ - "-DGL_GLEXT_PROTOTYPES", - "-DEGL_EGLEXT_PROTOTYPES", - "-Wall", - "-Wextra", - "-Werror", - "-Wthread-safety", - ], - srcs: [ - ":libgui_frame_event_aidl", - "src/*.cpp", + header_libs: [ + "libstagefright_headers", ], shared_libs: [ "android.hardware.graphics.bufferqueue@1.0", @@ -46,28 +33,63 @@ cc_binary { "android.hidl.token@1.0-utils", "libEGL", "libGLESv2", - "libbase", "libbinder_ndk", "libbufferqueueconverter", "libcamera_metadata", "libhardware_legacy", "libhidlbase", - "liblog", + "libmediandk", "libnativewindow", "libtinyxml2", "libui", - "libutils", "libyuv", ], - static_libs: [ - "android.frameworks.automotive.display-V1-ndk", +} + +cc_library { + name: "android.hardware.automotive.evs-aidl-default-service-lib", + defaults: ["android.hardware.automotive.evs-aidl-default-service-default"], + vendor: true, + cflags: [ + "-DGL_GLEXT_PROTOTYPES", + "-DEGL_EGLEXT_PROTOTYPES", + ], + srcs: [ + ":libgui_frame_event_aidl", + "src/*.cpp", + ], + exclude_srcs: ["src/service.cpp"], + whole_static_libs: [ + "android.frameworks.automotive.display-V2-ndk", "android.hardware.automotive.evs-V2-ndk", "android.hardware.common-V2-ndk", "libaidlcommonsupport", "libcutils", ], + header_libs: [ + "libgui_aidl_headers", + ], local_include_dirs: ["include"], include_dirs: ["frameworks/native/include/"], + export_include_dirs: ["include"], +} + +cc_binary { + name: "android.hardware.automotive.evs-aidl-default-service", + defaults: ["android.hardware.automotive.evs-aidl-default-service-default"], + vintf_fragments: ["manifest_evs-default-service.xml"], + init_rc: ["evs-default-service.rc"], + vendor: true, + relative_install_path: "hw", + cflags: [ + "-DGL_GLEXT_PROTOTYPES", + "-DEGL_EGLEXT_PROTOTYPES", + ], + srcs: ["src/service.cpp"], + static_libs: [ + "android.hardware.automotive.evs-aidl-default-service-lib", + ], + include_dirs: ["frameworks/native/include/"], required: ["evs_mock_hal_configuration.xml"], } @@ -77,3 +99,31 @@ prebuilt_etc { src: "resources/evs_mock_configuration.xml", sub_dir: "automotive/evs", } + +cc_test { + name: "android.hardware.automotive.evs-aidl-default-service_cam_buffer_test", + defaults: ["android.hardware.automotive.evs-aidl-default-service-default"], + vendor: true, + srcs: ["tests/EvsCameraBufferTest.cpp"], + static_libs: [ + "android.hardware.automotive.evs-aidl-default-service-lib", + "libgmock", + ], + test_suites: [ + "general-tests", + ], +} + +cc_test { + name: "android.hardware.automotive.evs-aidl-default-service_cam_state_test", + defaults: ["android.hardware.automotive.evs-aidl-default-service-default"], + vendor: true, + srcs: ["tests/EvsCameraStateTest.cpp"], + static_libs: [ + "android.hardware.automotive.evs-aidl-default-service-lib", + "libgmock", + ], + test_suites: [ + "general-tests", + ], +} diff --git a/automotive/evs/aidl/impl/default/include/ConfigManager.h b/automotive/evs/aidl/impl/default/include/ConfigManager.h index 1d5fe772b243f4badb30851f406a45fc90104d59..37a17dc230e1100232720bd4a0c4fb59ef485fef 100644 --- a/automotive/evs/aidl/impl/default/include/ConfigManager.h +++ b/automotive/evs/aidl/impl/default/include/ConfigManager.h @@ -25,8 +25,10 @@ #include +#include #include #include +#include #include #include #include @@ -54,6 +56,15 @@ class ConfigManager final { /* Camera device's capabilities and metadata */ class CameraInfo { public: + enum class DeviceType : std::int32_t { + NONE = 0, + MOCK = 1, + V4L2 = 2, + VIDEO = 3, + + UNKNOWN = std::numeric_limits>::max(), + }; + CameraInfo() : characteristics(nullptr) {} virtual ~CameraInfo(); @@ -69,6 +80,10 @@ class ConfigManager final { return characteristics != nullptr; } + static DeviceType deviceTypeFromSV(const std::string_view sv); + + DeviceType deviceType{DeviceType::NONE}; + /* * List of supported controls that the primary client can program. * Paraemters are stored with its valid range diff --git a/automotive/evs/aidl/impl/default/include/EvsAllCameras.h b/automotive/evs/aidl/impl/default/include/EvsAllCameras.h new file mode 100644 index 0000000000000000000000000000000000000000..a76501d7581efd3eef5a07d721404a59990e353d --- /dev/null +++ b/automotive/evs/aidl/impl/default/include/EvsAllCameras.h @@ -0,0 +1,20 @@ +/* + * Copyright (C) 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include "EvsMockCamera.h" +#include "EvsVideoEmulatedCamera.h" diff --git a/automotive/evs/aidl/impl/default/include/EvsCamera.h b/automotive/evs/aidl/impl/default/include/EvsCamera.h new file mode 100644 index 0000000000000000000000000000000000000000..539d5f6f9c762806e691e898a8375ff05c78c412 --- /dev/null +++ b/automotive/evs/aidl/impl/default/include/EvsCamera.h @@ -0,0 +1,144 @@ +/* + * Copyright (C) 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include "EvsCameraBase.h" + +#include +#include + +#include +#include +#include +#include + +namespace aidl::android::hardware::automotive::evs::implementation { + +class EvsCamera : public EvsCameraBase { + private: + using Base = EvsCameraBase; + using Self = EvsCamera; + + public: + using Base::Base; + + ~EvsCamera() override; + + // Methods from ::android::hardware::automotive::evs::IEvsCamera follow. + ndk::ScopedAStatus doneWithFrame(const std::vector& buffers) override; + + ndk::ScopedAStatus importExternalBuffers(const std::vector& buffers, + int32_t* _aidl_return) override; + + ndk::ScopedAStatus setMaxFramesInFlight(int32_t bufferCount) override; + + ndk::ScopedAStatus startVideoStream( + const std::shared_ptr& receiver) override; + + ndk::ScopedAStatus stopVideoStream() override; + + ndk::ScopedAStatus pauseVideoStream() override; + + ndk::ScopedAStatus resumeVideoStream() override; + + protected: + virtual ::android::status_t allocateOneFrame(buffer_handle_t* handle) = 0; + + virtual void freeOneFrame(const buffer_handle_t handle); + + virtual bool preVideoStreamStart_locked(const std::shared_ptr& receiver, + ndk::ScopedAStatus& status, + std::unique_lock& lck); + + virtual bool startVideoStreamImpl_locked(const std::shared_ptr& receiver, + ndk::ScopedAStatus& status, + std::unique_lock& lck) = 0; + + virtual bool postVideoStreamStart_locked(const std::shared_ptr& receiver, + ndk::ScopedAStatus& status, + std::unique_lock& lck); + + virtual bool preVideoStreamStop_locked(ndk::ScopedAStatus& status, + std::unique_lock& lck); + + virtual bool stopVideoStreamImpl_locked(ndk::ScopedAStatus& status, + std::unique_lock& lck) = 0; + + virtual bool postVideoStreamStop_locked(ndk::ScopedAStatus& status, + std::unique_lock& lck); + + void shutdown() override; + + void closeAllBuffers_unsafe(); + + // Returns (ID, handle) if succeeds. (kInvalidBufferID, nullptr) otherwise. + [[nodiscard]] std::pair useBuffer_unsafe(); + + void returnBuffer_unsafe(const std::size_t id); + + bool increaseAvailableFrames_unsafe(const buffer_handle_t handle); + + bool decreaseAvailableFrames_unsafe(); + + bool setAvailableFrames_unsafe(const std::size_t bufferCount); + + void swapBufferFrames_unsafe(const std::size_t pos1, const std::size_t pos2); + + struct BufferRecord { + BufferRecord() = default; + BufferRecord(const BufferRecord&) = default; + BufferRecord(BufferRecord&&) = default; + BufferRecord& operator=(const BufferRecord&) = default; + BufferRecord& operator=(BufferRecord&&) = default; + ~BufferRecord() = default; + + explicit BufferRecord(buffer_handle_t h) : handle(h) {} + + buffer_handle_t handle{nullptr}; + bool inUse{false}; + }; + + enum class StreamState { + STOPPED = 0, + RUNNING = 1, + STOPPING = 2, + DEAD = 3, + }; + + StreamState mStreamState{StreamState::STOPPED}; + + std::mutex mMutex; + + // Graphics buffers to transfer images, always in the order of: + // In use buffers ... available buffers ... unavailable (unallocated) buffers. + std::vector mBuffers; + + // Double-mapping between buffer position and ID. + std::vector mBufferPosToId; + std::vector mBufferIdToPos; + + std::size_t mAvailableFrames{0}; + std::size_t mFramesInUse{0}; + + // We use all 1's as a reserved invalid buffer ID. + static constexpr std::size_t kInvalidBufferID = ~static_cast(0); + + public: + static bool IsBufferIDValid(const std::size_t bufferId) { return ~bufferId; } +}; + +} // namespace aidl::android::hardware::automotive::evs::implementation diff --git a/automotive/evs/aidl/impl/default/include/EvsCameraBase.h b/automotive/evs/aidl/impl/default/include/EvsCameraBase.h new file mode 100644 index 0000000000000000000000000000000000000000..c3e9dfc47d7f55e5d46f2881d1bd8eba52a8ebb4 --- /dev/null +++ b/automotive/evs/aidl/impl/default/include/EvsCameraBase.h @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include + +namespace aidl::android::hardware::automotive::evs::implementation { + +class EvsCameraBase : public evs::BnEvsCamera { + private: + using Base = evs::BnEvsCamera; + using Self = EvsCameraBase; + + public: + using Base::Base; + + ~EvsCameraBase() override = default; + + virtual void shutdown() = 0; + + protected: + // This is used for the derived classes and it prevents constructors from direct access + // while it allows this class to be instantiated via ndk::SharedRefBase::make<>. + struct Sigil { + explicit Sigil() = default; + }; +}; + +} // namespace aidl::android::hardware::automotive::evs::implementation diff --git a/automotive/evs/aidl/impl/default/include/EvsEnumerator.h b/automotive/evs/aidl/impl/default/include/EvsEnumerator.h index 259c266721a4345c7a1ce9b419a7c3eb03927afe..9dcc774740ed0a7950a015aa195855c370b6eda7 100644 --- a/automotive/evs/aidl/impl/default/include/EvsEnumerator.h +++ b/automotive/evs/aidl/impl/default/include/EvsEnumerator.h @@ -17,8 +17,8 @@ #pragma once #include "ConfigManager.h" +#include "EvsCameraBase.h" #include "EvsGlDisplay.h" -#include "EvsMockCamera.h" #include #include @@ -27,6 +27,7 @@ #include #include #include +#include #include #include @@ -72,7 +73,7 @@ class EvsEnumerator final : public ::aidl::android::hardware::automotive::evs::B private: struct CameraRecord { evs::CameraDesc desc; - std::weak_ptr activeInstance; + std::weak_ptr activeInstance; CameraRecord(const char* cameraId) : desc() { desc.id = cameraId; } }; diff --git a/automotive/evs/aidl/impl/default/include/EvsGlDisplay.h b/automotive/evs/aidl/impl/default/include/EvsGlDisplay.h index ceabd9e8634bf8760a4f0cdfd78fb68c4b8245b6..0865a04109e0f011efc060ffb2dcf20c513b1f35 100644 --- a/automotive/evs/aidl/impl/default/include/EvsGlDisplay.h +++ b/automotive/evs/aidl/impl/default/include/EvsGlDisplay.h @@ -23,6 +23,7 @@ #include #include #include +#include #include diff --git a/automotive/evs/aidl/impl/default/include/EvsMockCamera.h b/automotive/evs/aidl/impl/default/include/EvsMockCamera.h index 7e010a29e0f17d54f307b73422b4ef9e3aabd8b5..cd685324be33b59b7f386bdd823cbb504408a91c 100644 --- a/automotive/evs/aidl/impl/default/include/EvsMockCamera.h +++ b/automotive/evs/aidl/impl/default/include/EvsMockCamera.h @@ -17,36 +17,36 @@ #pragma once #include "ConfigManager.h" +#include "EvsCamera.h" -#include -#include #include #include -#include #include #include #include #include -// #include #include #include -#include +#include +#include #include +#include +#include namespace aidl::android::hardware::automotive::evs::implementation { -class EvsMockCamera : public evs::BnEvsCamera { - // This prevents constructors from direct access while it allows this class to - // be instantiated via ndk::SharedRefBase::make<>. +class EvsMockCamera : public EvsCamera { private: - struct Sigil { - explicit Sigil() = default; - }; + using Base = EvsCamera; public: + EvsMockCamera(Sigil sigil, const char* deviceName, + std::unique_ptr& camInfo); + EvsMockCamera(const EvsMockCamera&) = delete; + EvsMockCamera& operator=(const EvsMockCamera&) = delete; + // Methods from ::android::hardware::automotive::evs::IEvsCamera follow. - ndk::ScopedAStatus doneWithFrame(const std::vector& buffers) override; ndk::ScopedAStatus forcePrimaryClient( const std::shared_ptr& display) override; ndk::ScopedAStatus getCameraInfo(evs::CameraDesc* _aidl_return) override; @@ -58,47 +58,37 @@ class EvsMockCamera : public evs::BnEvsCamera { ndk::ScopedAStatus getParameterList(std::vector* _aidl_return) override; ndk::ScopedAStatus getPhysicalCameraInfo(const std::string& deviceId, evs::CameraDesc* _aidl_return) override; - ndk::ScopedAStatus importExternalBuffers(const std::vector& buffers, - int32_t* _aidl_return) override; - ndk::ScopedAStatus pauseVideoStream() override; - ndk::ScopedAStatus resumeVideoStream() override; ndk::ScopedAStatus setExtendedInfo(int32_t opaqueIdentifier, const std::vector& opaqueValue) override; ndk::ScopedAStatus setIntParameter(evs::CameraParam id, int32_t value, std::vector* effectiveValue) override; ndk::ScopedAStatus setPrimaryClient() override; - ndk::ScopedAStatus setMaxFramesInFlight(int32_t bufferCount) override; - ndk::ScopedAStatus startVideoStream( - const std::shared_ptr& receiver) override; - ndk::ScopedAStatus stopVideoStream() override; ndk::ScopedAStatus unsetPrimaryClient() override; + const evs::CameraDesc& getDesc() { return mDescription; } + static std::shared_ptr Create(const char* deviceName); static std::shared_ptr Create( const char* deviceName, std::unique_ptr& camInfo, const evs::Stream* streamCfg = nullptr); - EvsMockCamera(const EvsMockCamera&) = delete; - EvsMockCamera& operator=(const EvsMockCamera&) = delete; - virtual ~EvsMockCamera() override; - void shutdown(); + private: + void generateFrames(); + void fillMockFrame(buffer_handle_t handle, const AHardwareBuffer_Desc* pDesc); - const evs::CameraDesc& getDesc() { return mDescription; } + ::android::status_t allocateOneFrame(buffer_handle_t* handle) override; - // Constructors - EvsMockCamera(Sigil sigil, const char* deviceName, - std::unique_ptr& camInfo); + bool startVideoStreamImpl_locked(const std::shared_ptr& receiver, + ndk::ScopedAStatus& status, + std::unique_lock& lck) override; - private: - // These three functions are expected to be called while mAccessLock is held - bool setAvailableFrames_Locked(unsigned bufferCount); - unsigned increaseAvailableFrames_Locked(unsigned numToAdd); - unsigned decreaseAvailableFrames_Locked(unsigned numToRemove); + bool stopVideoStreamImpl_locked(ndk::ScopedAStatus& status, + std::unique_lock& lck) override; - void generateFrames(); - void fillMockFrame(buffer_handle_t handle, const AHardwareBuffer_Desc* pDesc); - void returnBufferLocked(const uint32_t bufferId); - ndk::ScopedAStatus stopVideoStream_impl(); + bool postVideoStreamStop_locked(ndk::ScopedAStatus& status, + std::unique_lock& lck) override; + + void initializeParameters(); CameraDesc mDescription = {}; // The properties of this camera @@ -119,28 +109,6 @@ class EvsMockCamera : public evs::BnEvsCamera { // Bytes per line in the buffers uint32_t mStride = 0; - struct BufferRecord { - buffer_handle_t handle; - bool inUse; - - explicit BufferRecord(buffer_handle_t h) : handle(h), inUse(false){}; - }; - - std::vector mBuffers; // Graphics buffers to transfer images - unsigned mFramesAllowed; // How many buffers are we currently using - unsigned mFramesInUse; // How many buffers are currently outstanding - - enum StreamStateValues { - STOPPED, - RUNNING, - STOPPING, - DEAD, - }; - StreamStateValues mStreamState; - - // Synchronization necessary to deconflict mCaptureThread from the main service thread - std::mutex mAccessLock; - // Static camera module information std::unique_ptr& mCameraInfo; @@ -160,7 +128,6 @@ class EvsMockCamera : public evs::BnEvsCamera { int32_t value; }; std::unordered_map> mParams; - void initializeParameters(); }; } // namespace aidl::android::hardware::automotive::evs::implementation diff --git a/automotive/evs/aidl/impl/default/include/EvsVideoEmulatedCamera.h b/automotive/evs/aidl/impl/default/include/EvsVideoEmulatedCamera.h new file mode 100644 index 0000000000000000000000000000000000000000..a850d6598b4abd60bcca09b2830cbab3c9a843cf --- /dev/null +++ b/automotive/evs/aidl/impl/default/include/EvsVideoEmulatedCamera.h @@ -0,0 +1,161 @@ +/* + * Copyright (C) 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include "ConfigManager.h" +#include "EvsCamera.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include + +namespace aidl::android::hardware::automotive::evs::implementation { + +class EvsVideoEmulatedCamera : public EvsCamera { + private: + using Base = EvsCamera; + + public: + EvsVideoEmulatedCamera(Sigil sigil, const char* deviceName, + std::unique_ptr& camInfo); + + ~EvsVideoEmulatedCamera() override = default; + + // Methods from ::android::hardware::automotive::evs::IEvsCamera follow. + ndk::ScopedAStatus forcePrimaryClient( + const std::shared_ptr& display) override; + ndk::ScopedAStatus getCameraInfo(evs::CameraDesc* _aidl_return) override; + ndk::ScopedAStatus getExtendedInfo(int32_t opaqueIdentifier, + std::vector* value) override; + ndk::ScopedAStatus getIntParameter(evs::CameraParam id, std::vector* value) override; + ndk::ScopedAStatus getIntParameterRange(evs::CameraParam id, + evs::ParameterRange* _aidl_return) override; + ndk::ScopedAStatus getParameterList(std::vector* _aidl_return) override; + ndk::ScopedAStatus getPhysicalCameraInfo(const std::string& deviceId, + evs::CameraDesc* _aidl_return) override; + ndk::ScopedAStatus setExtendedInfo(int32_t opaqueIdentifier, + const std::vector& opaqueValue) override; + ndk::ScopedAStatus setIntParameter(evs::CameraParam id, int32_t value, + std::vector* effectiveValue) override; + ndk::ScopedAStatus setPrimaryClient() override; + ndk::ScopedAStatus unsetPrimaryClient() override; + + // Methods from EvsCameraBase follow. + void shutdown() override; + + const evs::CameraDesc& getDesc() { return mDescription; } + + static std::shared_ptr Create(const char* deviceName); + static std::shared_ptr Create( + const char* deviceName, std::unique_ptr& camInfo, + const evs::Stream* streamCfg = nullptr); + + private: + // For the camera parameters. + struct CameraParameterDesc { + CameraParameterDesc(int min = 0, int max = 0, int step = 0, int value = 0) { + this->range.min = min; + this->range.max = max; + this->range.step = step; + this->value = value; + } + + ParameterRange range; + int32_t value; + }; + + bool initialize(); + + void generateFrames(); + + void renderOneFrame(); + + void initializeParameters(); + + void onCodecInputAvailable(const int32_t index); + + void onCodecOutputAvailable(const int32_t index, const AMediaCodecBufferInfo& info); + + ::android::status_t allocateOneFrame(buffer_handle_t* handle) override; + + bool startVideoStreamImpl_locked(const std::shared_ptr& receiver, + ndk::ScopedAStatus& status, + std::unique_lock& lck) override; + + bool stopVideoStreamImpl_locked(ndk::ScopedAStatus& status, + std::unique_lock& lck) override; + + bool postVideoStreamStop_locked(ndk::ScopedAStatus& status, + std::unique_lock& lck) override; + + // The properties of this camera. + CameraDesc mDescription = {}; + + std::thread mCaptureThread; + + // The callback used to deliver each frame + std::shared_ptr mStream; + + std::string mVideoFileName; + // Media decoder resources - Owned by mDecoderThead when thread is running. + int mVideoFd = 0; + + struct AMediaExtractorDeleter { + void operator()(AMediaExtractor* extractor) const { AMediaExtractor_delete(extractor); } + }; + struct AMediaCodecDeleter { + void operator()(AMediaCodec* codec) const { AMediaCodec_delete(codec); } + }; + + std::unique_ptr mVideoExtractor; + std::unique_ptr mVideoCodec; + + // Horizontal pixel count in the buffers + int32_t mWidth = 0; + // Vertical pixel count in the buffers + int32_t mHeight = 0; + // Values from android_pixel_format_t + uint32_t mFormat = 0; + // Values from from Gralloc.h + uint64_t mUsage = 0; + // Bytes per line in the buffers + uint32_t mStride = 0; + + // Camera parameters. + std::unordered_map> mParams; + + // Static camera module information + std::unique_ptr& mCameraInfo; + + // For the extended info + std::unordered_map> mExtInfo; +}; + +} // namespace aidl::android::hardware::automotive::evs::implementation diff --git a/automotive/evs/aidl/impl/default/include/GlWrapper.h b/automotive/evs/aidl/impl/default/include/GlWrapper.h index adb250c8e1296fb77ada83af434e6579d68ed9bb..7ff6104bb9883c88a16e07dd1c5ef95c9a011b0c 100644 --- a/automotive/evs/aidl/impl/default/include/GlWrapper.h +++ b/automotive/evs/aidl/impl/default/include/GlWrapper.h @@ -25,7 +25,7 @@ #include #include #include -#include +#include namespace aidl::android::hardware::automotive::evs::implementation { @@ -33,7 +33,6 @@ namespace automotivedisplay = ::aidl::android::frameworks::automotive::display; class GlWrapper { public: - GlWrapper() : mSurfaceHolder(::android::SurfaceHolderUniquePtr(nullptr, nullptr)) {} bool initialize(const std::shared_ptr& svc, uint64_t displayId); void shutdown(); @@ -53,9 +52,6 @@ class GlWrapper { unsigned getHeight() { return mHeight; }; private: - ::android::sp<::android::hardware::graphics::bufferqueue::V2_0::IGraphicBufferProducer> - mGfxBufferProducer; - EGLDisplay mDisplay; EGLSurface mSurface; EGLContext mContext; @@ -71,9 +67,6 @@ class GlWrapper { // Opaque handle for a native hardware buffer defined in // frameworks/native/opengl/include/EGL/eglplatform.h ANativeWindow* mWindow; - - // Pointer to a Surface wrapper. - ::android::SurfaceHolderUniquePtr mSurfaceHolder; }; } // namespace aidl::android::hardware::automotive::evs::implementation diff --git a/automotive/evs/aidl/impl/default/src/ConfigManager.cpp b/automotive/evs/aidl/impl/default/src/ConfigManager.cpp index da791ed0b9c44ba2f274d98eaed691ea5422dee2..ba4cdc0c160f693d1a9400748ef5429543345069 100644 --- a/automotive/evs/aidl/impl/default/src/ConfigManager.cpp +++ b/automotive/evs/aidl/impl/default/src/ConfigManager.cpp @@ -40,6 +40,18 @@ std::string_view ConfigManager::sConfigDefaultPath = std::string_view ConfigManager::sConfigOverridePath = "/vendor/etc/automotive/evs/evs_configuration_override.xml"; +ConfigManager::CameraInfo::DeviceType ConfigManager::CameraInfo::deviceTypeFromSV( + const std::string_view sv) { + using namespace std::string_view_literals; + static const std::unordered_map nameToType = { + {"mock"sv, DeviceType::MOCK}, + {"v4l2"sv, DeviceType::V4L2}, + {"video"sv, DeviceType::VIDEO}, + }; + const auto search = nameToType.find(sv); + return search == nameToType.end() ? DeviceType::UNKNOWN : search->second; +} + void ConfigManager::printElementNames(const XMLElement* rootElem, const std::string& prefix) const { const XMLElement* curElem = rootElem; @@ -128,6 +140,10 @@ bool ConfigManager::readCameraDeviceInfo(CameraInfo* aCamera, const XMLElement* return false; } + if (const auto typeAttr = aDeviceElem->FindAttribute("type")) { + aCamera->deviceType = CameraInfo::deviceTypeFromSV(typeAttr->Value()); + } + /* size information to allocate camera_metadata_t */ size_t totalEntries = 0; size_t totalDataSize = 0; diff --git a/automotive/evs/aidl/impl/default/src/EvsCamera.cpp b/automotive/evs/aidl/impl/default/src/EvsCamera.cpp new file mode 100644 index 0000000000000000000000000000000000000000..bc3bfdd367a471c5cc881b9770cb73701f0a3b83 --- /dev/null +++ b/automotive/evs/aidl/impl/default/src/EvsCamera.cpp @@ -0,0 +1,378 @@ +/* + * Copyright (C) 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "EvsCamera.h" + +#include +#include +#include +#include +#include +#include + +#include +#include + +namespace aidl::android::hardware::automotive::evs::implementation { + +// Arbitrary limit on number of graphics buffers allowed to be allocated +// Safeguards against unreasonable resource consumption and provides a testable limit +constexpr std::size_t kMaxBuffersInFlight = 100; + +// Minimum number of buffers to run a video stream +constexpr int kMinimumBuffersInFlight = 1; + +EvsCamera::~EvsCamera() { + shutdown(); +} + +ndk::ScopedAStatus EvsCamera::doneWithFrame(const std::vector& buffers) { + std::lock_guard lck(mMutex); + for (const auto& desc : buffers) { + returnBuffer_unsafe(desc.bufferId); + } + return ndk::ScopedAStatus::ok(); +} + +ndk::ScopedAStatus EvsCamera::importExternalBuffers(const std::vector& buffers, + int32_t* _aidl_return) { + if (buffers.empty()) { + LOG(DEBUG) << __func__ + << ": Ignoring a request to import external buffers with an empty list."; + return ndk::ScopedAStatus::ok(); + } + static auto& mapper = ::android::GraphicBufferMapper::get(); + std::lock_guard lck(mMutex); + std::size_t numBuffersToAdd = std::min(buffers.size(), kMaxBuffersInFlight - mAvailableFrames); + if (numBuffersToAdd == 0) { + LOG(WARNING) << __func__ << ": The number of buffers has hit the upper limit (" + << kMaxBuffersInFlight << "). Stop importing."; + return ndk::ScopedAStatus::ok(); + } else if (numBuffersToAdd < buffers.size()) { + LOG(WARNING) << "Exceeds the limit on the number of buffers. Only " << numBuffersToAdd + << " buffers will be imported. " << buffers.size() << " are asked."; + } + const size_t before = mAvailableFrames; + for (std::size_t idx = 0; idx < numBuffersToAdd; ++idx) { + auto& buffer = buffers[idx]; + const AHardwareBuffer_Desc* pDesc = + reinterpret_cast(&buffer.buffer.description); + + buffer_handle_t handleToImport = ::android::dupFromAidl(buffer.buffer.handle); + buffer_handle_t handleToStore = nullptr; + if (handleToImport == nullptr) { + LOG(WARNING) << "Failed to duplicate a memory handle. Ignoring a buffer " + << buffer.bufferId; + continue; + } + + ::android::status_t result = + mapper.importBuffer(handleToImport, pDesc->width, pDesc->height, pDesc->layers, + pDesc->format, pDesc->usage, pDesc->stride, &handleToStore); + if (result != ::android::NO_ERROR || handleToStore == nullptr || + !increaseAvailableFrames_unsafe(handleToStore)) { + LOG(WARNING) << "Failed to import a buffer " << buffer.bufferId; + } + } + *_aidl_return = mAvailableFrames - before; + return ndk::ScopedAStatus::ok(); +} + +ndk::ScopedAStatus EvsCamera::setMaxFramesInFlight(int32_t bufferCount) { + std::lock_guard lock(mMutex); + if (bufferCount < 1) { + LOG(ERROR) << "Ignoring setMaxFramesInFlight with less than one buffer requested."; + return ndk::ScopedAStatus::fromServiceSpecificError( + static_cast(EvsResult::INVALID_ARG)); + } + if (!setAvailableFrames_unsafe(bufferCount)) { + LOG(ERROR) << "Failed to adjust the maximum number of frames in flight."; + return ndk::ScopedAStatus::fromServiceSpecificError( + static_cast(EvsResult::BUFFER_NOT_AVAILABLE)); + } + return ndk::ScopedAStatus::ok(); +} + +void EvsCamera::freeOneFrame(const buffer_handle_t handle) { + static auto& alloc = ::android::GraphicBufferAllocator::get(); + alloc.free(handle); +} + +bool EvsCamera::preVideoStreamStart_locked(const std::shared_ptr& receiver, + ndk::ScopedAStatus& status, + std::unique_lock& /* lck */) { + if (!receiver) { + LOG(ERROR) << __func__ << ": Null receiver."; + status = ndk::ScopedAStatus::fromServiceSpecificError( + static_cast(EvsResult::INVALID_ARG)); + return false; + } + + // If we've been displaced by another owner of the camera, then we can't do anything else + if (mStreamState == StreamState::DEAD) { + LOG(ERROR) << __func__ << ": Ignoring when camera has been lost."; + status = ndk::ScopedAStatus::fromServiceSpecificError( + static_cast(EvsResult::OWNERSHIP_LOST)); + return false; + } + + if (mStreamState != StreamState::STOPPED) { + LOG(ERROR) << __func__ << ": Ignoring when a stream is already running."; + status = ndk::ScopedAStatus::fromServiceSpecificError( + static_cast(EvsResult::STREAM_ALREADY_RUNNING)); + return false; + } + + // If the client never indicated otherwise, configure ourselves for a single streaming buffer + if (mAvailableFrames < kMinimumBuffersInFlight && + !setAvailableFrames_unsafe(kMinimumBuffersInFlight)) { + LOG(ERROR) << __func__ << "Failed to because we could not get a graphics buffer."; + status = ndk::ScopedAStatus::fromServiceSpecificError( + static_cast(EvsResult::BUFFER_NOT_AVAILABLE)); + return false; + } + mStreamState = StreamState::RUNNING; + return true; +} + +bool EvsCamera::postVideoStreamStart_locked( + const std::shared_ptr& /* receiver */, + ndk::ScopedAStatus& /* status */, std::unique_lock& /* lck */) { + return true; +} + +bool EvsCamera::preVideoStreamStop_locked(ndk::ScopedAStatus& status, + std::unique_lock& /* lck */) { + if (mStreamState != StreamState::RUNNING) { + // Terminate the stop process because a stream is not running. + status = ndk::ScopedAStatus::ok(); + return false; + } + mStreamState = StreamState::STOPPING; + return true; +} + +bool EvsCamera::postVideoStreamStop_locked(ndk::ScopedAStatus& /* status */, + std::unique_lock& /* lck */) { + mStreamState = StreamState::STOPPED; + return true; +} + +ndk::ScopedAStatus EvsCamera::startVideoStream( + const std::shared_ptr& receiver) { + bool needShutdown = false; + auto status = ndk::ScopedAStatus::ok(); + { + std::unique_lock lck(mMutex); + if (!preVideoStreamStart_locked(receiver, status, lck)) { + return status; + } + + if ((!startVideoStreamImpl_locked(receiver, status, lck) || + !postVideoStreamStart_locked(receiver, status, lck)) && + !status.isOk()) { + needShutdown = true; + } + } + if (needShutdown) { + shutdown(); + } + return status; +} + +ndk::ScopedAStatus EvsCamera::stopVideoStream() { + bool needShutdown = false; + auto status = ndk::ScopedAStatus::ok(); + { + std::unique_lock lck(mMutex); + if ((!preVideoStreamStop_locked(status, lck) || !stopVideoStreamImpl_locked(status, lck) || + !postVideoStreamStop_locked(status, lck)) && + !status.isOk()) { + needShutdown = true; + } + } + if (needShutdown) { + shutdown(); + } + return status; +} + +ndk::ScopedAStatus EvsCamera::pauseVideoStream() { + return ndk::ScopedAStatus::fromServiceSpecificError(static_cast(EvsResult::NOT_SUPPORTED)); +} + +ndk::ScopedAStatus EvsCamera::resumeVideoStream() { + return ndk::ScopedAStatus::fromServiceSpecificError(static_cast(EvsResult::NOT_SUPPORTED)); +} + +bool EvsCamera::setAvailableFrames_unsafe(const std::size_t bufferCount) { + if (bufferCount < 1) { + LOG(ERROR) << "Ignoring request to set buffer count to zero."; + return false; + } + if (bufferCount > kMaxBuffersInFlight) { + LOG(ERROR) << "Rejecting buffer request in excess of internal limit"; + return false; + } + + if (bufferCount > mAvailableFrames) { + bool success = true; + const std::size_t numBufferBeforeAlloc = mAvailableFrames; + for (int numBufferToAllocate = bufferCount - mAvailableFrames; + success && numBufferToAllocate > 0; --numBufferToAllocate) { + buffer_handle_t handle = nullptr; + const auto result = allocateOneFrame(&handle); + if (result != ::android::NO_ERROR || !handle) { + LOG(ERROR) << __func__ << ": Failed to allocate a graphics buffer. Error " << result + << ", handle: " << handle; + success = false; + break; + } + success &= increaseAvailableFrames_unsafe(handle); + } + if (!success) { + // Rollback when failure. + for (int numBufferToRelease = mAvailableFrames - numBufferBeforeAlloc; + numBufferToRelease > 0; --numBufferToRelease) { + decreaseAvailableFrames_unsafe(); + } + return false; + } + } else { + for (int numBufferToRelease = mAvailableFrames - std::max(bufferCount, mFramesInUse); + numBufferToRelease > 0; --numBufferToRelease) { + decreaseAvailableFrames_unsafe(); + } + if (mAvailableFrames > bufferCount) { + // This shouldn't happen with a properly behaving client because the client + // should only make this call after returning sufficient outstanding buffers + // to allow a clean resize. + LOG(ERROR) << "Buffer queue shrink failed, asked: " << bufferCount + << ", actual: " << mAvailableFrames + << " -- too many buffers currently in use?"; + } + } + return true; +} + +void EvsCamera::shutdown() { + stopVideoStream(); + std::lock_guard lck(mMutex); + closeAllBuffers_unsafe(); + mStreamState = StreamState::DEAD; +} + +void EvsCamera::closeAllBuffers_unsafe() { + if (mFramesInUse > 0) { + LOG(WARNING) << __func__ << ": Closing while " << mFramesInUse + << " frame(s) are still in use."; + } + for (auto& buffer : mBuffers) { + freeOneFrame(buffer.handle); + buffer.handle = nullptr; + } + mBuffers.clear(); + mBufferPosToId.clear(); + mBufferIdToPos.clear(); +} + +std::pair EvsCamera::useBuffer_unsafe() { + if (mFramesInUse >= mAvailableFrames) { + DCHECK_EQ(mFramesInUse, mAvailableFrames); + return {kInvalidBufferID, nullptr}; + } + const std::size_t pos = mFramesInUse++; + auto& buffer = mBuffers[pos]; + DCHECK(!buffer.inUse); + DCHECK(buffer.handle); + buffer.inUse = true; + return {mBufferPosToId[pos], buffer.handle}; +} + +void EvsCamera::returnBuffer_unsafe(const std::size_t id) { + if (id >= mBuffers.size()) { + LOG(ERROR) << __func__ << ": ID out-of-bound. id: " << id + << " max: " << mBuffers.size() - 1; + return; + } + const std::size_t pos = mBufferIdToPos[id]; + + if (!mBuffers[pos].inUse) { + LOG(ERROR) << __func__ << ": Ignoring returning frame " << id << " which is already free."; + return; + } + DCHECK_LT(pos, mFramesInUse); + const std::size_t last_in_use_pos = --mFramesInUse; + swapBufferFrames_unsafe(pos, last_in_use_pos); + mBuffers[last_in_use_pos].inUse = false; +} + +bool EvsCamera::increaseAvailableFrames_unsafe(const buffer_handle_t handle) { + if (mAvailableFrames >= kMaxBuffersInFlight) { + LOG(WARNING) << __func__ << ": The number of buffers has hit the upper limit (" + << kMaxBuffersInFlight << "). Stop increasing."; + return false; + } + const std::size_t pos = mAvailableFrames++; + if (mAvailableFrames > mBuffers.size()) { + const std::size_t oldBufferSize = mBuffers.size(); + mBuffers.resize(mAvailableFrames); + mBufferPosToId.resize(mAvailableFrames); + mBufferIdToPos.resize(mAvailableFrames); + // Build position/ID mapping. + for (std::size_t idx = oldBufferSize; idx < mBuffers.size(); ++idx) { + mBufferPosToId[idx] = idx; + mBufferIdToPos[idx] = idx; + } + } + auto& buffer = mBuffers[pos]; + DCHECK(!buffer.inUse); + DCHECK(!buffer.handle); + buffer.handle = handle; + return true; +} + +bool EvsCamera::decreaseAvailableFrames_unsafe() { + if (mFramesInUse >= mAvailableFrames) { + DCHECK_EQ(mFramesInUse, mAvailableFrames); + return false; + } + const std::size_t pos = --mAvailableFrames; + auto& buffer = mBuffers[pos]; + DCHECK(!buffer.inUse); + DCHECK(buffer.handle); + freeOneFrame(buffer.handle); + buffer.handle = nullptr; + return true; +} + +void EvsCamera::swapBufferFrames_unsafe(const std::size_t pos1, const std::size_t pos2) { + if (pos1 == pos2) { + return; + } + if (pos1 >= mBuffers.size() || pos2 >= mBuffers.size()) { + LOG(ERROR) << __func__ << ": Index out-of-bound. pos1: " << pos1 << ", pos2: " << pos2 + << ", buffer size: " << mBuffers.size(); + return; + } + const std::size_t id1 = mBufferPosToId[pos1]; + const std::size_t id2 = mBufferPosToId[pos2]; + std::swap(mBufferPosToId[pos1], mBufferPosToId[pos2]); + std::swap(mBufferIdToPos[id1], mBufferIdToPos[id2]); + std::swap(mBuffers[pos1], mBuffers[pos2]); +} + +} // namespace aidl::android::hardware::automotive::evs::implementation diff --git a/automotive/evs/aidl/impl/default/src/EvsEnumerator.cpp b/automotive/evs/aidl/impl/default/src/EvsEnumerator.cpp index 517895867597f7f0e27f0c41d1a3412b6278bdaa..80e72a73b500987fa21e17b6150bf1609a9ded68 100644 --- a/automotive/evs/aidl/impl/default/src/EvsEnumerator.cpp +++ b/automotive/evs/aidl/impl/default/src/EvsEnumerator.cpp @@ -17,8 +17,9 @@ #include "EvsEnumerator.h" #include "ConfigManager.h" +#include "EvsAllCameras.h" +#include "EvsCameraBase.h" #include "EvsGlDisplay.h" -#include "EvsMockCamera.h" #include #include @@ -243,7 +244,7 @@ ScopedAStatus EvsEnumerator::openCamera(const std::string& id, const Stream& cfg } // Has this camera already been instantiated by another caller? - std::shared_ptr pActiveCamera = pRecord->activeInstance.lock(); + std::shared_ptr pActiveCamera = pRecord->activeInstance.lock(); if (pActiveCamera) { LOG(WARNING) << "Killing previous camera because of new caller"; closeCamera(pActiveCamera); @@ -253,12 +254,31 @@ ScopedAStatus EvsEnumerator::openCamera(const std::string& id, const Stream& cfg if (!sConfigManager) { pActiveCamera = EvsMockCamera::Create(id.data()); } else { - pActiveCamera = EvsMockCamera::Create(id.data(), sConfigManager->getCameraInfo(id), &cfg); + auto& cameraInfo = sConfigManager->getCameraInfo(id); + switch (cameraInfo->deviceType) { + using DeviceType = ConfigManager::CameraInfo::DeviceType; + + // Default to MOCK for backward compatibility. + case DeviceType::NONE: + case DeviceType::MOCK: + pActiveCamera = EvsMockCamera::Create(id.data(), cameraInfo, &cfg); + break; + + case DeviceType::VIDEO: + pActiveCamera = EvsVideoEmulatedCamera::Create(id.data(), cameraInfo, &cfg); + break; + + default: + LOG(ERROR) << __func__ << ": camera device type " + << static_cast(cameraInfo->deviceType) + << " is not supported."; + break; + } } pRecord->activeInstance = pActiveCamera; if (!pActiveCamera) { - LOG(ERROR) << "Failed to create new EvsMockCamera object for " << id; + LOG(ERROR) << "Failed to create new EVS camera object for " << id; return ScopedAStatus::fromServiceSpecificError( static_cast(EvsResult::UNDERLYING_SERVICE_ERROR)); } @@ -445,7 +465,7 @@ void EvsEnumerator::closeCamera_impl(const std::shared_ptr& pCamera, if (!pRecord) { LOG(ERROR) << "Asked to close a camera whose name isn't recognized"; } else { - std::shared_ptr pActiveCamera = pRecord->activeInstance.lock(); + std::shared_ptr pActiveCamera = pRecord->activeInstance.lock(); if (!pActiveCamera) { LOG(WARNING) << "Somehow a camera is being destroyed " << "when the enumerator didn't know one existed"; diff --git a/automotive/evs/aidl/impl/default/src/EvsGlDisplay.cpp b/automotive/evs/aidl/impl/default/src/EvsGlDisplay.cpp index e5f8e4c84aa6fa849e1fc307a85f620a11eb9c34..5b5cbcc9aeb94bf7baab59541c05ed2250a5498c 100644 --- a/automotive/evs/aidl/impl/default/src/EvsGlDisplay.cpp +++ b/automotive/evs/aidl/impl/default/src/EvsGlDisplay.cpp @@ -352,8 +352,8 @@ ScopedAStatus EvsGlDisplay::getTargetBuffer(BufferDesc* _aidl_return) { BufferDesc bufferDescToSend = { .buffer = { - .handle = std::move(::android::dupToAidl(mBuffer.handle)), .description = mBuffer.description, + .handle = std::move(::android::dupToAidl(mBuffer.handle)), }, .pixelSizeBytes = 4, // RGBA_8888 is 4-byte-per-pixel format .bufferId = mBuffer.fingerprint, diff --git a/automotive/evs/aidl/impl/default/src/EvsMockCamera.cpp b/automotive/evs/aidl/impl/default/src/EvsMockCamera.cpp index 797b22154b7e5da76cde2a1a1f75dc850cc696cc..ef4392532176e98f800b09e68df873f2efad7d00 100644 --- a/automotive/evs/aidl/impl/default/src/EvsMockCamera.cpp +++ b/automotive/evs/aidl/impl/default/src/EvsMockCamera.cpp @@ -15,28 +15,25 @@ */ #include "EvsMockCamera.h" -#include "ConfigManager.h" -#include "EvsEnumerator.h" + +#include #include +#include #include #include #include +#include +#include #include +#include namespace { using ::aidl::android::hardware::graphics::common::BufferUsage; using ::ndk::ScopedAStatus; -// Arbitrary limit on number of graphics buffers allowed to be allocated -// Safeguards against unreasonable resource consumption and provides a testable limit -constexpr unsigned kMaxBuffersInFlight = 100; - -// Minimum number of buffers to run a video stream -constexpr int kMinimumBuffersInFlight = 1; - // Colors for the colorbar test pattern in ABGR format constexpr uint32_t kColors[] = { 0xFFFFFFFF, // white @@ -56,7 +53,7 @@ namespace aidl::android::hardware::automotive::evs::implementation { EvsMockCamera::EvsMockCamera([[maybe_unused]] Sigil sigil, const char* id, std::unique_ptr& camInfo) - : mFramesAllowed(0), mFramesInUse(0), mStreamState(STOPPED), mCameraInfo(camInfo) { + : mCameraInfo(camInfo) { LOG(DEBUG) << __FUNCTION__; /* set a camera id */ @@ -73,11 +70,6 @@ EvsMockCamera::EvsMockCamera([[maybe_unused]] Sigil sigil, const char* id, initializeParameters(); } -EvsMockCamera::~EvsMockCamera() { - LOG(DEBUG) << __FUNCTION__; - shutdown(); -} - void EvsMockCamera::initializeParameters() { mParams.emplace( CameraParam::BRIGHTNESS, @@ -90,35 +82,6 @@ void EvsMockCamera::initializeParameters() { new CameraParameterDesc(/* min= */ 0, /* max= */ 255, /* step= */ 1, /* value= */ 255)); } -// This gets called if another caller "steals" ownership of the camera -void EvsMockCamera::shutdown() { - LOG(DEBUG) << __FUNCTION__; - - // Make sure our output stream is cleaned up - // (It really should be already) - stopVideoStream_impl(); - - // Claim the lock while we work on internal state - std::lock_guard lock(mAccessLock); - - // Drop all the graphics buffers we've been using - if (mBuffers.size() > 0) { - ::android::GraphicBufferAllocator& alloc(::android::GraphicBufferAllocator::get()); - for (auto&& rec : mBuffers) { - if (rec.inUse) { - LOG(WARNING) << "WARNING: releasing a buffer remotely owned."; - } - alloc.free(rec.handle); - rec.handle = nullptr; - } - mBuffers.clear(); - } - - // Put this object into an unrecoverable error state since somebody else - // is going to own the underlying camera now - mStreamState = DEAD; -} - // Methods from ::aidl::android::hardware::automotive::evs::IEvsCamera follow. ScopedAStatus EvsMockCamera::getCameraInfo(CameraDesc* _aidl_return) { LOG(DEBUG) << __FUNCTION__; @@ -128,115 +91,6 @@ ScopedAStatus EvsMockCamera::getCameraInfo(CameraDesc* _aidl_return) { return ScopedAStatus::ok(); } -ScopedAStatus EvsMockCamera::setMaxFramesInFlight(int32_t bufferCount) { - LOG(DEBUG) << __FUNCTION__ << ", bufferCount = " << bufferCount; - ; - - std::lock_guard lock(mAccessLock); - - // If we've been displaced by another owner of the camera, then we can't do anything else - if (mStreamState == DEAD) { - LOG(ERROR) << "Ignoring setMaxFramesInFlight call when camera has been lost."; - return ScopedAStatus::fromServiceSpecificError(static_cast(EvsResult::OWNERSHIP_LOST)); - } - - // We cannot function without at least one video buffer to send data - if (bufferCount < 1) { - LOG(ERROR) << "Ignoring setMaxFramesInFlight with less than one buffer requested."; - return ScopedAStatus::fromServiceSpecificError(static_cast(EvsResult::INVALID_ARG)); - } - - // Update our internal state - if (!setAvailableFrames_Locked(bufferCount)) { - LOG(ERROR) << "Failed to adjust the maximum number of frames in flight."; - return ScopedAStatus::fromServiceSpecificError( - static_cast(EvsResult::BUFFER_NOT_AVAILABLE)); - } - - return ScopedAStatus::ok(); -} - -ScopedAStatus EvsMockCamera::startVideoStream(const std::shared_ptr& cb) { - LOG(DEBUG) << __FUNCTION__; - - if (!cb) { - LOG(ERROR) << "A given stream callback is invalid."; - return ScopedAStatus::fromServiceSpecificError(static_cast(EvsResult::INVALID_ARG)); - } - - std::lock_guard lock(mAccessLock); - - // If we've been displaced by another owner of the camera, then we can't do anything else - if (mStreamState == DEAD) { - LOG(ERROR) << "Ignoring startVideoStream call when camera has been lost."; - return ScopedAStatus::fromServiceSpecificError(static_cast(EvsResult::OWNERSHIP_LOST)); - } - - if (mStreamState != STOPPED) { - LOG(ERROR) << "Ignoring startVideoStream call when a stream is already running."; - return ScopedAStatus::fromServiceSpecificError( - static_cast(EvsResult::STREAM_ALREADY_RUNNING)); - } - - // If the client never indicated otherwise, configure ourselves for a single streaming buffer - if (mFramesAllowed < kMinimumBuffersInFlight && - !setAvailableFrames_Locked(kMinimumBuffersInFlight)) { - LOG(ERROR) << "Failed to start stream because we couldn't get a graphics buffer"; - return ScopedAStatus::fromServiceSpecificError( - static_cast(EvsResult::BUFFER_NOT_AVAILABLE)); - } - - // Record the user's callback for use when we have a frame ready - mStream = cb; - - // Start the frame generation thread - mStreamState = RUNNING; - mCaptureThread = std::thread([this]() { generateFrames(); }); - - return ScopedAStatus::ok(); -} - -ScopedAStatus EvsMockCamera::doneWithFrame(const std::vector& list) { - std::lock_guard lock(mAccessLock); - for (const auto& desc : list) { - returnBufferLocked(desc.bufferId); - } - - return ScopedAStatus::ok(); -} - -ScopedAStatus EvsMockCamera::stopVideoStream() { - LOG(DEBUG) << __FUNCTION__; - return stopVideoStream_impl(); -} - -ScopedAStatus EvsMockCamera::stopVideoStream_impl() { - std::unique_lock lock(mAccessLock); - - if (mStreamState != RUNNING) { - // Safely return here because a stream is not running. - return ScopedAStatus::ok(); - } - - // Tell the GenerateFrames loop we want it to stop - mStreamState = STOPPING; - - // Block outside the mutex until the "stop" flag has been acknowledged - // We won't send any more frames, but the client might still get some already in flight - LOG(DEBUG) << "Waiting for stream thread to end..."; - lock.unlock(); - if (mCaptureThread.joinable()) { - mCaptureThread.join(); - } - lock.lock(); - - mStreamState = STOPPED; - mStream = nullptr; - LOG(DEBUG) << "Stream marked STOPPED."; - - return ScopedAStatus::ok(); -} - ScopedAStatus EvsMockCamera::getExtendedInfo(int32_t opaqueIdentifier, std::vector* opaqueValue) { const auto it = mExtInfo.find(opaqueIdentifier); @@ -264,14 +118,6 @@ ScopedAStatus EvsMockCamera::getPhysicalCameraInfo([[maybe_unused]] const std::s return ScopedAStatus::ok(); } -ScopedAStatus EvsMockCamera::pauseVideoStream() { - return ScopedAStatus::fromServiceSpecificError(static_cast(EvsResult::NOT_SUPPORTED)); -} - -ScopedAStatus EvsMockCamera::resumeVideoStream() { - return ScopedAStatus::fromServiceSpecificError(static_cast(EvsResult::NOT_SUPPORTED)); -} - ScopedAStatus EvsMockCamera::setPrimaryClient() { /* Because EVS HW module reference implementation expects a single client at * a time, this returns a success code always. @@ -346,232 +192,27 @@ ScopedAStatus EvsMockCamera::getIntParameter(CameraParam id, std::vector& buffers, - int32_t* _aidl_return) { - size_t numBuffersToAdd = buffers.size(); - if (numBuffersToAdd < 1) { - LOG(DEBUG) << "Ignoring a request to import external buffers with an empty list."; - return ScopedAStatus::ok(); - } - - std::lock_guard lock(mAccessLock); - if (numBuffersToAdd > (kMaxBuffersInFlight - mFramesAllowed)) { - numBuffersToAdd -= (kMaxBuffersInFlight - mFramesAllowed); - LOG(WARNING) << "Exceed the limit on the number of buffers. " << numBuffersToAdd - << " buffers will be imported only."; - } - - ::android::GraphicBufferMapper& mapper = ::android::GraphicBufferMapper::get(); - const size_t before = mFramesAllowed; - for (size_t i = 0; i < numBuffersToAdd; ++i) { - auto& b = buffers[i]; - const AHardwareBuffer_Desc* pDesc = - reinterpret_cast(&b.buffer.description); - - buffer_handle_t handleToImport = ::android::dupFromAidl(b.buffer.handle); - buffer_handle_t handleToStore = nullptr; - if (handleToImport == nullptr) { - LOG(WARNING) << "Failed to duplicate a memory handle. Ignoring a buffer " << b.bufferId; - continue; - } - - ::android::status_t result = - mapper.importBuffer(handleToImport, pDesc->width, pDesc->height, pDesc->layers, - pDesc->format, pDesc->usage, pDesc->stride, &handleToStore); - if (result != ::android::NO_ERROR || handleToStore == nullptr) { - LOG(WARNING) << "Failed to import a buffer " << b.bufferId; - continue; - } - - bool stored = false; - for (auto&& rec : mBuffers) { - if (rec.handle != nullptr) { - continue; - } - - // Use this existing entry. - rec.handle = handleToStore; - rec.inUse = false; - stored = true; - break; - } - - if (!stored) { - // Add a BufferRecord wrapping this handle to our set of available buffers. - mBuffers.push_back(BufferRecord(handleToStore)); - } - ++mFramesAllowed; - } - - *_aidl_return = mFramesAllowed - before; - return ScopedAStatus::ok(); -} - -bool EvsMockCamera::setAvailableFrames_Locked(unsigned bufferCount) { - if (bufferCount < 1) { - LOG(ERROR) << "Ignoring request to set buffer count to zero"; - return false; - } - if (bufferCount > kMaxBuffersInFlight) { - LOG(ERROR) << "Rejecting buffer request in excess of internal limit"; - return false; - } - - // Is an increase required? - if (mFramesAllowed < bufferCount) { - // An increase is required - auto needed = bufferCount - mFramesAllowed; - LOG(INFO) << "Allocating " << needed << " buffers for camera frames"; - - auto added = increaseAvailableFrames_Locked(needed); - if (added != needed) { - // If we didn't add all the frames we needed, then roll back to the previous state - LOG(ERROR) << "Rolling back to previous frame queue size"; - decreaseAvailableFrames_Locked(added); - return false; - } - } else if (mFramesAllowed > bufferCount) { - // A decrease is required - auto framesToRelease = mFramesAllowed - bufferCount; - LOG(INFO) << "Returning " << framesToRelease << " camera frame buffers"; - - auto released = decreaseAvailableFrames_Locked(framesToRelease); - if (released != framesToRelease) { - // This shouldn't happen with a properly behaving client because the client - // should only make this call after returning sufficient outstanding buffers - // to allow a clean resize. - LOG(ERROR) << "Buffer queue shrink failed -- too many buffers currently in use?"; - } - } - - return true; -} - -unsigned EvsMockCamera::increaseAvailableFrames_Locked(unsigned numToAdd) { - // Acquire the graphics buffer allocator - ::android::GraphicBufferAllocator& alloc(::android::GraphicBufferAllocator::get()); - - unsigned added = 0; - while (added < numToAdd) { - unsigned pixelsPerLine = 0; - buffer_handle_t memHandle = nullptr; - auto result = alloc.allocate(mWidth, mHeight, mFormat, 1, mUsage, &memHandle, - &pixelsPerLine, 0, "EvsMockCamera"); - if (result != ::android::NO_ERROR) { - LOG(ERROR) << "Error " << result << " allocating " << mWidth << " x " << mHeight - << " graphics buffer"; - break; - } - if (memHandle == nullptr) { - LOG(ERROR) << "We didn't get a buffer handle back from the allocator"; - break; - } - if (mStride > 0) { - if (mStride != pixelsPerLine) { - LOG(ERROR) << "We did not expect to get buffers with different strides!"; - } - } else { - // Gralloc defines stride in terms of pixels per line - mStride = pixelsPerLine; - } - - // Find a place to store the new buffer - auto stored = false; - for (auto&& rec : mBuffers) { - if (rec.handle == nullptr) { - // Use this existing entry - rec.handle = memHandle; - rec.inUse = false; - stored = true; - break; - } - } - if (!stored) { - // Add a BufferRecord wrapping this handle to our set of available buffers - mBuffers.push_back(BufferRecord(memHandle)); - } - - ++mFramesAllowed; - ++added; - } - - return added; -} - -unsigned EvsMockCamera::decreaseAvailableFrames_Locked(unsigned numToRemove) { - // Acquire the graphics buffer allocator - ::android::GraphicBufferAllocator& alloc(::android::GraphicBufferAllocator::get()); - - unsigned removed = 0; - for (auto&& rec : mBuffers) { - // Is this record not in use, but holding a buffer that we can free? - if ((rec.inUse == false) && (rec.handle != nullptr)) { - // Release buffer and update the record so we can recognize it as "empty" - alloc.free(rec.handle); - rec.handle = nullptr; - - --mFramesAllowed; - ++removed; - - if (removed == numToRemove) { - break; - } - } - } - - return removed; -} - // This is the asynchronous frame generation thread that runs in parallel with the // main serving thread. There is one for each active camera instance. void EvsMockCamera::generateFrames() { LOG(DEBUG) << "Frame generation loop started."; - unsigned idx = 0; while (true) { - bool timeForFrame = false; const nsecs_t startTime = systemTime(SYSTEM_TIME_MONOTONIC); - - // Lock scope for updating shared state + std::size_t bufferId = kInvalidBufferID; + buffer_handle_t bufferHandle = nullptr; { - std::lock_guard lock(mAccessLock); - - if (mStreamState != RUNNING) { - // Break out of our main thread loop + std::lock_guard lock(mMutex); + if (mStreamState != StreamState::RUNNING) { break; } - - // Are we allowed to issue another buffer? - if (mFramesInUse >= mFramesAllowed) { - // Can't do anything right now -- skip this frame - LOG(WARNING) << "Skipped a frame because too many are in flight."; - } else { - // Identify an available buffer to fill - for (idx = 0; idx < mBuffers.size(); idx++) { - if (!mBuffers[idx].inUse) { - if (mBuffers[idx].handle != nullptr) { - // Found an available record, so stop looking - break; - } - } - } - if (idx >= mBuffers.size()) { - // This shouldn't happen since we already checked mFramesInUse vs mFramesAllowed - ALOGE("Failed to find an available buffer slot\n"); - } else { - // We're going to make the frame busy - mBuffers[idx].inUse = true; - mFramesInUse++; - timeForFrame = true; - } - } + std::tie(bufferId, bufferHandle) = useBuffer_unsafe(); } - if (timeForFrame) { + if (bufferHandle != nullptr) { using AidlPixelFormat = ::aidl::android::hardware::graphics::common::PixelFormat; // Assemble the buffer description we'll transmit below - buffer_handle_t memHandle = mBuffers[idx].handle; BufferDesc newBuffer = { .buffer = { @@ -584,39 +225,31 @@ void EvsMockCamera::generateFrames() { .usage = static_cast(mUsage), .stride = static_cast(mStride), }, - .handle = ::android::dupToAidl(memHandle), + .handle = ::android::dupToAidl(bufferHandle), }, - .bufferId = static_cast(idx), + .bufferId = static_cast(bufferId), .deviceId = mDescription.id, .timestamp = static_cast(::android::elapsedRealtimeNano() * 1e+3), // timestamps is in microseconds }; // Write test data into the image buffer - fillMockFrame(memHandle, reinterpret_cast( - &newBuffer.buffer.description)); + fillMockFrame(bufferHandle, reinterpret_cast( + &newBuffer.buffer.description)); - // Issue the (asynchronous) callback to the client -- can't be holding the lock - auto flag = false; - if (mStream) { - std::vector frames; - frames.push_back(std::move(newBuffer)); - flag = mStream->deliverFrame(frames).isOk(); - } + std::vector frames; + frames.push_back(std::move(newBuffer)); - if (flag) { - LOG(DEBUG) << "Delivered " << memHandle << ", id = " << mBuffers[idx].handle; + // Issue the (asynchronous) callback to the client -- can't be holding the lock + if (mStream && mStream->deliverFrame(frames).isOk()) { + LOG(DEBUG) << "Delivered " << bufferHandle << ", id = " << bufferId; } else { // This can happen if the client dies and is likely unrecoverable. // To avoid consuming resources generating failing calls, we stop sending // frames. Note, however, that the stream remains in the "STREAMING" state // until cleaned up on the main thread. LOG(ERROR) << "Frame delivery call failed in the transport layer."; - - // Since we didn't actually deliver it, mark the frame as available - std::lock_guard lock(mAccessLock); - mBuffers[idx].inUse = false; - mFramesInUse--; + doneWithFrame(frames); } } @@ -671,34 +304,45 @@ void EvsMockCamera::fillMockFrame(buffer_handle_t handle, const AHardwareBuffer_ mapper.unlock(handle); } -void EvsMockCamera::returnBufferLocked(const uint32_t bufferId) { - if (bufferId >= mBuffers.size()) { - ALOGE("ignoring doneWithFrame called with invalid bufferId %d (max is %zu)", bufferId, - mBuffers.size() - 1); - return; - } +::android::status_t EvsMockCamera::allocateOneFrame(buffer_handle_t* handle) { + static auto& alloc = ::android::GraphicBufferAllocator::get(); + unsigned pixelsPerLine = 0; + const auto result = alloc.allocate(mWidth, mHeight, mFormat, 1, mUsage, handle, &pixelsPerLine, + 0, "EvsMockCamera"); + if (mStride < mWidth) { + // Gralloc defines stride in terms of pixels per line + mStride = pixelsPerLine; + } else if (mStride != pixelsPerLine) { + LOG(ERROR) << "We did not expect to get buffers with different strides!"; + } + return result; +} - if (!mBuffers[bufferId].inUse) { - ALOGE("ignoring doneWithFrame called on frame %d which is already free", bufferId); - return; +bool EvsMockCamera::startVideoStreamImpl_locked( + const std::shared_ptr& receiver, ndk::ScopedAStatus& /* status */, + std::unique_lock& /* lck */) { + mStream = receiver; + mCaptureThread = std::thread([this]() { generateFrames(); }); + return true; +} + +bool EvsMockCamera::stopVideoStreamImpl_locked(ndk::ScopedAStatus& /* status */, + std::unique_lock& lck) { + lck.unlock(); + if (mCaptureThread.joinable()) { + mCaptureThread.join(); } + lck.lock(); + return true; +} - // Mark the frame as available - mBuffers[bufferId].inUse = false; - mFramesInUse--; - - // If this frame's index is high in the array, try to move it down - // to improve locality after mFramesAllowed has been reduced. - if (bufferId >= mFramesAllowed) { - // Find an empty slot lower in the array (which should always exist in this case) - for (auto&& rec : mBuffers) { - if (rec.handle == nullptr) { - rec.handle = mBuffers[bufferId].handle; - mBuffers[bufferId].handle = nullptr; - break; - } - } +bool EvsMockCamera::postVideoStreamStop_locked(ndk::ScopedAStatus& status, + std::unique_lock& lck) { + if (!Base::postVideoStreamStop_locked(status, lck)) { + return false; } + mStream = nullptr; + return true; } std::shared_ptr EvsMockCamera::Create(const char* deviceName) { diff --git a/automotive/evs/aidl/impl/default/src/EvsVideoEmulatedCamera.cpp b/automotive/evs/aidl/impl/default/src/EvsVideoEmulatedCamera.cpp new file mode 100644 index 0000000000000000000000000000000000000000..8181e4733e98e79f594416d4004baedd96fea9d4 --- /dev/null +++ b/automotive/evs/aidl/impl/default/src/EvsVideoEmulatedCamera.cpp @@ -0,0 +1,507 @@ +/* + * Copyright (C) 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "EvsVideoEmulatedCamera.h" + +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include +#include +#include + +namespace aidl::android::hardware::automotive::evs::implementation { + +namespace { +struct FormatDeleter { + void operator()(AMediaFormat* format) const { AMediaFormat_delete(format); } +}; +} // namespace + +EvsVideoEmulatedCamera::EvsVideoEmulatedCamera(Sigil, const char* deviceName, + std::unique_ptr& camInfo) + : mVideoFileName(deviceName), mCameraInfo(camInfo) { + mDescription.id = mVideoFileName; + + /* set camera metadata */ + if (camInfo) { + uint8_t* ptr = reinterpret_cast(camInfo->characteristics); + const size_t len = get_camera_metadata_size(camInfo->characteristics); + mDescription.metadata.insert(mDescription.metadata.end(), ptr, ptr + len); + } + + initializeParameters(); +} + +bool EvsVideoEmulatedCamera::initialize() { + // Open file. + mVideoFd = open(mVideoFileName.c_str(), 0, O_RDONLY); + if (mVideoFd < 0) { + PLOG(ERROR) << __func__ << ": Failed to open video file \"" << mVideoFileName << "\"."; + return false; + } + + // Initialize Media Extractor. + { + mVideoExtractor.reset(AMediaExtractor_new()); + off64_t filesize = lseek64(mVideoFd, 0, SEEK_END); + lseek(mVideoFd, 0, SEEK_SET); + const media_status_t status = + AMediaExtractor_setDataSourceFd(mVideoExtractor.get(), mVideoFd, 0, filesize); + if (status != AMEDIA_OK) { + LOG(ERROR) << __func__ + << ": Received error when initializing media extractor. Error code: " + << status << "."; + return false; + } + } + + // Initialize Media Codec and file format. + std::unique_ptr format; + const char* mime; + bool selected = false; + int numTracks = AMediaExtractor_getTrackCount(mVideoExtractor.get()); + for (int i = 0; i < numTracks; i++) { + format.reset(AMediaExtractor_getTrackFormat(mVideoExtractor.get(), i)); + if (!AMediaFormat_getString(format.get(), AMEDIAFORMAT_KEY_MIME, &mime)) { + LOG(ERROR) << __func__ << ": Error in fetching format string"; + continue; + } + if (!::android::base::StartsWith(mime, "video/")) { + continue; + } + const media_status_t status = AMediaExtractor_selectTrack(mVideoExtractor.get(), i); + if (status != AMEDIA_OK) { + LOG(ERROR) << __func__ + << ": Media extractor returned error to select track. Error Code: " << status + << "."; + return false; + } + selected = true; + break; + } + if (!selected) { + LOG(ERROR) << __func__ << ": No video track in video file \"" << mVideoFileName << "\"."; + return false; + } + + mVideoCodec.reset(AMediaCodec_createDecoderByType(mime)); + if (!mVideoCodec) { + LOG(ERROR) << __func__ << ": Unable to create decoder."; + return false; + } + + mDescription.vendorFlags = 0xFFFFFFFF; // Arbitrary test value + mUsage = GRALLOC_USAGE_HW_TEXTURE | GRALLOC_USAGE_HW_CAMERA_WRITE | + GRALLOC_USAGE_SW_READ_RARELY | GRALLOC_USAGE_SW_WRITE_RARELY; + mFormat = HAL_PIXEL_FORMAT_YCBCR_420_888; + AMediaFormat_setInt32(format.get(), AMEDIAFORMAT_KEY_COLOR_FORMAT, COLOR_FormatYUV420Flexible); + { + const media_status_t status = + AMediaCodec_configure(mVideoCodec.get(), format.get(), nullptr, nullptr, 0); + if (status != AMEDIA_OK) { + LOG(ERROR) << __func__ + << ": Received error in configuring mCodec. Error code: " << status << "."; + return false; + } + } + format.reset(AMediaCodec_getOutputFormat(mVideoCodec.get())); + AMediaFormat_getInt32(format.get(), AMEDIAFORMAT_KEY_WIDTH, &mWidth); + AMediaFormat_getInt32(format.get(), AMEDIAFORMAT_KEY_HEIGHT, &mHeight); + return true; +} + +void EvsVideoEmulatedCamera::generateFrames() { + while (true) { + { + std::lock_guard lock(mMutex); + if (mStreamState != StreamState::RUNNING) { + return; + } + } + renderOneFrame(); + } +} + +void EvsVideoEmulatedCamera::onCodecInputAvailable(const int32_t index) { + const size_t sampleSize = AMediaExtractor_getSampleSize(mVideoExtractor.get()); + const int64_t presentationTime = AMediaExtractor_getSampleTime(mVideoExtractor.get()); + size_t bufferSize = 0; + uint8_t* const codecInputBuffer = + AMediaCodec_getInputBuffer(mVideoCodec.get(), index, &bufferSize); + if (sampleSize > bufferSize) { + LOG(ERROR) << __func__ << ": Buffer is not large enough."; + } + if (presentationTime < 0) { + AMediaCodec_queueInputBuffer(mVideoCodec.get(), index, /* offset = */ 0, + /* size = */ 0, presentationTime, + AMEDIACODEC_BUFFER_FLAG_END_OF_STREAM); + LOG(INFO) << __func__ << ": Reaching the end of stream."; + return; + } + const size_t readSize = + AMediaExtractor_readSampleData(mVideoExtractor.get(), codecInputBuffer, sampleSize); + const media_status_t status = AMediaCodec_queueInputBuffer( + mVideoCodec.get(), index, /*offset = */ 0, readSize, presentationTime, /* flags = */ 0); + if (status != AMEDIA_OK) { + LOG(ERROR) << __func__ + << ": Received error in queueing input buffer. Error code: " << status; + } +} + +void EvsVideoEmulatedCamera::onCodecOutputAvailable(const int32_t index, + const AMediaCodecBufferInfo& info) { + using std::chrono::duration_cast; + using std::chrono::microseconds; + using std::chrono::nanoseconds; + using AidlPixelFormat = ::aidl::android::hardware::graphics::common::PixelFormat; + using ::aidl::android::hardware::graphics::common::BufferUsage; + + size_t decodedOutSize = 0; + uint8_t* const codecOutputBuffer = + AMediaCodec_getOutputBuffer(mVideoCodec.get(), index, &decodedOutSize) + info.offset; + + std::size_t renderBufferId = static_cast(-1); + buffer_handle_t renderBufferHandle = nullptr; + { + std::lock_guard lock(mMutex); + if (mStreamState != StreamState::RUNNING) { + return; + } + std::tie(renderBufferId, renderBufferHandle) = useBuffer_unsafe(); + } + if (!renderBufferHandle) { + LOG(ERROR) << __func__ << ": Camera failed to get an available render buffer."; + return; + } + std::vector renderBufferDescs; + renderBufferDescs.push_back({ + .buffer = + { + .description = + { + .width = static_cast(mWidth), + .height = static_cast(mHeight), + .layers = 1, + .format = static_cast(mFormat), + .usage = static_cast(mUsage), + .stride = static_cast(mStride), + }, + .handle = ::android::dupToAidl(renderBufferHandle), + }, + .bufferId = static_cast(renderBufferId), + .deviceId = mDescription.id, + .timestamp = duration_cast(nanoseconds(::android::elapsedRealtimeNano())) + .count(), + }); + + // Lock our output buffer for writing + uint8_t* pixels = nullptr; + int32_t bytesPerStride = 0; + auto& mapper = ::android::GraphicBufferMapper::get(); + mapper.lock(renderBufferHandle, GRALLOC_USAGE_SW_WRITE_OFTEN | GRALLOC_USAGE_SW_READ_NEVER, + ::android::Rect(mWidth, mHeight), (void**)&pixels, nullptr, &bytesPerStride); + + // If we failed to lock the pixel buffer, we're about to crash, but log it first + if (!pixels) { + LOG(ERROR) << __func__ << ": Camera failed to gain access to image buffer for writing"; + return; + } + + std::size_t ySize = mHeight * mStride; + std::size_t uvSize = ySize / 4; + + std::memcpy(pixels, codecOutputBuffer, ySize); + pixels += ySize; + + uint8_t* u_head = codecOutputBuffer + ySize; + uint8_t* v_head = u_head + uvSize; + + for (size_t i = 0; i < uvSize; ++i) { + *(pixels++) = *(u_head++); + *(pixels++) = *(v_head++); + } + + const auto status = + AMediaCodec_releaseOutputBuffer(mVideoCodec.get(), index, /* render = */ false); + if (status != AMEDIA_OK) { + LOG(ERROR) << __func__ + << ": Received error in releasing output buffer. Error code: " << status; + } + + // Release our output buffer + mapper.unlock(renderBufferHandle); + + // Issue the (asynchronous) callback to the client -- can't be holding the lock + if (mStream && mStream->deliverFrame(renderBufferDescs).isOk()) { + LOG(DEBUG) << __func__ << ": Delivered " << renderBufferHandle + << ", id = " << renderBufferId; + } else { + // This can happen if the client dies and is likely unrecoverable. + // To avoid consuming resources generating failing calls, we stop sending + // frames. Note, however, that the stream remains in the "STREAMING" state + // until cleaned up on the main thread. + LOG(ERROR) << __func__ << ": Frame delivery call failed in the transport layer."; + doneWithFrame(renderBufferDescs); + } +} + +void EvsVideoEmulatedCamera::renderOneFrame() { + using std::chrono::duration_cast; + using std::chrono::microseconds; + using namespace std::chrono_literals; + + // push to codec input + while (true) { + int codecInputBufferIdx = + AMediaCodec_dequeueInputBuffer(mVideoCodec.get(), /* timeoutUs = */ 0); + if (codecInputBufferIdx < 0) { + if (codecInputBufferIdx != AMEDIACODEC_INFO_TRY_AGAIN_LATER) { + LOG(ERROR) << __func__ + << ": Received error in AMediaCodec_dequeueInputBuffer. Error code: " + << codecInputBufferIdx; + } + break; + } + onCodecInputAvailable(codecInputBufferIdx); + AMediaExtractor_advance(mVideoExtractor.get()); + } + + // pop from codec output + + AMediaCodecBufferInfo info; + int codecOutputputBufferIdx = AMediaCodec_dequeueOutputBuffer( + mVideoCodec.get(), &info, /* timeoutUs = */ duration_cast(1ms).count()); + if (codecOutputputBufferIdx < 0) { + if (codecOutputputBufferIdx != AMEDIACODEC_INFO_TRY_AGAIN_LATER) { + LOG(ERROR) << __func__ + << ": Received error in AMediaCodec_dequeueOutputBuffer. Error code: " + << codecOutputputBufferIdx; + } + return; + } + onCodecOutputAvailable(codecOutputputBufferIdx, info); +} + +void EvsVideoEmulatedCamera::initializeParameters() { + mParams.emplace( + CameraParam::BRIGHTNESS, + new CameraParameterDesc(/* min= */ 0, /* max= */ 255, /* step= */ 1, /* value= */ 255)); + mParams.emplace( + CameraParam::CONTRAST, + new CameraParameterDesc(/* min= */ 0, /* max= */ 255, /* step= */ 1, /* value= */ 255)); + mParams.emplace( + CameraParam::SHARPNESS, + new CameraParameterDesc(/* min= */ 0, /* max= */ 255, /* step= */ 1, /* value= */ 255)); +} + +::android::status_t EvsVideoEmulatedCamera::allocateOneFrame(buffer_handle_t* handle) { + static auto& alloc = ::android::GraphicBufferAllocator::get(); + unsigned pixelsPerLine = 0; + const auto result = alloc.allocate(mWidth, mHeight, mFormat, 1, mUsage, handle, &pixelsPerLine, + 0, "EvsVideoEmulatedCamera"); + if (mStride == 0) { + // Gralloc defines stride in terms of pixels per line + mStride = pixelsPerLine; + } else if (mStride != pixelsPerLine) { + LOG(ERROR) << "We did not expect to get buffers with different strides!"; + } + return result; +} + +bool EvsVideoEmulatedCamera::startVideoStreamImpl_locked( + const std::shared_ptr& receiver, ndk::ScopedAStatus& /* status */, + std::unique_lock& /* lck */) { + mStream = receiver; + + const media_status_t status = AMediaCodec_start(mVideoCodec.get()); + if (status != AMEDIA_OK) { + LOG(ERROR) << __func__ << ": Received error in starting decoder. Error code: " << status + << "."; + return false; + } + mCaptureThread = std::thread([this]() { generateFrames(); }); + + return true; +} + +bool EvsVideoEmulatedCamera::stopVideoStreamImpl_locked(ndk::ScopedAStatus& /* status */, + std::unique_lock& lck) { + const media_status_t status = AMediaCodec_stop(mVideoCodec.get()); + lck.unlock(); + if (mCaptureThread.joinable()) { + mCaptureThread.join(); + } + lck.lock(); + return status == AMEDIA_OK; +} + +bool EvsVideoEmulatedCamera::postVideoStreamStop_locked(ndk::ScopedAStatus& status, + std::unique_lock& lck) { + if (!Base::postVideoStreamStop_locked(status, lck)) { + return false; + } + mStream = nullptr; + return true; +} + +ndk::ScopedAStatus EvsVideoEmulatedCamera::forcePrimaryClient( + const std::shared_ptr& /* display */) { + /* Because EVS HW module reference implementation expects a single client at + * a time, this returns a success code always. + */ + return ndk::ScopedAStatus::ok(); +} + +ndk::ScopedAStatus EvsVideoEmulatedCamera::getCameraInfo(evs::CameraDesc* _aidl_return) { + *_aidl_return = mDescription; + return ndk::ScopedAStatus::ok(); +} + +ndk::ScopedAStatus EvsVideoEmulatedCamera::getExtendedInfo(int32_t opaqueIdentifier, + std::vector* value) { + const auto it = mExtInfo.find(opaqueIdentifier); + if (it == mExtInfo.end()) { + return ndk::ScopedAStatus::fromServiceSpecificError( + static_cast(EvsResult::INVALID_ARG)); + } else { + *value = mExtInfo[opaqueIdentifier]; + } + return ndk::ScopedAStatus::ok(); +} + +ndk::ScopedAStatus EvsVideoEmulatedCamera::getIntParameter(evs::CameraParam id, + std::vector* value) { + const auto it = mParams.find(id); + if (it == mParams.end()) { + return ndk::ScopedAStatus::fromServiceSpecificError( + static_cast(EvsResult::NOT_SUPPORTED)); + } + value->push_back(it->second->value); + return ndk::ScopedAStatus::ok(); +} + +ndk::ScopedAStatus EvsVideoEmulatedCamera::getIntParameterRange(evs::CameraParam id, + evs::ParameterRange* _aidl_return) { + const auto it = mParams.find(id); + if (it == mParams.end()) { + return ndk::ScopedAStatus::fromServiceSpecificError( + static_cast(EvsResult::NOT_SUPPORTED)); + } + _aidl_return->min = it->second->range.min; + _aidl_return->max = it->second->range.max; + _aidl_return->step = it->second->range.step; + return ndk::ScopedAStatus::ok(); +} + +ndk::ScopedAStatus EvsVideoEmulatedCamera::getParameterList( + std::vector* _aidl_return) { + if (mCameraInfo) { + _aidl_return->resize(mCameraInfo->controls.size()); + std::size_t idx = 0; + for (const auto& [name, range] : mCameraInfo->controls) { + (*_aidl_return)[idx++] = name; + } + } + return ndk::ScopedAStatus::ok(); +} + +ndk::ScopedAStatus EvsVideoEmulatedCamera::getPhysicalCameraInfo(const std::string& /* deviceId */, + evs::CameraDesc* _aidl_return) { + return getCameraInfo(_aidl_return); +} + +ndk::ScopedAStatus EvsVideoEmulatedCamera::setExtendedInfo( + int32_t opaqueIdentifier, const std::vector& opaqueValue) { + mExtInfo.insert_or_assign(opaqueIdentifier, opaqueValue); + return ndk::ScopedAStatus::ok(); +} + +ndk::ScopedAStatus EvsVideoEmulatedCamera::setIntParameter(evs::CameraParam id, int32_t value, + std::vector* effectiveValue) { + const auto it = mParams.find(id); + if (it == mParams.end()) { + return ndk::ScopedAStatus::fromServiceSpecificError( + static_cast(EvsResult::NOT_SUPPORTED)); + } + // Rounding down to the closest value. + int32_t candidate = value / it->second->range.step * it->second->range.step; + if (candidate < it->second->range.min || candidate > it->second->range.max) { + return ndk::ScopedAStatus::fromServiceSpecificError( + static_cast(EvsResult::INVALID_ARG)); + } + it->second->value = candidate; + effectiveValue->push_back(candidate); + return ndk::ScopedAStatus::ok(); +} + +ndk::ScopedAStatus EvsVideoEmulatedCamera::setPrimaryClient() { + /* Because EVS HW module reference implementation expects a single client at + * a time, this returns a success code always. + */ + return ndk::ScopedAStatus::ok(); +} + +ndk::ScopedAStatus EvsVideoEmulatedCamera::unsetPrimaryClient() { + /* Because EVS HW module reference implementation expects a single client at + * a time, there is no chance that this is called by the secondary client and + * therefore returns a success code always. + */ + return ndk::ScopedAStatus::ok(); +} + +std::shared_ptr EvsVideoEmulatedCamera::Create(const char* deviceName) { + std::unique_ptr nullCamInfo = nullptr; + return Create(deviceName, nullCamInfo); +} + +std::shared_ptr EvsVideoEmulatedCamera::Create( + const char* deviceName, std::unique_ptr& camInfo, + const evs::Stream* /* streamCfg */) { + std::shared_ptr c = + ndk::SharedRefBase::make(Sigil{}, deviceName, camInfo); + if (!c) { + LOG(ERROR) << "Failed to instantiate EvsVideoEmulatedCamera."; + return nullptr; + } + if (!c->initialize()) { + LOG(ERROR) << "Failed to initialize EvsVideoEmulatedCamera."; + return nullptr; + } + return c; +} + +void EvsVideoEmulatedCamera::shutdown() { + mVideoCodec.reset(); + mVideoExtractor.reset(); + close(mVideoFd); + mVideoFd = 0; + Base::shutdown(); +} + +} // namespace aidl::android::hardware::automotive::evs::implementation diff --git a/automotive/evs/aidl/impl/default/src/GlWrapper.cpp b/automotive/evs/aidl/impl/default/src/GlWrapper.cpp index 0ee5ecb7346528193dd2e5e8b7e7a6b31d5677bb..a9d02138b25ef7987ac54a1eabd222fbb201a7f7 100644 --- a/automotive/evs/aidl/impl/default/src/GlWrapper.cpp +++ b/automotive/evs/aidl/impl/default/src/GlWrapper.cpp @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include @@ -183,20 +184,6 @@ GLuint buildShaderProgram(const char* vtxSrc, const char* pxlSrc) { return program; } -::android::sp convertNativeHandleToHGBP(const NativeHandle& aidlHandle) { - native_handle_t* handle = ::android::dupFromAidl(aidlHandle); - if (handle->numFds != 0 || handle->numInts < std::ceil(sizeof(size_t) / sizeof(int))) { - LOG(ERROR) << "Invalid native handle"; - return nullptr; - } - ::android::hardware::hidl_vec halToken; - halToken.setToExternal(reinterpret_cast(const_cast(&(handle->data[1]))), - handle->data[0]); - ::android::sp hgbp = - HGraphicBufferProducer::castFrom(::android::retrieveHalInterface(halToken)); - return std::move(hgbp); -} - } // namespace namespace aidl::android::hardware::automotive::evs::implementation { @@ -226,30 +213,19 @@ bool GlWrapper::initialize(const std::shared_ptr& pWindowProxy } LOG(INFO) << "Display resolution is " << mWidth << "x" << mHeight; - NativeHandle aidlHandle; - status = pWindowProxy->getHGraphicBufferProducer(displayId, &aidlHandle); + aidl::android::view::Surface shimSurface; + status = pWindowProxy->getSurface(displayId, &shimSurface); if (!status.isOk()) { - LOG(ERROR) << "Failed to get IGraphicBufferProducer from ICarDisplayProxy."; - return false; - } - - mGfxBufferProducer = convertNativeHandleToHGBP(aidlHandle); - if (!mGfxBufferProducer) { - LOG(ERROR) << "Failed to convert a NativeHandle to HGBP."; + LOG(ERROR) << "Failed to obtain the surface."; return false; } - mSurfaceHolder = getSurfaceFromHGBP(mGfxBufferProducer); - if (mSurfaceHolder == nullptr) { - LOG(ERROR) << "Failed to get a Surface from HGBP."; - return false; - } - - mWindow = getNativeWindow(mSurfaceHolder.get()); + mWindow = shimSurface.get(); if (mWindow == nullptr) { LOG(ERROR) << "Failed to get a native window from Surface."; return false; } + ANativeWindow_acquire(mWindow); // Set up our OpenGL ES context associated with the default display mDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY); @@ -350,7 +326,12 @@ void GlWrapper::shutdown() { mDisplay = EGL_NO_DISPLAY; // Release the window - mSurfaceHolder = nullptr; + if (mWindow == nullptr) { + return; + } + + ANativeWindow_release(mWindow); + mWindow = nullptr; } void GlWrapper::showWindow(const std::shared_ptr& pWindowProxy, uint64_t id) { diff --git a/automotive/evs/aidl/impl/default/tests/EvsCameraBufferTest.cpp b/automotive/evs/aidl/impl/default/tests/EvsCameraBufferTest.cpp new file mode 100644 index 0000000000000000000000000000000000000000..8b4676ea8a3743096bb969de66194dda2434ea45 --- /dev/null +++ b/automotive/evs/aidl/impl/default/tests/EvsCameraBufferTest.cpp @@ -0,0 +1,210 @@ +/* + * Copyright (C) 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "EvsCamera.h" + +#include +#include + +#include +#include +#include + +namespace aidl::android::hardware::automotive::evs::implementation { + +class EvsCameraForTest : public EvsCamera { + public: + using EvsCamera::increaseAvailableFrames_unsafe; + using EvsCamera::returnBuffer_unsafe; + using EvsCamera::useBuffer_unsafe; + + ~EvsCameraForTest() override { shutdown(); } + + ::android::status_t allocateOneFrame(buffer_handle_t* handle) override { + static std::intptr_t handle_cnt = 0; + *handle = reinterpret_cast(++handle_cnt); + return ::android::OK; + } + + void freeOneFrame(const buffer_handle_t /* handle */) override { + // Nothing to free because the handles are fake. + } + + void checkBufferOrder() { + for (std::size_t idx = 0; idx < mBuffers.size(); ++idx) { + const auto& buffer = mBuffers[idx]; + EXPECT_EQ(idx < mFramesInUse, buffer.inUse); + EXPECT_EQ(idx < mAvailableFrames, buffer.handle != nullptr); + EXPECT_LE(mFramesInUse, mAvailableFrames); + } + } + + MOCK_METHOD(::ndk::ScopedAStatus, forcePrimaryClient, + (const std::shared_ptr<::aidl::android::hardware::automotive::evs::IEvsDisplay>& + in_display), + (override)); + MOCK_METHOD(::ndk::ScopedAStatus, getCameraInfo, + (::aidl::android::hardware::automotive::evs::CameraDesc * _aidl_return), + (override)); + MOCK_METHOD(::ndk::ScopedAStatus, getExtendedInfo, + (int32_t in_opaqueIdentifier, std::vector* _aidl_return), (override)); + MOCK_METHOD(::ndk::ScopedAStatus, getIntParameter, + (::aidl::android::hardware::automotive::evs::CameraParam in_id, + std::vector* _aidl_return), + (override)); + MOCK_METHOD(::ndk::ScopedAStatus, getIntParameterRange, + (::aidl::android::hardware::automotive::evs::CameraParam in_id, + ::aidl::android::hardware::automotive::evs::ParameterRange* _aidl_return), + (override)); + MOCK_METHOD(::ndk::ScopedAStatus, getParameterList, + (std::vector<::aidl::android::hardware::automotive::evs::CameraParam> * + _aidl_return), + (override)); + MOCK_METHOD(::ndk::ScopedAStatus, getPhysicalCameraInfo, + (const std::string& in_deviceId, + ::aidl::android::hardware::automotive::evs::CameraDesc* _aidl_return), + (override)); + MOCK_METHOD(::ndk::ScopedAStatus, setExtendedInfo, + (int32_t in_opaqueIdentifier, const std::vector& in_opaqueValue), + (override)); + MOCK_METHOD(::ndk::ScopedAStatus, setIntParameter, + (::aidl::android::hardware::automotive::evs::CameraParam in_id, int32_t in_value, + std::vector* _aidl_return), + (override)); + MOCK_METHOD(::ndk::ScopedAStatus, setPrimaryClient, (), (override)); + MOCK_METHOD(::ndk::ScopedAStatus, unsetPrimaryClient, (), (override)); + MOCK_METHOD(bool, startVideoStreamImpl_locked, + (const std::shared_ptr& receiver, ndk::ScopedAStatus& status, + std::unique_lock& lck), + (override)); + MOCK_METHOD(bool, stopVideoStreamImpl_locked, + (ndk::ScopedAStatus & status, std::unique_lock& lck), (override)); +}; + +TEST(EvsCameraBufferTest, ChangeBufferPoolSize) { + auto evsCam = ndk::SharedRefBase::make(); + EXPECT_TRUE(evsCam->setMaxFramesInFlight(100).isOk()); + evsCam->checkBufferOrder(); + EXPECT_TRUE(evsCam->setMaxFramesInFlight(50).isOk()); + evsCam->checkBufferOrder(); + + // 2 buffers in use. + const auto [id1, handle1] = evsCam->useBuffer_unsafe(); + const auto [id2, handle2] = evsCam->useBuffer_unsafe(); + std::ignore = evsCam->useBuffer_unsafe(); + + // It allows you to set the buffer pool size to 1, but it will keep the space for the in use + // buffers. + EXPECT_TRUE(evsCam->setMaxFramesInFlight(1).isOk()); + evsCam->checkBufferOrder(); + + evsCam->returnBuffer_unsafe(id1); + evsCam->checkBufferOrder(); + evsCam->returnBuffer_unsafe(id2); + evsCam->checkBufferOrder(); +} + +TEST(EvsCameraBufferTest, UseAndReturn) { + constexpr std::size_t kNumOfHandles = 20; + auto evsCam = ndk::SharedRefBase::make(); + + // Our "fake handles" of this test case is 1 to kNumOfHandles. + for (std::size_t i = 1; i <= kNumOfHandles; ++i) { + evsCam->increaseAvailableFrames_unsafe(reinterpret_cast(i)); + } + evsCam->checkBufferOrder(); + + { + std::vector> inUseIDHandlePairs; + std::unordered_set inUseIDs; + std::unordered_set inUseHandles; + for (std::size_t i = 0; i < kNumOfHandles; ++i) { + const auto [id, handle] = evsCam->useBuffer_unsafe(); + const std::size_t handleInt = reinterpret_cast(handle); + EXPECT_TRUE(EvsCamera::IsBufferIDValid(id)); + EXPECT_NE(handle, nullptr); + EXPECT_LT(id, kNumOfHandles); + + // handleInt must be between [1, kNumOfHandles] as we "allocated" above. + EXPECT_LT(0u, handleInt); + EXPECT_LE(handleInt, kNumOfHandles); + + inUseIDHandlePairs.push_back({id, handleInt}); + EXPECT_TRUE(inUseIDs.insert(id).second); + EXPECT_TRUE(inUseHandles.insert(handleInt).second); + evsCam->checkBufferOrder(); + } + // Return buffers in the order of acquiring. + for (const auto [id, handleInt] : inUseIDHandlePairs) { + evsCam->returnBuffer_unsafe(id); + evsCam->checkBufferOrder(); + } + } + + { + std::vector> inUseIDHandlePairs; + std::unordered_set inUseIDs; + std::unordered_set inUseHandles; + for (std::size_t i = 0; i < kNumOfHandles; ++i) { + const auto [id, handle] = evsCam->useBuffer_unsafe(); + const std::size_t handleInt = reinterpret_cast(handle); + EXPECT_TRUE(EvsCamera::IsBufferIDValid(id)); + EXPECT_NE(handle, nullptr); + EXPECT_LT(id, kNumOfHandles); + + // handleInt must be between [1, kNumOfHandles] as we "allocated" above. + EXPECT_LT(0u, handleInt); + EXPECT_LE(handleInt, kNumOfHandles); + + inUseIDHandlePairs.push_back({id, handleInt}); + EXPECT_TRUE(inUseIDs.insert(id).second); + EXPECT_TRUE(inUseHandles.insert(handleInt).second); + evsCam->checkBufferOrder(); + } + // Return buffers in the reverse order of acquiring. + std::reverse(inUseIDHandlePairs.begin(), inUseIDHandlePairs.end()); + for (const auto [id, handleInt] : inUseIDHandlePairs) { + evsCam->returnBuffer_unsafe(id); + evsCam->checkBufferOrder(); + } + } + + { + // Making sure the handles are still in [1, kNumOfHandles] and IDs are still [0, + // kNumOfHandles). The mapping may be different, though. + std::vector> inUseIDHandlePairs; + std::unordered_set inUseIDs; + std::unordered_set inUseHandles; + for (std::size_t i = 0; i < kNumOfHandles; ++i) { + const auto [id, handle] = evsCam->useBuffer_unsafe(); + const std::size_t handleInt = reinterpret_cast(handle); + EXPECT_TRUE(EvsCamera::IsBufferIDValid(id)); + EXPECT_NE(handle, nullptr); + EXPECT_LT(id, kNumOfHandles); + + // handleInt must be between [1, kNumOfHandles] as we "allocated" above. + EXPECT_LT(0u, handleInt); + EXPECT_LE(handleInt, kNumOfHandles); + + inUseIDHandlePairs.push_back({id, handleInt}); + EXPECT_TRUE(inUseIDs.insert(id).second); + EXPECT_TRUE(inUseHandles.insert(handleInt).second); + evsCam->checkBufferOrder(); + } + } +} + +} // namespace aidl::android::hardware::automotive::evs::implementation diff --git a/automotive/evs/aidl/impl/default/tests/EvsCameraStateTest.cpp b/automotive/evs/aidl/impl/default/tests/EvsCameraStateTest.cpp new file mode 100644 index 0000000000000000000000000000000000000000..1925c793f7837648e36bbc81e66f9e10e0d982fb --- /dev/null +++ b/automotive/evs/aidl/impl/default/tests/EvsCameraStateTest.cpp @@ -0,0 +1,202 @@ +/* + * Copyright (C) 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "EvsCamera.h" + +#include +#include + +#include +#include +#include + +namespace aidl::android::hardware::automotive::evs::implementation { + +class EvsCameraForTest : public EvsCamera { + private: + using Base = EvsCamera; + + public: + using EvsCamera::mStreamState; + using EvsCamera::shutdown; + using EvsCamera::StreamState; + + ~EvsCameraForTest() override { shutdown(); } + + ::android::status_t allocateOneFrame(buffer_handle_t* handle) override { + static std::intptr_t handle_cnt = 0; + *handle = reinterpret_cast(++handle_cnt); + return ::android::OK; + } + + void freeOneFrame(const buffer_handle_t /* handle */) override { + // Nothing to free because the handles are fake. + } + + bool preVideoStreamStart_locked(const std::shared_ptr& receiver, + ndk::ScopedAStatus& status, + std::unique_lock& lck) override { + mPreStartCalled = true; + EXPECT_EQ(mStreamState, StreamState::STOPPED); + EXPECT_FALSE(mStreamStarted); + EXPECT_FALSE(mStreamStopped); + return Base::preVideoStreamStart_locked(receiver, status, lck); + } + + bool startVideoStreamImpl_locked(const std::shared_ptr& /* receiver */, + ndk::ScopedAStatus& /* status */, + std::unique_lock& /* lck */) override { + EXPECT_EQ(mStreamState, StreamState::RUNNING); + EXPECT_FALSE(mStreamStarted); + EXPECT_FALSE(mStreamStopped); + mStreamStarted = true; + return true; + } + + bool postVideoStreamStart_locked(const std::shared_ptr& receiver, + ndk::ScopedAStatus& status, + std::unique_lock& lck) override { + mPostStartCalled = true; + EXPECT_EQ(mStreamState, StreamState::RUNNING); + EXPECT_TRUE(mStreamStarted); + EXPECT_FALSE(mStreamStopped); + return Base::postVideoStreamStart_locked(receiver, status, lck); + } + + bool preVideoStreamStop_locked(ndk::ScopedAStatus& status, + std::unique_lock& lck) override { + // Skip the check if stop was called before. + if (!mPreStopCalled) { + mPreStopCalled = true; + EXPECT_EQ(mStreamState, StreamState::RUNNING); + EXPECT_TRUE(mStreamStarted); + EXPECT_FALSE(mStreamStopped); + } + return Base::preVideoStreamStop_locked(status, lck); + } + + bool stopVideoStreamImpl_locked(ndk::ScopedAStatus& /* status */, + std::unique_lock& /* lck */) override { + EXPECT_EQ(mStreamState, StreamState::STOPPING); + EXPECT_TRUE(mStreamStarted); + EXPECT_FALSE(mStreamStopped); + mStreamStopped = true; + return true; + } + + bool postVideoStreamStop_locked(ndk::ScopedAStatus& status, + std::unique_lock& lck) override { + mPostStopCalled = true; + const auto ret = Base::postVideoStreamStop_locked(status, lck); + EXPECT_EQ(mStreamState, StreamState::STOPPED); + EXPECT_TRUE(mStreamStarted); + EXPECT_TRUE(mStreamStopped); + return ret; + } + + MOCK_METHOD(::ndk::ScopedAStatus, forcePrimaryClient, + (const std::shared_ptr<::aidl::android::hardware::automotive::evs::IEvsDisplay>& + in_display), + (override)); + MOCK_METHOD(::ndk::ScopedAStatus, getCameraInfo, + (::aidl::android::hardware::automotive::evs::CameraDesc * _aidl_return), + (override)); + MOCK_METHOD(::ndk::ScopedAStatus, getExtendedInfo, + (int32_t in_opaqueIdentifier, std::vector* _aidl_return), (override)); + MOCK_METHOD(::ndk::ScopedAStatus, getIntParameter, + (::aidl::android::hardware::automotive::evs::CameraParam in_id, + std::vector* _aidl_return), + (override)); + MOCK_METHOD(::ndk::ScopedAStatus, getIntParameterRange, + (::aidl::android::hardware::automotive::evs::CameraParam in_id, + ::aidl::android::hardware::automotive::evs::ParameterRange* _aidl_return), + (override)); + MOCK_METHOD(::ndk::ScopedAStatus, getParameterList, + (std::vector<::aidl::android::hardware::automotive::evs::CameraParam> * + _aidl_return), + (override)); + MOCK_METHOD(::ndk::ScopedAStatus, getPhysicalCameraInfo, + (const std::string& in_deviceId, + ::aidl::android::hardware::automotive::evs::CameraDesc* _aidl_return), + (override)); + MOCK_METHOD(::ndk::ScopedAStatus, setExtendedInfo, + (int32_t in_opaqueIdentifier, const std::vector& in_opaqueValue), + (override)); + MOCK_METHOD(::ndk::ScopedAStatus, setIntParameter, + (::aidl::android::hardware::automotive::evs::CameraParam in_id, int32_t in_value, + std::vector* _aidl_return), + (override)); + MOCK_METHOD(::ndk::ScopedAStatus, setPrimaryClient, (), (override)); + MOCK_METHOD(::ndk::ScopedAStatus, unsetPrimaryClient, (), (override)); + + bool mStreamStarted = false; + bool mStreamStopped = false; + bool mPreStartCalled = false; + bool mPostStartCalled = false; + bool mPreStopCalled = false; + bool mPostStopCalled = false; +}; + +class MockEvsCameraStream : public evs::IEvsCameraStream { + MOCK_METHOD(::ndk::SpAIBinder, asBinder, (), (override)); + MOCK_METHOD(bool, isRemote, (), (override)); + MOCK_METHOD( + ::ndk::ScopedAStatus, deliverFrame, + (const std::vector<::aidl::android::hardware::automotive::evs::BufferDesc>& in_buffer), + (override)); + MOCK_METHOD(::ndk::ScopedAStatus, notify, + (const ::aidl::android::hardware::automotive::evs::EvsEventDesc& in_event), + (override)); + MOCK_METHOD(::ndk::ScopedAStatus, getInterfaceVersion, (int32_t * _aidl_return), (override)); + MOCK_METHOD(::ndk::ScopedAStatus, getInterfaceHash, (std::string * _aidl_return), (override)); +}; + +using StreamState = EvsCameraForTest::StreamState; + +TEST(EvsCameraStateTest, StateChangeHooks) { + auto evsCam = ndk::SharedRefBase::make(); + auto mockStream = ndk::SharedRefBase::make(); + EXPECT_FALSE(evsCam->mPreStartCalled); + EXPECT_FALSE(evsCam->mPostStartCalled); + EXPECT_FALSE(evsCam->mPreStopCalled); + EXPECT_FALSE(evsCam->mPostStopCalled); + EXPECT_FALSE(evsCam->mStreamStarted); + EXPECT_FALSE(evsCam->mStreamStopped); + EXPECT_EQ(evsCam->mStreamState, StreamState::STOPPED); + evsCam->startVideoStream(mockStream); + + EXPECT_TRUE(evsCam->mPreStartCalled); + EXPECT_TRUE(evsCam->mPostStartCalled); + EXPECT_FALSE(evsCam->mPreStopCalled); + EXPECT_FALSE(evsCam->mPostStopCalled); + EXPECT_TRUE(evsCam->mStreamStarted); + EXPECT_FALSE(evsCam->mStreamStopped); + EXPECT_EQ(evsCam->mStreamState, StreamState::RUNNING); + evsCam->stopVideoStream(); + + EXPECT_TRUE(evsCam->mPreStartCalled); + EXPECT_TRUE(evsCam->mPostStartCalled); + EXPECT_TRUE(evsCam->mPreStopCalled); + EXPECT_TRUE(evsCam->mPostStopCalled); + EXPECT_TRUE(evsCam->mStreamStarted); + EXPECT_TRUE(evsCam->mStreamStopped); + EXPECT_EQ(evsCam->mStreamState, StreamState::STOPPED); + + evsCam->shutdown(); + EXPECT_EQ(evsCam->mStreamState, StreamState::DEAD); +} + +} // namespace aidl::android::hardware::automotive::evs::implementation diff --git a/automotive/remoteaccess/Android.bp b/automotive/remoteaccess/Android.bp index 7cd6f60fe9a722a1a85393b7f9377480bffe94ca..e1e90414c6f1e25b4ecf14cbe189645ee1650da3 100644 --- a/automotive/remoteaccess/Android.bp +++ b/automotive/remoteaccess/Android.bp @@ -42,6 +42,5 @@ aidl_interface { imports: [], }, ], - frozen: true, - + frozen: false, } diff --git a/automotive/remoteaccess/aidl_api/android.hardware.automotive.remoteaccess/current/android/hardware/automotive/remoteaccess/IRemoteAccess.aidl b/automotive/remoteaccess/aidl_api/android.hardware.automotive.remoteaccess/current/android/hardware/automotive/remoteaccess/IRemoteAccess.aidl index b0935c2fb23bb4f708d125e39ee8020e927fab80..ccfa22de4ea9cecb5155dab7df153a11e849c112 100644 --- a/automotive/remoteaccess/aidl_api/android.hardware.automotive.remoteaccess/current/android/hardware/automotive/remoteaccess/IRemoteAccess.aidl +++ b/automotive/remoteaccess/aidl_api/android.hardware.automotive.remoteaccess/current/android/hardware/automotive/remoteaccess/IRemoteAccess.aidl @@ -40,4 +40,10 @@ interface IRemoteAccess { void setRemoteTaskCallback(android.hardware.automotive.remoteaccess.IRemoteTaskCallback callback); void clearRemoteTaskCallback(); void notifyApStateChange(in android.hardware.automotive.remoteaccess.ApState state); + boolean isTaskScheduleSupported(); + void scheduleTask(in android.hardware.automotive.remoteaccess.ScheduleInfo scheduleInfo); + void unscheduleTask(String clientId, String scheduleId); + void unscheduleAllTasks(String clientId); + boolean isTaskScheduled(String clientId, String scheduleId); + List getAllScheduledTasks(String clientId); } diff --git a/automotive/remoteaccess/aidl_api/android.hardware.automotive.remoteaccess/current/android/hardware/automotive/remoteaccess/ScheduleInfo.aidl b/automotive/remoteaccess/aidl_api/android.hardware.automotive.remoteaccess/current/android/hardware/automotive/remoteaccess/ScheduleInfo.aidl new file mode 100644 index 0000000000000000000000000000000000000000..a929e10827bab7fd44d83cbe06736ef281cae648 --- /dev/null +++ b/automotive/remoteaccess/aidl_api/android.hardware.automotive.remoteaccess/current/android/hardware/automotive/remoteaccess/ScheduleInfo.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/////////////////////////////////////////////////////////////////////////////// +// THIS 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 -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.automotive.remoteaccess; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable ScheduleInfo { + String clientId; + String scheduleId; + byte[] taskData; + int count; + long startTimeInEpochSeconds; + long periodicInSeconds; +} diff --git a/automotive/remoteaccess/android/hardware/automotive/remoteaccess/IRemoteAccess.aidl b/automotive/remoteaccess/android/hardware/automotive/remoteaccess/IRemoteAccess.aidl index 0f4125f4751ea4ff4aca6f71e244e129de98554c..4912651294c9535d752d2b669134f89a064615ef 100644 --- a/automotive/remoteaccess/android/hardware/automotive/remoteaccess/IRemoteAccess.aidl +++ b/automotive/remoteaccess/android/hardware/automotive/remoteaccess/IRemoteAccess.aidl @@ -18,6 +18,7 @@ package android.hardware.automotive.remoteaccess; import android.hardware.automotive.remoteaccess.ApState; import android.hardware.automotive.remoteaccess.IRemoteTaskCallback; +import android.hardware.automotive.remoteaccess.ScheduleInfo; /** * Interface representing a remote wakeup client. @@ -96,4 +97,69 @@ interface IRemoteAccess { *

If {@code isWakeupRequired} is false, it must not try to wake up AP. */ void notifyApStateChange(in ApState state); + + /** + * Returns whether task scheduling is supported. + * + *

If this returns {@code true}, user may use {@link scheduleTask} to schedule a task to be + * executed at a later time. If the device is off when the task is scheduled to be executed, + * the device will be woken up to execute the task. + * + * @return {@code true} if serverless remote task scheduling is supported. + */ + boolean isTaskScheduleSupported(); + + /** + * Schedules a task to be executed later even when the vehicle is off. + * + *

If {@link isTaskScheduleSupported} returns {@code false}. This is no-op. + * + *

This sends a scheduled task message to a device external to Android so that the device + * can wake up Android and deliver the task through {@link IRemoteTaskCallback}. + * + *

Note that the scheduled task execution is on a best-effort basis. Multiple situations + * might cause the task not to execute successfully: + * + *

    + *
  • The vehicle is low on battery and the other device decides not to wake up Android. + *
  • User turns off vehicle while the task is executing. + *
  • The task logic itself fails. + * + *

    Must return {@code EX_ILLEGAL_ARGUMENT} if a pending schedule with the same + * {@code scheduleId} for this client exists. + */ + void scheduleTask(in ScheduleInfo scheduleInfo); + + /** + * Unschedules a scheduled task. + * + *

    If {@link isTaskScheduleSupported} returns {@code false}. This is no-op. + * + *

    Does nothing if a pending schedule with {@code clientId} and {@code scheduleId} does not + * exist. + */ + void unscheduleTask(String clientId, String scheduleId); + + /** + * Unschedules all scheduled tasks for the client. + * + *

    If {@link isTaskScheduleSupported} returns {@code false}. This is no-op. + */ + void unscheduleAllTasks(String clientId); + + /** + * Returns whether the specified task is scheduled. + * + *

    If {@link isTaskScheduleSupported} returns {@code false}, This must return {@code false}. + */ + boolean isTaskScheduled(String clientId, String scheduleId); + + /** + * Gets all pending scheduled tasks for the client. + * + *

    If {@link isTaskScheduleSupported} returns {@code false}. This must return empty array. + * + *

    The finished scheduled tasks will not be included. + */ + List getAllScheduledTasks(String clientId); } diff --git a/automotive/remoteaccess/android/hardware/automotive/remoteaccess/ScheduleInfo.aidl b/automotive/remoteaccess/android/hardware/automotive/remoteaccess/ScheduleInfo.aidl new file mode 100644 index 0000000000000000000000000000000000000000..cf1437bf1b8592a0fd4e0332672cd8478dc147f1 --- /dev/null +++ b/automotive/remoteaccess/android/hardware/automotive/remoteaccess/ScheduleInfo.aidl @@ -0,0 +1,62 @@ +/* + * Copyright (C) 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.hardware.automotive.remoteaccess; + +@VintfStability +@JavaDerive(equals=true, toString=true) +parcelable ScheduleInfo { + /** + * The ID used to identify the client this schedule is for. This must be one of the + * preconfigured remote access serverless client ID defined in car service resource + * {@code R.xml.remote_access_serverless_client_map}. + */ + String clientId; + /** + * A unique scheduling ID (among the same client). Adding a new schedule info with a duplicate + * scheduleId will return {@code EX_ILLEGAL_ARGUMENT}. + */ + String scheduleId; + /** + * The opaque task data that will be sent back to the remote task client app when the task is + * executed. It is not interpreted/parsed by the Android system. + */ + byte[] taskData; + /** + * How many times this task will be executed. 0 means infinite. + * + *

    This must be >= 0. + */ + int count; + /** + * The start time in epoch seconds. + * + *

    The external device issuing remote task must have a clock synced with the + * {@code System.currentTimeMillis()} used in Android system. + * + *

    Optionally, the VHAL property {@code EPOCH_TIME} can be used to sync the time. + * + *

    This must be >= 0. + */ + long startTimeInEpochSeconds; + /** + * The interval (in seconds) between scheduled task execution. + * + *

    This must be >=0. This is not useful when {@code count} is 1. If this is 0, + * The tasks will be delivered multiple times with no interval in between. + */ + long periodicInSeconds; +} diff --git a/automotive/remoteaccess/hal/default/Android.bp b/automotive/remoteaccess/hal/default/Android.bp index 01556670eca74b7b3f1a2d5e77f0a6c9d117fbeb..97ed2c12f0749d1c18270358e074497d4a7f7d9d 100644 --- a/automotive/remoteaccess/hal/default/Android.bp +++ b/automotive/remoteaccess/hal/default/Android.bp @@ -48,17 +48,17 @@ cc_defaults { } cc_binary { - name: "android.hardware.automotive.remoteaccess@V1-default-service", + name: "android.hardware.automotive.remoteaccess@V2-default-service", defaults: ["remote-access-hal-defaults"], vintf_fragments: ["remoteaccess-default-service.xml"], init_rc: ["remoteaccess-default-service.rc"], cflags: [ - "-DGRPC_SERVICE_ADDRESS=\"localhost:50051\"", + "-DGRPC_SERVICE_ADDRESS=\"10.0.2.2:50051\"", ], } cc_binary { - name: "android.hardware.automotive.remoteaccess@V1-tcu-test-service", + name: "android.hardware.automotive.remoteaccess@V2-tcu-test-service", defaults: ["remote-access-hal-defaults"], vintf_fragments: ["remoteaccess-default-service.xml"], init_rc: ["remoteaccess-tcu-test-service.rc"], @@ -77,7 +77,7 @@ cc_library { "src/RemoteAccessService.cpp", ], whole_static_libs: [ - "android.hardware.automotive.remoteaccess-V1-ndk", + "android.hardware.automotive.remoteaccess-V2-ndk", "wakeup_client_protos", "libvhalclient", ], @@ -99,7 +99,7 @@ cc_library { } cc_fuzz { - name: "android.hardware.automotive.remoteaccess@V1-default-service.aidl_fuzzer", + name: "android.hardware.automotive.remoteaccess@V2-default-service.aidl_fuzzer", srcs: ["fuzzer/fuzzer.cpp"], whole_static_libs: [ "RemoteAccessService", diff --git a/automotive/remoteaccess/hal/default/fuzzer/fuzzer.cpp b/automotive/remoteaccess/hal/default/fuzzer/fuzzer.cpp index 292c80e7b634dcf671006336fa6aa3cb4d0f7270..9224ebcf09294aae5e855247ca13c26ed8ec6387 100644 --- a/automotive/remoteaccess/hal/default/fuzzer/fuzzer.cpp +++ b/automotive/remoteaccess/hal/default/fuzzer/fuzzer.cpp @@ -55,6 +55,31 @@ class MockGrpcClientStub : public WakeupClient::StubInterface { return Status::OK; } + Status ScheduleTask(ClientContext* context, const ScheduleTaskRequest& request, + ScheduleTaskResponse* response) { + return Status::OK; + } + + Status UnscheduleTask(ClientContext* context, const UnscheduleTaskRequest& request, + UnscheduleTaskResponse* response) { + return Status::OK; + } + + Status UnscheduleAllTasks(ClientContext* context, const UnscheduleAllTasksRequest& request, + UnscheduleAllTasksResponse* response) { + return Status::OK; + } + + Status IsTaskScheduled(ClientContext* context, const IsTaskScheduledRequest& request, + IsTaskScheduledResponse* response) { + return Status::OK; + } + + Status GetAllScheduledTasks(ClientContext* context, const GetAllScheduledTasksRequest& request, + GetAllScheduledTasksResponse* response) { + return Status::OK; + } + // Async methods which we do not care. ClientAsyncReaderInterface* AsyncGetRemoteTasksRaw( [[maybe_unused]] ClientContext* context, @@ -83,6 +108,76 @@ class MockGrpcClientStub : public WakeupClient::StubInterface { [[maybe_unused]] CompletionQueue* c) { return nullptr; } + + ClientAsyncResponseReaderInterface* AsyncScheduleTaskRaw( + [[maybe_unused]] ClientContext* context, + [[maybe_unused]] const ScheduleTaskRequest& request, + [[maybe_unused]] CompletionQueue* cq) { + return nullptr; + } + + ClientAsyncResponseReaderInterface* PrepareAsyncScheduleTaskRaw( + [[maybe_unused]] ClientContext* context, + [[maybe_unused]] const ScheduleTaskRequest& request, + [[maybe_unused]] CompletionQueue* c) { + return nullptr; + } + + ClientAsyncResponseReaderInterface* AsyncUnscheduleTaskRaw( + [[maybe_unused]] ClientContext* context, + [[maybe_unused]] const UnscheduleTaskRequest& request, + [[maybe_unused]] CompletionQueue* cq) { + return nullptr; + } + + ClientAsyncResponseReaderInterface* PrepareAsyncUnscheduleTaskRaw( + [[maybe_unused]] ClientContext* context, + [[maybe_unused]] const UnscheduleTaskRequest& request, + [[maybe_unused]] CompletionQueue* c) { + return nullptr; + } + + ClientAsyncResponseReaderInterface* AsyncUnscheduleAllTasksRaw( + [[maybe_unused]] ClientContext* context, + [[maybe_unused]] const UnscheduleAllTasksRequest& request, + [[maybe_unused]] CompletionQueue* cq) { + return nullptr; + } + + ClientAsyncResponseReaderInterface* + PrepareAsyncUnscheduleAllTasksRaw([[maybe_unused]] ClientContext* context, + [[maybe_unused]] const UnscheduleAllTasksRequest& request, + [[maybe_unused]] CompletionQueue* c) { + return nullptr; + } + + ClientAsyncResponseReaderInterface* AsyncIsTaskScheduledRaw( + [[maybe_unused]] ClientContext* context, + [[maybe_unused]] const IsTaskScheduledRequest& request, + [[maybe_unused]] CompletionQueue* cq) { + return nullptr; + } + + ClientAsyncResponseReaderInterface* PrepareAsyncIsTaskScheduledRaw( + [[maybe_unused]] ClientContext* context, + [[maybe_unused]] const IsTaskScheduledRequest& request, + [[maybe_unused]] CompletionQueue* c) { + return nullptr; + } + + ClientAsyncResponseReaderInterface* AsyncGetAllScheduledTasksRaw( + [[maybe_unused]] ClientContext* context, + [[maybe_unused]] const GetAllScheduledTasksRequest& request, + [[maybe_unused]] CompletionQueue* cq) { + return nullptr; + } + + ClientAsyncResponseReaderInterface* + PrepareAsyncGetAllScheduledTasksRaw([[maybe_unused]] ClientContext* context, + [[maybe_unused]] const GetAllScheduledTasksRequest& request, + [[maybe_unused]] CompletionQueue* c) { + return nullptr; + } }; } // namespace remoteaccess diff --git a/automotive/remoteaccess/hal/default/include/RemoteAccessService.h b/automotive/remoteaccess/hal/default/include/RemoteAccessService.h index b18986adace26606b80009d29d9dae6aa3d422b4..1fc4037ae255898072524566f034a17ba53acc7e 100644 --- a/automotive/remoteaccess/hal/default/include/RemoteAccessService.h +++ b/automotive/remoteaccess/hal/default/include/RemoteAccessService.h @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include @@ -78,6 +79,25 @@ class RemoteAccessService ndk::ScopedAStatus notifyApStateChange( const aidl::android::hardware::automotive::remoteaccess::ApState& newState) override; + ndk::ScopedAStatus isTaskScheduleSupported(bool* out) override; + + ndk::ScopedAStatus scheduleTask( + const aidl::android::hardware::automotive::remoteaccess::ScheduleInfo& scheduleInfo) + override; + + ndk::ScopedAStatus unscheduleTask(const std::string& clientId, + const std::string& scheduleId) override; + + ndk::ScopedAStatus unscheduleAllTasks(const std::string& clientId) override; + + ndk::ScopedAStatus isTaskScheduled(const std::string& clientId, const std::string& scheduleId, + bool* out) override; + + ndk::ScopedAStatus getAllScheduledTasks( + const std::string& clientId, + std::vector* out) + override; + binder_status_t dump(int fd, const char** args, uint32_t numArgs) override; private: diff --git a/automotive/remoteaccess/hal/default/proto/wakeup_client.proto b/automotive/remoteaccess/hal/default/proto/wakeup_client.proto index 4fe0d0177b516185ed97dcc75f8b132bcadbfb62..e061016daf4f8bd9c97b81f787ddc0d77870344a 100644 --- a/automotive/remoteaccess/hal/default/proto/wakeup_client.proto +++ b/automotive/remoteaccess/hal/default/proto/wakeup_client.proto @@ -18,6 +18,12 @@ syntax = "proto3"; package android.hardware.automotive.remoteaccess; +enum ErrorCode { + OK = 0; + UNSPECIFIED = 1; + INVALID_ARG = 2; +} + /** * Service provided by a wakeup client running on TCU. */ @@ -50,6 +56,50 @@ service WakeupClient { * to wake up AP. */ rpc NotifyWakeupRequired(NotifyWakeupRequiredRequest) returns (NotifyWakeupRequiredResponse) {} + + /** + * Schedules a task to be executed later even when the vehicle is off. + * + *

    This sends a scheduled task message to a device external to Android so that the device + * can wake up Android and deliver the task through {@link IRemoteTaskCallback}. + * + *

    Note that the scheduled task execution is on a best-effort basis. Multiple situations + * might cause the task not to execute successfully: + * + *

      + *
    • The vehicle is low on battery and the other device decides not to wake up Android. + *
    • User turns off vehicle while the task is executing. + *
    • The task logic itself fails. + * + *

      Must return a response with error code: {@code INVALID_ARG} if a pending schedule with the + * same {@code scheduleId} for this client exists. + */ + rpc ScheduleTask(ScheduleTaskRequest) returns (ScheduleTaskResponse) {} + + /** + * Unschedules a scheduled task. + * + *

      Does nothing if a pending schedule with {@code clientId} and {@code scheduleId} does not + * exist. + */ + rpc UnscheduleTask(UnscheduleTaskRequest) returns (UnscheduleTaskResponse) {} + + /** + * Unschedules all scheduled tasks for the client. + */ + rpc UnscheduleAllTasks(UnscheduleAllTasksRequest) returns (UnscheduleAllTasksResponse) {} + + /** + * Returns whether the specified task is scheduled. + */ + rpc IsTaskScheduled(IsTaskScheduledRequest) returns (IsTaskScheduledResponse) {} + + /** + * Gets all pending scheduled tasks for the client. + * + *

      The finished scheduled tasks will not be included. + */ + rpc GetAllScheduledTasks(GetAllScheduledTasksRequest) returns (GetAllScheduledTasksResponse) {} } message GetRemoteTasksRequest {} @@ -64,3 +114,50 @@ message NotifyWakeupRequiredRequest { } message NotifyWakeupRequiredResponse {} + +message ScheduleTaskRequest { + GrpcScheduleInfo scheduleInfo = 1; +} + +message ScheduleTaskResponse { + ErrorCode errorCode = 1; +} + +message GrpcScheduleInfo { + string clientId = 1; + string scheduleId = 2; + bytes data = 3; + int32 count = 4; + int64 startTimeInEpochSeconds = 5; + int64 periodicInSeconds = 6; +} + +message UnscheduleTaskRequest { + string clientId = 1; + string scheduleId = 2; +} + +message UnscheduleTaskResponse {} + +message UnscheduleAllTasksRequest { + string clientId = 1; +} + +message UnscheduleAllTasksResponse {} + +message IsTaskScheduledRequest { + string clientId = 1; + string scheduleId = 2; +} + +message IsTaskScheduledResponse { + bool isTaskScheduled = 1; +} + +message GetAllScheduledTasksRequest { + string clientId = 1; +} + +message GetAllScheduledTasksResponse { + repeated GrpcScheduleInfo allScheduledTasks = 1; +} diff --git a/automotive/remoteaccess/hal/default/remoteaccess-default-service.rc b/automotive/remoteaccess/hal/default/remoteaccess-default-service.rc index b7a9cdc82a8b75808e818d7e55f8ba39ec575cac..c9b282ce2467b31490826b68e5bc43b201478ad0 100644 --- a/automotive/remoteaccess/hal/default/remoteaccess-default-service.rc +++ b/automotive/remoteaccess/hal/default/remoteaccess-default-service.rc @@ -1,4 +1,4 @@ -service vendor.remoteaccess-default /vendor/bin/hw/android.hardware.automotive.remoteaccess@V1-default-service +service vendor.remoteaccess-default /vendor/bin/hw/android.hardware.automotive.remoteaccess@V2-default-service class hal user vehicle_network group system inet diff --git a/automotive/remoteaccess/hal/default/remoteaccess-default-service.xml b/automotive/remoteaccess/hal/default/remoteaccess-default-service.xml index d050a1b6467b4e502a421747ae732af12bdb82f1..44ac30996e4e42a68b73fb257dbbbc7f21b919e8 100644 --- a/automotive/remoteaccess/hal/default/remoteaccess-default-service.xml +++ b/automotive/remoteaccess/hal/default/remoteaccess-default-service.xml @@ -1,7 +1,7 @@ android.hardware.automotive.remoteaccess - 1 + 2 IRemoteAccess/default diff --git a/automotive/remoteaccess/hal/default/remoteaccess-tcu-test-service.rc b/automotive/remoteaccess/hal/default/remoteaccess-tcu-test-service.rc index 59315ebe0b265b1aae02d30f0d15187701ea7cbf..19faaf4c5f815aad521264b6b62601b89d24b301 100644 --- a/automotive/remoteaccess/hal/default/remoteaccess-tcu-test-service.rc +++ b/automotive/remoteaccess/hal/default/remoteaccess-tcu-test-service.rc @@ -1,4 +1,4 @@ -service vendor.remoteaccess-default /vendor/bin/hw/android.hardware.automotive.remoteaccess@V1-tcu-test-service +service vendor.remoteaccess-default /vendor/bin/hw/android.hardware.automotive.remoteaccess@V2-tcu-test-service class hal user vehicle_network group system inet diff --git a/automotive/remoteaccess/hal/default/src/RemoteAccessImpl.cpp b/automotive/remoteaccess/hal/default/src/RemoteAccessImpl.cpp index b0911620007a757d1bb657649b0a3aaec9aa4a0f..d4ba8641b7ab80fbfb9755d4b70668b48cb30644 100644 --- a/automotive/remoteaccess/hal/default/src/RemoteAccessImpl.cpp +++ b/automotive/remoteaccess/hal/default/src/RemoteAccessImpl.cpp @@ -30,12 +30,12 @@ constexpr char SERVICE_NAME[] = "android.hardware.automotive.remoteaccess.IRemoteAccess/default"; int main(int /* argc */, char* /* argv */[]) { - LOG(INFO) << "Registering RemoteAccessService as service..."; - #ifndef GRPC_SERVICE_ADDRESS LOG(ERROR) << "GRPC_SERVICE_ADDRESS is not defined, exiting"; exit(1); #endif + LOG(INFO) << "Registering RemoteAccessService as service, server: " << GRPC_SERVICE_ADDRESS + << "..."; grpc::ChannelArguments grpcargs = {}; #ifdef GRPC_SERVICE_IFNAME @@ -48,8 +48,7 @@ int main(int /* argc */, char* /* argv */[]) { android::netdevice::WaitCondition::PRESENT_AND_UP); LOG(INFO) << "Waiting for interface: " << GRPC_SERVICE_IFNAME << " done"; #endif - auto channel = grpc::CreateCustomChannel(GRPC_SERVICE_ADDRESS, - grpc::InsecureChannelCredentials(), grpcargs); + auto channel = grpc::CreateChannel(GRPC_SERVICE_ADDRESS, grpc::InsecureChannelCredentials()); auto clientStub = android::hardware::automotive::remoteaccess::WakeupClient::NewStub(channel); auto service = ndk::SharedRefBase::make< android::hardware::automotive::remoteaccess::RemoteAccessService>(clientStub.get()); diff --git a/automotive/remoteaccess/hal/default/src/RemoteAccessService.cpp b/automotive/remoteaccess/hal/default/src/RemoteAccessService.cpp index 5081ac0a9b773caea2d58f9e79e178606710b2b9..0944d8699d87c395fac2cc54ccf0db7d1c7db2ca 100644 --- a/automotive/remoteaccess/hal/default/src/RemoteAccessService.cpp +++ b/automotive/remoteaccess/hal/default/src/RemoteAccessService.cpp @@ -39,6 +39,7 @@ namespace { using ::aidl::android::hardware::automotive::remoteaccess::ApState; using ::aidl::android::hardware::automotive::remoteaccess::IRemoteTaskCallback; +using ::aidl::android::hardware::automotive::remoteaccess::ScheduleInfo; using ::aidl::android::hardware::automotive::vehicle::VehicleProperty; using ::android::base::Error; using ::android::base::ParseInt; @@ -313,6 +314,109 @@ ScopedAStatus RemoteAccessService::notifyApStateChange(const ApState& newState) return ScopedAStatus::ok(); } +ScopedAStatus RemoteAccessService::isTaskScheduleSupported(bool* out) { + *out = true; + return ScopedAStatus::ok(); +} + +ScopedAStatus RemoteAccessService::scheduleTask(const ScheduleInfo& scheduleInfo) { + ClientContext context; + ScheduleTaskRequest request = {}; + ScheduleTaskResponse response = {}; + request.mutable_scheduleinfo()->set_clientid(scheduleInfo.clientId); + request.mutable_scheduleinfo()->set_scheduleid(scheduleInfo.scheduleId); + request.mutable_scheduleinfo()->set_data(scheduleInfo.taskData.data(), + scheduleInfo.taskData.size()); + request.mutable_scheduleinfo()->set_count(scheduleInfo.count); + request.mutable_scheduleinfo()->set_starttimeinepochseconds( + scheduleInfo.startTimeInEpochSeconds); + request.mutable_scheduleinfo()->set_periodicinseconds(scheduleInfo.periodicInSeconds); + Status status = mGrpcStub->ScheduleTask(&context, request, &response); + if (!status.ok()) { + return rpcStatusToScopedAStatus(status, "Failed to call ScheduleTask"); + } + int errorCode = response.errorcode(); + switch (errorCode) { + case ErrorCode::OK: + return ScopedAStatus::ok(); + case ErrorCode::INVALID_ARG: + return ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); + default: + // Should not happen. + return ScopedAStatus::fromServiceSpecificErrorWithMessage( + -1, ("Got unknown error code: " + ErrorCode_Name(errorCode) + + " from remote access HAL") + .c_str()); + } +} + +ScopedAStatus RemoteAccessService::unscheduleTask(const std::string& clientId, + const std::string& scheduleId) { + ClientContext context; + UnscheduleTaskRequest request = {}; + UnscheduleTaskResponse response = {}; + request.set_clientid(clientId); + request.set_scheduleid(scheduleId); + Status status = mGrpcStub->UnscheduleTask(&context, request, &response); + if (!status.ok()) { + return rpcStatusToScopedAStatus(status, "Failed to call UnscheduleTask"); + } + return ScopedAStatus::ok(); +} + +ScopedAStatus RemoteAccessService::unscheduleAllTasks(const std::string& clientId) { + ClientContext context; + UnscheduleAllTasksRequest request = {}; + UnscheduleAllTasksResponse response = {}; + request.set_clientid(clientId); + Status status = mGrpcStub->UnscheduleAllTasks(&context, request, &response); + if (!status.ok()) { + return rpcStatusToScopedAStatus(status, "Failed to call UnscheduleAllTasks"); + } + return ScopedAStatus::ok(); +} + +ScopedAStatus RemoteAccessService::isTaskScheduled(const std::string& clientId, + const std::string& scheduleId, bool* out) { + ClientContext context; + IsTaskScheduledRequest request = {}; + IsTaskScheduledResponse response = {}; + request.set_clientid(clientId); + request.set_scheduleid(scheduleId); + Status status = mGrpcStub->IsTaskScheduled(&context, request, &response); + if (!status.ok()) { + return rpcStatusToScopedAStatus(status, "Failed to call isTaskScheduled"); + } + *out = response.istaskscheduled(); + return ScopedAStatus::ok(); +} + +ScopedAStatus RemoteAccessService::getAllScheduledTasks(const std::string& clientId, + std::vector* out) { + ClientContext context; + GetAllScheduledTasksRequest request = {}; + GetAllScheduledTasksResponse response = {}; + request.set_clientid(clientId); + Status status = mGrpcStub->GetAllScheduledTasks(&context, request, &response); + if (!status.ok()) { + return rpcStatusToScopedAStatus(status, "Failed to call isTaskScheduled"); + } + out->clear(); + for (int i = 0; i < response.allscheduledtasks_size(); i++) { + const GrpcScheduleInfo& rpcScheduleInfo = response.allscheduledtasks(i); + ScheduleInfo scheduleInfo = { + .clientId = rpcScheduleInfo.clientid(), + .scheduleId = rpcScheduleInfo.scheduleid(), + .taskData = stringToBytes(rpcScheduleInfo.data()), + .count = rpcScheduleInfo.count(), + .startTimeInEpochSeconds = rpcScheduleInfo.starttimeinepochseconds(), + .periodicInSeconds = rpcScheduleInfo.periodicinseconds(), + }; + out->push_back(std::move(scheduleInfo)); + } + return ScopedAStatus::ok(); +} + bool RemoteAccessService::checkDumpPermission() { uid_t uid = AIBinder_getCallingUid(); return uid == AID_ROOT || uid == AID_SHELL || uid == AID_SYSTEM; diff --git a/automotive/remoteaccess/hal/default/test/RemoteAccessServiceUnitTest.cpp b/automotive/remoteaccess/hal/default/test/RemoteAccessServiceUnitTest.cpp index c5afd6300f9a5cff635cd86256abccdae2224066..c0038c270bd1fe70ba05cc2dd0e7495f35f3fb24 100644 --- a/automotive/remoteaccess/hal/default/test/RemoteAccessServiceUnitTest.cpp +++ b/automotive/remoteaccess/hal/default/test/RemoteAccessServiceUnitTest.cpp @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include @@ -46,6 +47,7 @@ using ::android::frameworks::automotive::vhal::VhalClientResult; using ::aidl::android::hardware::automotive::remoteaccess::ApState; using ::aidl::android::hardware::automotive::remoteaccess::BnRemoteTaskCallback; +using ::aidl::android::hardware::automotive::remoteaccess::ScheduleInfo; using ::aidl::android::hardware::automotive::vehicle::VehiclePropValue; using ::grpc::ClientAsyncReaderInterface; @@ -63,6 +65,12 @@ using ::testing::Return; using ::testing::SetArgPointee; constexpr char kTestVin[] = "test_VIN"; +const std::string kTestClientId = "test client id"; +const std::string kTestScheduleId = "test schedule id"; +const std::vector kTestData = {0xde, 0xad, 0xbe, 0xef}; +constexpr int32_t kTestCount = 1234; +constexpr int64_t kTestStartTimeInEpochSeconds = 2345; +constexpr int64_t kTestPeriodicInSeconds = 123; } // namespace @@ -73,6 +81,21 @@ class MockGrpcClientStub : public WakeupClient::StubInterface { MOCK_METHOD(Status, NotifyWakeupRequired, (ClientContext * context, const NotifyWakeupRequiredRequest& request, NotifyWakeupRequiredResponse* response)); + MOCK_METHOD(Status, ScheduleTask, + (ClientContext * context, const ScheduleTaskRequest& request, + ScheduleTaskResponse* response)); + MOCK_METHOD(Status, UnscheduleTask, + (ClientContext * context, const UnscheduleTaskRequest& request, + UnscheduleTaskResponse* response)); + MOCK_METHOD(Status, UnscheduleAllTasks, + (ClientContext * context, const UnscheduleAllTasksRequest& request, + UnscheduleAllTasksResponse* response)); + MOCK_METHOD(Status, IsTaskScheduled, + (ClientContext * context, const IsTaskScheduledRequest& request, + IsTaskScheduledResponse* response)); + MOCK_METHOD(Status, GetAllScheduledTasks, + (ClientContext * context, const GetAllScheduledTasksRequest& request, + GetAllScheduledTasksResponse* response)); // Async methods which we do not care. MOCK_METHOD(ClientAsyncReaderInterface*, AsyncGetRemoteTasksRaw, (ClientContext * context, const GetRemoteTasksRequest& request, CompletionQueue* cq, @@ -88,6 +111,42 @@ class MockGrpcClientStub : public WakeupClient::StubInterface { PrepareAsyncNotifyWakeupRequiredRaw, (ClientContext * context, const NotifyWakeupRequiredRequest& request, CompletionQueue* cq)); + MOCK_METHOD(ClientAsyncResponseReaderInterface*, AsyncScheduleTaskRaw, + (ClientContext * context, const ScheduleTaskRequest& request, CompletionQueue* cq)); + MOCK_METHOD(ClientAsyncResponseReaderInterface*, + PrepareAsyncScheduleTaskRaw, + (ClientContext * context, const ScheduleTaskRequest& request, CompletionQueue* cq)); + MOCK_METHOD(ClientAsyncResponseReaderInterface*, AsyncUnscheduleTaskRaw, + (ClientContext * context, const UnscheduleTaskRequest& request, + CompletionQueue* cq)); + MOCK_METHOD(ClientAsyncResponseReaderInterface*, + PrepareAsyncUnscheduleTaskRaw, + (ClientContext * context, const UnscheduleTaskRequest& request, + CompletionQueue* cq)); + MOCK_METHOD(ClientAsyncResponseReaderInterface*, + AsyncUnscheduleAllTasksRaw, + (ClientContext * context, const UnscheduleAllTasksRequest& request, + CompletionQueue* cq)); + MOCK_METHOD(ClientAsyncResponseReaderInterface*, + PrepareAsyncUnscheduleAllTasksRaw, + (ClientContext * context, const UnscheduleAllTasksRequest& request, + CompletionQueue* cq)); + MOCK_METHOD(ClientAsyncResponseReaderInterface*, + AsyncIsTaskScheduledRaw, + (ClientContext * context, const IsTaskScheduledRequest& request, + CompletionQueue* cq)); + MOCK_METHOD(ClientAsyncResponseReaderInterface*, + PrepareAsyncIsTaskScheduledRaw, + (ClientContext * context, const IsTaskScheduledRequest& request, + CompletionQueue* cq)); + MOCK_METHOD(ClientAsyncResponseReaderInterface*, + AsyncGetAllScheduledTasksRaw, + (ClientContext * context, const GetAllScheduledTasksRequest& request, + CompletionQueue* cq)); + MOCK_METHOD(ClientAsyncResponseReaderInterface*, + PrepareAsyncGetAllScheduledTasksRaw, + (ClientContext * context, const GetAllScheduledTasksRequest& request, + CompletionQueue* cq)); }; class FakeVhalClient final : public android::frameworks::automotive::vhal::IVhalClient { @@ -367,6 +426,174 @@ TEST_F(RemoteAccessServiceUnitTest, testGetVehicleId) { ASSERT_EQ(vehicleId, kTestVin); } +TEST_F(RemoteAccessServiceUnitTest, TestIsTaskScheduleSupported) { + bool out = false; + ScopedAStatus status = getService()->isTaskScheduleSupported(&out); + + EXPECT_TRUE(status.isOk()); + EXPECT_TRUE(out); +} + +TEST_F(RemoteAccessServiceUnitTest, TestScheduleTask) { + ScheduleTaskRequest grpcRequest = {}; + EXPECT_CALL(*getGrpcWakeupClientStub(), ScheduleTask) + .WillOnce([&grpcRequest]([[maybe_unused]] ClientContext* context, + const ScheduleTaskRequest& request, + [[maybe_unused]] ScheduleTaskResponse* response) { + grpcRequest = request; + return Status(); + }); + ScheduleInfo scheduleInfo = { + .clientId = kTestClientId, + .scheduleId = kTestScheduleId, + .taskData = kTestData, + .count = kTestCount, + .startTimeInEpochSeconds = kTestStartTimeInEpochSeconds, + .periodicInSeconds = kTestPeriodicInSeconds, + }; + + ScopedAStatus status = getService()->scheduleTask(scheduleInfo); + + ASSERT_TRUE(status.isOk()); + EXPECT_EQ(grpcRequest.scheduleinfo().clientid(), kTestClientId); + EXPECT_EQ(grpcRequest.scheduleinfo().scheduleid(), kTestScheduleId); + EXPECT_EQ(grpcRequest.scheduleinfo().data(), std::string(kTestData.begin(), kTestData.end())); + EXPECT_EQ(grpcRequest.scheduleinfo().count(), kTestCount); + EXPECT_EQ(grpcRequest.scheduleinfo().starttimeinepochseconds(), kTestStartTimeInEpochSeconds); + EXPECT_EQ(grpcRequest.scheduleinfo().periodicinseconds(), kTestPeriodicInSeconds); +} + +TEST_F(RemoteAccessServiceUnitTest, TestScheduleTask_InvalidArg) { + EXPECT_CALL(*getGrpcWakeupClientStub(), ScheduleTask) + .WillOnce([]([[maybe_unused]] ClientContext* context, + [[maybe_unused]] const ScheduleTaskRequest& request, + ScheduleTaskResponse* response) { + response->set_errorcode(ErrorCode::INVALID_ARG); + return Status(); + }); + ScheduleInfo scheduleInfo = { + .clientId = kTestClientId, + .scheduleId = kTestScheduleId, + .taskData = kTestData, + .count = kTestCount, + .startTimeInEpochSeconds = kTestStartTimeInEpochSeconds, + .periodicInSeconds = kTestPeriodicInSeconds, + }; + + ScopedAStatus status = getService()->scheduleTask(scheduleInfo); + + ASSERT_FALSE(status.isOk()); + ASSERT_EQ(status.getExceptionCode(), EX_ILLEGAL_ARGUMENT); +} + +TEST_F(RemoteAccessServiceUnitTest, TestScheduleTask_UnspecifiedError) { + EXPECT_CALL(*getGrpcWakeupClientStub(), ScheduleTask) + .WillOnce([]([[maybe_unused]] ClientContext* context, + [[maybe_unused]] const ScheduleTaskRequest& request, + ScheduleTaskResponse* response) { + response->set_errorcode(ErrorCode::UNSPECIFIED); + return Status(); + }); + ScheduleInfo scheduleInfo = { + .clientId = kTestClientId, + .scheduleId = kTestScheduleId, + .taskData = kTestData, + .count = kTestCount, + .startTimeInEpochSeconds = kTestStartTimeInEpochSeconds, + .periodicInSeconds = kTestPeriodicInSeconds, + }; + + ScopedAStatus status = getService()->scheduleTask(scheduleInfo); + + ASSERT_FALSE(status.isOk()); + ASSERT_EQ(status.getExceptionCode(), EX_SERVICE_SPECIFIC); +} + +TEST_F(RemoteAccessServiceUnitTest, TestUnscheduleTask) { + UnscheduleTaskRequest grpcRequest = {}; + EXPECT_CALL(*getGrpcWakeupClientStub(), UnscheduleTask) + .WillOnce([&grpcRequest]([[maybe_unused]] ClientContext* context, + const UnscheduleTaskRequest& request, + [[maybe_unused]] UnscheduleTaskResponse* response) { + grpcRequest = request; + return Status(); + }); + + ScopedAStatus status = getService()->unscheduleTask(kTestClientId, kTestScheduleId); + + ASSERT_TRUE(status.isOk()); + EXPECT_EQ(grpcRequest.clientid(), kTestClientId); + EXPECT_EQ(grpcRequest.scheduleid(), kTestScheduleId); +} + +TEST_F(RemoteAccessServiceUnitTest, TestUnscheduleAllTasks) { + UnscheduleAllTasksRequest grpcRequest = {}; + EXPECT_CALL(*getGrpcWakeupClientStub(), UnscheduleAllTasks) + .WillOnce([&grpcRequest]([[maybe_unused]] ClientContext* context, + const UnscheduleAllTasksRequest& request, + [[maybe_unused]] UnscheduleAllTasksResponse* response) { + grpcRequest = request; + return Status(); + }); + + ScopedAStatus status = getService()->unscheduleAllTasks(kTestClientId); + + ASSERT_TRUE(status.isOk()); + EXPECT_EQ(grpcRequest.clientid(), kTestClientId); +} + +TEST_F(RemoteAccessServiceUnitTest, TestIsTaskScheduled) { + bool isTaskScheduled = false; + IsTaskScheduledRequest grpcRequest = {}; + EXPECT_CALL(*getGrpcWakeupClientStub(), IsTaskScheduled) + .WillOnce([&grpcRequest]([[maybe_unused]] ClientContext* context, + const IsTaskScheduledRequest& request, + IsTaskScheduledResponse* response) { + grpcRequest = request; + response->set_istaskscheduled(true); + return Status(); + }); + + ScopedAStatus status = + getService()->isTaskScheduled(kTestClientId, kTestScheduleId, &isTaskScheduled); + + ASSERT_TRUE(status.isOk()); + EXPECT_TRUE(isTaskScheduled); + EXPECT_EQ(grpcRequest.clientid(), kTestClientId); + EXPECT_EQ(grpcRequest.scheduleid(), kTestScheduleId); +} + +TEST_F(RemoteAccessServiceUnitTest, testGetAllScheduledTasks) { + std::vector result; + GetAllScheduledTasksRequest grpcRequest = {}; + EXPECT_CALL(*getGrpcWakeupClientStub(), GetAllScheduledTasks) + .WillOnce([&grpcRequest]([[maybe_unused]] ClientContext* context, + const GetAllScheduledTasksRequest& request, + GetAllScheduledTasksResponse* response) { + grpcRequest = request; + GrpcScheduleInfo* newInfo = response->add_allscheduledtasks(); + newInfo->set_clientid(kTestClientId); + newInfo->set_scheduleid(kTestScheduleId); + newInfo->set_data(kTestData.data(), kTestData.size()); + newInfo->set_count(kTestCount); + newInfo->set_starttimeinepochseconds(kTestStartTimeInEpochSeconds); + newInfo->set_periodicinseconds(kTestPeriodicInSeconds); + return Status(); + }); + + ScopedAStatus status = getService()->getAllScheduledTasks(kTestClientId, &result); + + ASSERT_TRUE(status.isOk()); + EXPECT_EQ(grpcRequest.clientid(), kTestClientId); + ASSERT_EQ(result.size(), 1u); + ASSERT_EQ(result[0].clientId, kTestClientId); + ASSERT_EQ(result[0].scheduleId, kTestScheduleId); + ASSERT_EQ(result[0].taskData, kTestData); + ASSERT_EQ(result[0].count, kTestCount); + ASSERT_EQ(result[0].startTimeInEpochSeconds, kTestStartTimeInEpochSeconds); + ASSERT_EQ(result[0].periodicInSeconds, kTestPeriodicInSeconds); +} + } // namespace remoteaccess } // namespace automotive } // namespace hardware diff --git a/automotive/remoteaccess/test_grpc_server/README.md b/automotive/remoteaccess/test_grpc_server/README.md index af3d54ac5b2f866d4546e41d12654b3dd67c45d1..d2b6bbef6a9685be7d9c7378457a4a29d603f0ca 100644 --- a/automotive/remoteaccess/test_grpc_server/README.md +++ b/automotive/remoteaccess/test_grpc_server/README.md @@ -141,7 +141,7 @@ interface. * The android lunch target: sdk_car_x86_64-userdebug and cf_x86_64_auto-userdebug already contains the default remote access HAL. For other lunch target, you can add the default remote access HAL by adding - 'android.hardware.automotive.remoteaccess@V1-default-service' to + 'android.hardware.automotive.remoteaccess@V2-default-service' to 'PRODUCT_PACKAGES' variable in mk file, see `device/generic/car/common/car.mk` as example. diff --git a/automotive/remoteaccess/test_grpc_server/impl/Android.bp b/automotive/remoteaccess/test_grpc_server/impl/Android.bp index 152b528490bc07e8ccadfd4837035beb66114770..fd174bf817143089a661499b8c170f490b65a373 100644 --- a/automotive/remoteaccess/test_grpc_server/impl/Android.bp +++ b/automotive/remoteaccess/test_grpc_server/impl/Android.bp @@ -38,6 +38,50 @@ cc_binary { ], cflags: [ "-Wno-unused-parameter", - "-DGRPC_SERVICE_ADDRESS=\"localhost:50051\"", + "-DGRPC_SERVICE_ADDRESS=\"127.0.0.1:50051\"", + ], +} + +cc_binary_host { + name: "TestWakeupClientServerHost", + srcs: ["src/*.cpp"], + local_include_dirs: ["include"], + shared_libs: [ + "libbase", + "libutils", + "libgrpc++", + "libprotobuf-cpp-full", + ], + whole_static_libs: [ + "wakeup_client_protos", + ], + cflags: [ + "-Wno-unused-parameter", + "-DGRPC_SERVICE_ADDRESS=\"127.0.0.1:50051\"", + "-DHOST", + ], +} + +cc_test_host { + name: "TestWakeupClientServerHostUnitTest", + srcs: [ + "test/*.cpp", + "src/TestWakeupClientServiceImpl.cpp", + ], + local_include_dirs: ["include"], + shared_libs: [ + "libbase", + "libutils", + "libgrpc++", + "libprotobuf-cpp-full", + ], + static_libs: [ + "libgtest", + ], + whole_static_libs: [ + "wakeup_client_protos", + ], + cflags: [ + "-Wno-unused-parameter", ], } diff --git a/automotive/remoteaccess/test_grpc_server/impl/include/TestWakeupClientServiceImpl.h b/automotive/remoteaccess/test_grpc_server/impl/include/TestWakeupClientServiceImpl.h index 6b86b35933d51928253dec3b8ece51b874774fa3..2aab90442979312f8b264e061f1d68bd22e06eb7 100644 --- a/automotive/remoteaccess/test_grpc_server/impl/include/TestWakeupClientServiceImpl.h +++ b/automotive/remoteaccess/test_grpc_server/impl/include/TestWakeupClientServiceImpl.h @@ -34,11 +34,9 @@ namespace remoteaccess { // implementation, the task should come from remote task server. This class is thread-safe. class FakeTaskGenerator final { public: - GetRemoteTasksResponse generateTask(); + GetRemoteTasksResponse generateTask(const std::string& clientId); private: - // Simulates the client ID for each task. - std::atomic mCurrentClientId = 0; constexpr static uint8_t DATA[] = {0xde, 0xad, 0xbe, 0xef}; }; @@ -73,38 +71,52 @@ class TaskTimeoutMessageHandler final : public android::MessageHandler { // TaskQueue is thread-safe. class TaskQueue final { public: - TaskQueue(); - ~TaskQueue(); + TaskQueue(android::sp looper); void add(const GetRemoteTasksResponse& response); std::optional maybePopOne(); void waitForTask(); void stopWait(); - void handleTaskTimeout(); bool isEmpty(); private: - std::thread mCheckTaskTimeoutThread; + friend class TaskTimeoutMessageHandler; + std::mutex mLock; std::priority_queue, TaskInfoComparator> mTasks GUARDED_BY(mLock); // A variable to notify mTasks is not empty. std::condition_variable mTasksNotEmptyCv; - bool mStopped GUARDED_BY(mLock); + std::atomic mStopped; android::sp mLooper; android::sp mTaskTimeoutMessageHandler; std::atomic mTaskIdCounter = 0; - void checkForTestTimeoutLoop(); - void waitForTaskWithLock(std::unique_lock& lock); + void loop(); + void handleTaskTimeout(); }; -class TestWakeupClientServiceImpl final : public WakeupClient::Service { +// forward-declaration +class TestWakeupClientServiceImpl; + +class TaskScheduleMsgHandler final : public android::MessageHandler { + public: + TaskScheduleMsgHandler(TestWakeupClientServiceImpl* mImpl); + void handleMessage(const android::Message& message) override; + + private: + TestWakeupClientServiceImpl* mImpl; +}; + +class TestWakeupClientServiceImpl : public WakeupClient::Service { public: TestWakeupClientServiceImpl(); ~TestWakeupClientServiceImpl(); + // Stop the handling for all income requests. Prepare for shutdown. + void stopServer(); + grpc::Status GetRemoteTasks(grpc::ServerContext* context, const GetRemoteTasksRequest* request, grpc::ServerWriter* writer) override; @@ -112,25 +124,111 @@ class TestWakeupClientServiceImpl final : public WakeupClient::Service { const NotifyWakeupRequiredRequest* request, NotifyWakeupRequiredResponse* response) override; + grpc::Status ScheduleTask(grpc::ServerContext* context, const ScheduleTaskRequest* request, + ScheduleTaskResponse* response) override; + + grpc::Status UnscheduleTask(grpc::ServerContext* context, const UnscheduleTaskRequest* request, + UnscheduleTaskResponse* response) override; + + grpc::Status UnscheduleAllTasks(grpc::ServerContext* context, + const UnscheduleAllTasksRequest* request, + UnscheduleAllTasksResponse* response) override; + + grpc::Status IsTaskScheduled(grpc::ServerContext* context, + const IsTaskScheduledRequest* request, + IsTaskScheduledResponse* response) override; + + grpc::Status GetAllScheduledTasks(grpc::ServerContext* context, + const GetAllScheduledTasksRequest* request, + GetAllScheduledTasksResponse* response) override; + + /** + * Starts generating fake tasks for the specific client repeatedly. + * + * The fake task will have {0xDE 0xAD 0xBE 0xEF} as payload. A new fake task will be sent + * to the client every 5s. + */ + void startGeneratingFakeTask(const std::string& clientId); + + /** + * stops generating fake tasks. + */ + void stopGeneratingFakeTask(); + + /** + * Returns whether we need to wakeup the target device to send remote tasks. + */ + bool isWakeupRequired(); + + /** + * Returns whether we have an active connection with the target device. + */ + bool isRemoteTaskConnectionAlive(); + + /** + * Injects a fake task with taskData to be sent to the specific client. + */ + void injectTask(const std::string& taskData, const std::string& clientId); + + /** + * Wakes up the target device. + * + * This must be implemented by child class and contains device specific logic. E.g. this might + * be sending QEMU commands for the emulator device. + */ + virtual void wakeupApplicationProcessor() = 0; + + /** + * Cleans up a scheduled task info. + */ + void cleanupScheduledTaskLocked(const std::string& clientId, const std::string& scheduleId) + REQUIRES(mLock); + private: - // This is a thread for communicating with remote wakeup server (via network) and receive tasks - // from it. - std::thread mThread; + friend class TaskScheduleMsgHandler; + + struct ScheduleInfo { + std::unique_ptr grpcScheduleInfo; + // This is a unique ID to represent this schedule. Each repeated tasks will have different + // task ID but will have the same scheduleMsgId so that we can use to unschedule. This has + // to be an int so we cannot use the scheduleId provided by the client. + int scheduleMsgId; + int64_t periodicInSeconds; + int32_t currentCount; + int32_t totalCount; + }; + + std::atomic mScheduleMsgCounter = 0; + // This is a looper for scheduling tasks to be executed in the future. + android::sp mLooper; + android::sp mTaskScheduleMsgHandler; + // This is a thread for generating fake tasks. + std::thread mFakeTaskThread; + // This is a thread for the looper. + std::thread mLooperThread; // A variable to notify server is stopping. - std::condition_variable mServerStoppedCv; + std::condition_variable mTaskLoopStoppedCv; // Whether wakeup AP is required for executing tasks. std::atomic mWakeupRequired = true; + // Whether we currently have an active long-live connection to deliver remote tasks. + std::atomic mRemoteTaskConnectionAlive = false; std::mutex mLock; - bool mServerStopped GUARDED_BY(mLock); + bool mGeneratingFakeTask GUARDED_BY(mLock); + std::atomic mServerStopped; + std::unordered_map> + mInfoByScheduleIdByClientId GUARDED_BY(mLock); // Thread-safe. For test impl only. FakeTaskGenerator mFakeTaskGenerator; - // Thread-sfae. - TaskQueue mTaskQueue; - - void fakeTaskGenerateLoop(); - - void wakeupApplicationProcessor(); + // Thread-safe. + std::unique_ptr mTaskQueue; + + void fakeTaskGenerateLoop(const std::string& clientId); + void injectTaskResponse(const GetRemoteTasksResponse& response); + bool getScheduleInfoLocked(int scheduleMsgId, ScheduleInfo** outScheduleInfoPtr) + REQUIRES(mLock); + void handleAddTask(int scheduleMsgId); + void loop(); }; } // namespace remoteaccess diff --git a/automotive/remoteaccess/test_grpc_server/impl/src/TestWakeupClientServiceImpl.cpp b/automotive/remoteaccess/test_grpc_server/impl/src/TestWakeupClientServiceImpl.cpp index 7dcd31e3b41921c3a038033a8ba0903b3934dc6c..1db991c8b0769a4af34f22c0667afa03be1e69fa 100644 --- a/automotive/remoteaccess/test_grpc_server/impl/src/TestWakeupClientServiceImpl.cpp +++ b/automotive/remoteaccess/test_grpc_server/impl/src/TestWakeupClientServiceImpl.cpp @@ -16,8 +16,6 @@ #include "TestWakeupClientServiceImpl.h" -#include "ApPowerControl.h" - #include #include #include @@ -39,17 +37,24 @@ using ::grpc::ServerContext; using ::grpc::ServerWriter; using ::grpc::Status; -constexpr int kTaskIntervalInMs = 5'000; -constexpr int64_t KTaskTimeoutInMs = 20'000; +constexpr int64_t kTaskIntervalInMs = 5'000; +constexpr int64_t kTaskTimeoutInMs = 20'000; + +int64_t msToNs(int64_t ms) { + return std::chrono::duration_cast(std::chrono::milliseconds(ms)) + .count(); +} + +int64_t sToNs(int64_t s) { + return std::chrono::duration_cast(std::chrono::seconds(s)).count(); +} } // namespace -GetRemoteTasksResponse FakeTaskGenerator::generateTask() { - int clientId = mCurrentClientId++; +GetRemoteTasksResponse FakeTaskGenerator::generateTask(const std::string& clientId) { GetRemoteTasksResponse response; - response.set_data(std::string(reinterpret_cast(DATA), sizeof(DATA))); - std::string clientIdStr = StringPrintf("%d", clientId); - response.set_clientid(clientIdStr); + response.set_data(reinterpret_cast(DATA), sizeof(DATA)); + response.set_clientid(clientId); return response; } @@ -60,26 +65,9 @@ void TaskTimeoutMessageHandler::handleMessage(const android::Message& message) { mTaskQueue->handleTaskTimeout(); } -TaskQueue::TaskQueue() { +TaskQueue::TaskQueue(android::sp looper) { mTaskTimeoutMessageHandler = android::sp::make(this); - mLooper = Looper::prepare(/*opts=*/0); - mCheckTaskTimeoutThread = std::thread([this] { checkForTestTimeoutLoop(); }); -} - -TaskQueue::~TaskQueue() { - { - std::lock_guard lockGuard(mLock); - mStopped = true; - } - while (true) { - // Remove all pending timeout handlers from queue. - if (!maybePopOne().has_value()) { - break; - } - } - if (mCheckTaskTimeoutThread.joinable()) { - mCheckTaskTimeoutThread.join(); - } + mLooper = looper; } std::optional TaskQueue::maybePopOne() { @@ -105,16 +93,12 @@ void TaskQueue::add(const GetRemoteTasksResponse& task) { .taskData = task, }); android::Message message(taskId); - mLooper->sendMessageDelayed(KTaskTimeoutInMs * 1000, mTaskTimeoutMessageHandler, message); + mLooper->sendMessageDelayed(msToNs(kTaskTimeoutInMs), mTaskTimeoutMessageHandler, message); mTasksNotEmptyCv.notify_all(); } void TaskQueue::waitForTask() { std::unique_lock lock(mLock); - waitForTaskWithLock(lock); -} - -void TaskQueue::waitForTaskWithLock(std::unique_lock& lock) { mTasksNotEmptyCv.wait(lock, [this] { ScopedLockAssertion lockAssertion(mLock); return mTasks.size() > 0 || mStopped; @@ -122,9 +106,11 @@ void TaskQueue::waitForTaskWithLock(std::unique_lock& lock) { } void TaskQueue::stopWait() { - std::lock_guard lockGuard(mLock); mStopped = true; - mTasksNotEmptyCv.notify_all(); + { + std::lock_guard lockGuard(mLock); + mTasksNotEmptyCv.notify_all(); + } } bool TaskQueue::isEmpty() { @@ -132,21 +118,6 @@ bool TaskQueue::isEmpty() { return mTasks.size() == 0 || mStopped; } -void TaskQueue::checkForTestTimeoutLoop() { - Looper::setForThread(mLooper); - - while (true) { - { - std::unique_lock lock(mLock); - if (mStopped) { - return; - } - } - - mLooper->pollAll(/*timeoutMillis=*/-1); - } -} - void TaskQueue::handleTaskTimeout() { // We know which task timed-out from the taskId in the message. However, there is no easy way // to remove a specific task with the task ID from the priority_queue, so we just check from @@ -155,48 +126,106 @@ void TaskQueue::handleTaskTimeout() { int64_t now = uptimeMillis(); while (mTasks.size() > 0) { const TaskInfo& taskInfo = mTasks.top(); - if (taskInfo.timestampInMs + KTaskTimeoutInMs > now) { + if (taskInfo.timestampInMs + kTaskTimeoutInMs > now) { break; } // In real implementation, this should report task failure to remote wakeup server. - printf("Task for client ID: %s timed-out, added at %" PRId64 " ms, now %" PRId64 " ms", + printf("Task for client ID: %s timed-out, added at %" PRId64 " ms, now %" PRId64 " ms\n", taskInfo.taskData.clientid().c_str(), taskInfo.timestampInMs, now); mTasks.pop(); } } TestWakeupClientServiceImpl::TestWakeupClientServiceImpl() { - mThread = std::thread([this] { fakeTaskGenerateLoop(); }); + mTaskScheduleMsgHandler = android::sp::make(this); + mLooper = android::sp::make(/*opts=*/0); + mLooperThread = std::thread([this] { loop(); }); + mTaskQueue = std::make_unique(mLooper); } TestWakeupClientServiceImpl::~TestWakeupClientServiceImpl() { + if (mServerStopped) { + return; + } + stopServer(); +} + +void TestWakeupClientServiceImpl::stopServer() { + mTaskQueue->stopWait(); + stopGeneratingFakeTask(); + // Set the flag so that the loop thread will exit. + mServerStopped = true; + mLooper->wake(); + if (mLooperThread.joinable()) { + mLooperThread.join(); + } +} + +void TestWakeupClientServiceImpl::loop() { + Looper::setForThread(mLooper); + + while (true) { + mLooper->pollAll(/*timeoutMillis=*/-1); + if (mServerStopped) { + return; + } + } +} + +void TestWakeupClientServiceImpl::injectTask(const std::string& taskData, + const std::string& clientId) { + GetRemoteTasksResponse response; + response.set_data(taskData); + response.set_clientid(clientId); + injectTaskResponse(response); +} + +void TestWakeupClientServiceImpl::injectTaskResponse(const GetRemoteTasksResponse& response) { + printf("Receive a new task\n"); + mTaskQueue->add(response); + if (mWakeupRequired) { + wakeupApplicationProcessor(); + } +} + +void TestWakeupClientServiceImpl::startGeneratingFakeTask(const std::string& clientId) { + std::lock_guard lockGuard(mLock); + if (mGeneratingFakeTask) { + printf("Fake task is already being generated\n"); + return; + } + mGeneratingFakeTask = true; + mFakeTaskThread = std::thread([this, clientId] { fakeTaskGenerateLoop(clientId); }); + printf("Started generating fake tasks\n"); +} + +void TestWakeupClientServiceImpl::stopGeneratingFakeTask() { { std::lock_guard lockGuard(mLock); - mServerStopped = true; - mServerStoppedCv.notify_all(); + if (!mGeneratingFakeTask) { + printf("Fake task is not being generated, do nothing\n"); + return; + } + mTaskLoopStoppedCv.notify_all(); + mGeneratingFakeTask = false; } - mTaskQueue.stopWait(); - if (mThread.joinable()) { - mThread.join(); + if (mFakeTaskThread.joinable()) { + mFakeTaskThread.join(); } + printf("Stopped generating fake tasks\n"); } -void TestWakeupClientServiceImpl::fakeTaskGenerateLoop() { +void TestWakeupClientServiceImpl::fakeTaskGenerateLoop(const std::string& clientId) { // In actual implementation, this should communicate with the remote server and receives tasks // from it. Here we simulate receiving one remote task every {kTaskIntervalInMs}ms. while (true) { - mTaskQueue.add(mFakeTaskGenerator.generateTask()); - printf("Received a new task\n"); - if (mWakeupRequired) { - wakeupApplicationProcessor(); - } - - printf("Sleeping for %d seconds until next task\n", kTaskIntervalInMs); + injectTaskResponse(mFakeTaskGenerator.generateTask(clientId)); + printf("Sleeping for %" PRId64 " seconds until next task\n", kTaskIntervalInMs); std::unique_lock lk(mLock); - if (mServerStoppedCv.wait_for(lk, std::chrono::milliseconds(kTaskIntervalInMs), [this] { + if (mTaskLoopStoppedCv.wait_for(lk, std::chrono::milliseconds(kTaskIntervalInMs), [this] { ScopedLockAssertion lockAssertion(mLock); - return mServerStopped; + return !mGeneratingFakeTask; })) { // If the stopped flag is set, we are quitting, exit the loop. return; @@ -208,11 +237,18 @@ Status TestWakeupClientServiceImpl::GetRemoteTasks(ServerContext* context, const GetRemoteTasksRequest* request, ServerWriter* writer) { printf("GetRemoteTasks called\n"); + mRemoteTaskConnectionAlive = true; while (true) { - mTaskQueue.waitForTask(); + mTaskQueue->waitForTask(); + + if (mServerStopped) { + // Server stopped, exit the loop. + printf("Server stopped exit loop\n"); + break; + } while (true) { - auto maybeTask = mTaskQueue.maybePopOne(); + auto maybeTask = mTaskQueue->maybePopOne(); if (!maybeTask.has_value()) { // No task left, loop again and wait for another task(s). break; @@ -225,29 +261,238 @@ Status TestWakeupClientServiceImpl::GetRemoteTasks(ServerContext* context, printf("Failed to deliver remote task to remote access HAL\n"); // The task failed to be sent, add it back to the queue. The order might change, but // it is okay. - mTaskQueue.add(response); + mTaskQueue->add(response); + mRemoteTaskConnectionAlive = false; return Status::CANCELLED; } } } - return Status::OK; + // Server stopped, exit the loop. + return Status::CANCELLED; } Status TestWakeupClientServiceImpl::NotifyWakeupRequired(ServerContext* context, const NotifyWakeupRequiredRequest* request, NotifyWakeupRequiredResponse* response) { - if (request->iswakeuprequired() && !mWakeupRequired && !mTaskQueue.isEmpty()) { + printf("NotifyWakeupRequired called\n"); + if (request->iswakeuprequired() && !mWakeupRequired && !mTaskQueue->isEmpty()) { // If wakeup is now required and previously not required, this means we have finished // shutting down the device. If there are still pending tasks, try waking up AP again // to finish executing those tasks. wakeupApplicationProcessor(); } mWakeupRequired = request->iswakeuprequired(); + if (mWakeupRequired) { + // We won't know the connection is down unless we try to send a task over. If wakeup is + // required, the connection is very likely already down. + mRemoteTaskConnectionAlive = false; + } return Status::OK; } -void TestWakeupClientServiceImpl::wakeupApplicationProcessor() { - wakeupAp(); +void TestWakeupClientServiceImpl::cleanupScheduledTaskLocked(const std::string& clientId, + const std::string& scheduleId) { + mInfoByScheduleIdByClientId[clientId].erase(scheduleId); + if (mInfoByScheduleIdByClientId[clientId].size() == 0) { + mInfoByScheduleIdByClientId.erase(clientId); + } +} + +TaskScheduleMsgHandler::TaskScheduleMsgHandler(TestWakeupClientServiceImpl* impl) : mImpl(impl) {} + +void TaskScheduleMsgHandler::handleMessage(const android::Message& message) { + mImpl->handleAddTask(message.what); +} + +Status TestWakeupClientServiceImpl::ScheduleTask(ServerContext* context, + const ScheduleTaskRequest* request, + ScheduleTaskResponse* response) { + std::lock_guard lockGuard(mLock); + + const GrpcScheduleInfo& grpcScheduleInfo = request->scheduleinfo(); + const std::string& scheduleId = grpcScheduleInfo.scheduleid(); + const std::string& clientId = grpcScheduleInfo.clientid(); + response->set_errorcode(ErrorCode::OK); + + if (mInfoByScheduleIdByClientId.find(clientId) != mInfoByScheduleIdByClientId.end() && + mInfoByScheduleIdByClientId[clientId].find(scheduleId) != + mInfoByScheduleIdByClientId[clientId].end()) { + printf("Duplicate schedule Id: %s for client Id: %s\n", scheduleId.c_str(), + clientId.c_str()); + response->set_errorcode(ErrorCode::INVALID_ARG); + return Status::OK; + } + + int64_t startTimeInEpochSeconds = grpcScheduleInfo.starttimeinepochseconds(); + int64_t periodicInSeconds = grpcScheduleInfo.periodicinseconds(); + int32_t count = grpcScheduleInfo.count(); + + int scheduleMsgId = mScheduleMsgCounter++; + mInfoByScheduleIdByClientId[clientId][scheduleId] = { + .grpcScheduleInfo = std::make_unique(grpcScheduleInfo), + .scheduleMsgId = scheduleMsgId, + .periodicInSeconds = periodicInSeconds, + .currentCount = 0, + .totalCount = count, + }; + + int64_t delayInSeconds = + startTimeInEpochSeconds - std::chrono::duration_cast( + std::chrono::system_clock::now().time_since_epoch()) + .count(); + if (delayInSeconds < 0) { + delayInSeconds = 0; + } + + printf("ScheduleTask called with client Id: %s, schedule Id: %s, delay: %" PRId64 " s\n", + clientId.c_str(), scheduleId.c_str(), delayInSeconds); + + mLooper->sendMessageDelayed(sToNs(delayInSeconds), mTaskScheduleMsgHandler, + android::Message(scheduleMsgId)); + + return Status::OK; +} + +bool TestWakeupClientServiceImpl::getScheduleInfoLocked(int scheduleMsgId, + ScheduleInfo** outScheduleInfoPtr) { + for (auto& [_, infoByScheduleId] : mInfoByScheduleIdByClientId) { + for (auto& [_, scheduleInfo] : infoByScheduleId) { + if (scheduleInfo.scheduleMsgId == scheduleMsgId) { + *outScheduleInfoPtr = &scheduleInfo; + return true; + } + } + } + return false; +} + +void TestWakeupClientServiceImpl::handleAddTask(int scheduleMsgId) { + std::lock_guard lockGuard(mLock); + + ScheduleInfo* scheduleInfoPtr; + bool found = getScheduleInfoLocked(scheduleMsgId, &scheduleInfoPtr); + if (!found) { + printf("The schedule msg Id: %d is not found\n", scheduleMsgId); + return; + } + + const GrpcScheduleInfo& grpcScheduleInfo = *scheduleInfoPtr->grpcScheduleInfo; + const std::string scheduleId = grpcScheduleInfo.scheduleid(); + const std::string clientId = grpcScheduleInfo.clientid(); + + GetRemoteTasksResponse injectResponse; + injectResponse.set_data(grpcScheduleInfo.data().data(), grpcScheduleInfo.data().size()); + injectResponse.set_clientid(clientId); + injectTaskResponse(injectResponse); + scheduleInfoPtr->currentCount++; + + printf("Sending scheduled tasks for scheduleId: %s, clientId: %s, taskCount: %d\n", + scheduleId.c_str(), clientId.c_str(), scheduleInfoPtr->currentCount); + + if (scheduleInfoPtr->totalCount != 0 && + scheduleInfoPtr->currentCount == scheduleInfoPtr->totalCount) { + // This schedule is finished. + cleanupScheduledTaskLocked(clientId, scheduleId); + return; + } + + // Schedule the task for the next period. + mLooper->sendMessageDelayed(sToNs(scheduleInfoPtr->periodicInSeconds), mTaskScheduleMsgHandler, + android::Message(scheduleMsgId)); +} + +Status TestWakeupClientServiceImpl::UnscheduleTask(ServerContext* context, + const UnscheduleTaskRequest* request, + UnscheduleTaskResponse* response) { + std::lock_guard lockGuard(mLock); + + const std::string& clientId = request->clientid(); + const std::string& scheduleId = request->scheduleid(); + printf("UnscheduleTask called with client Id: %s, schedule Id: %s\n", clientId.c_str(), + scheduleId.c_str()); + + if (mInfoByScheduleIdByClientId.find(clientId) == mInfoByScheduleIdByClientId.end() || + mInfoByScheduleIdByClientId[clientId].find(scheduleId) == + mInfoByScheduleIdByClientId[clientId].end()) { + printf("UnscheduleTask: no task associated with clientId: %s, scheduleId: %s\n", + clientId.c_str(), scheduleId.c_str()); + return Status::OK; + } + + mLooper->removeMessages(mTaskScheduleMsgHandler, + mInfoByScheduleIdByClientId[clientId][scheduleId].scheduleMsgId); + cleanupScheduledTaskLocked(clientId, scheduleId); + return Status::OK; +} + +Status TestWakeupClientServiceImpl::UnscheduleAllTasks(ServerContext* context, + const UnscheduleAllTasksRequest* request, + UnscheduleAllTasksResponse* response) { + std::lock_guard lockGuard(mLock); + + const std::string& clientId = request->clientid(); + printf("UnscheduleAllTasks called with client Id: %s\n", clientId.c_str()); + if (mInfoByScheduleIdByClientId.find(clientId) == mInfoByScheduleIdByClientId.end()) { + printf("UnscheduleTask: no task associated with clientId: %s\n", clientId.c_str()); + return Status::OK; + } + const auto& infoByScheduleId = mInfoByScheduleIdByClientId[clientId]; + std::vector scheduleMsgIds; + for (const auto& [_, scheduleInfo] : infoByScheduleId) { + mLooper->removeMessages(mTaskScheduleMsgHandler, /*what=*/scheduleInfo.scheduleMsgId); + } + + mInfoByScheduleIdByClientId.erase(clientId); + return Status::OK; +} + +Status TestWakeupClientServiceImpl::IsTaskScheduled(ServerContext* context, + const IsTaskScheduledRequest* request, + IsTaskScheduledResponse* response) { + std::lock_guard lockGuard(mLock); + + const std::string& clientId = request->clientid(); + const std::string& scheduleId = request->scheduleid(); + printf("IsTaskScheduled called with client Id: %s, scheduleId: %s\n", clientId.c_str(), + scheduleId.c_str()); + + if (mInfoByScheduleIdByClientId.find(clientId) == mInfoByScheduleIdByClientId.end()) { + response->set_istaskscheduled(false); + return Status::OK; + } + if (mInfoByScheduleIdByClientId[clientId].find(scheduleId) == + mInfoByScheduleIdByClientId[clientId].end()) { + response->set_istaskscheduled(false); + return Status::OK; + } + response->set_istaskscheduled(true); + return Status::OK; +} + +Status TestWakeupClientServiceImpl::GetAllScheduledTasks(ServerContext* context, + const GetAllScheduledTasksRequest* request, + GetAllScheduledTasksResponse* response) { + const std::string& clientId = request->clientid(); + printf("GetAllScheduledTasks called with client Id: %s\n", clientId.c_str()); + response->clear_allscheduledtasks(); + { + std::unique_lock lk(mLock); + if (mInfoByScheduleIdByClientId.find(clientId) == mInfoByScheduleIdByClientId.end()) { + return Status::OK; + } + for (const auto& [_, scheduleInfo] : mInfoByScheduleIdByClientId[clientId]) { + (*response->add_allscheduledtasks()) = *scheduleInfo.grpcScheduleInfo; + } + } + return Status::OK; +} + +bool TestWakeupClientServiceImpl::isWakeupRequired() { + return mWakeupRequired; +} + +bool TestWakeupClientServiceImpl::isRemoteTaskConnectionAlive() { + return mRemoteTaskConnectionAlive; } } // namespace remoteaccess diff --git a/automotive/remoteaccess/test_grpc_server/impl/src/main.cpp b/automotive/remoteaccess/test_grpc_server/impl/src/main.cpp index d3f519cef7c226d8ea304ff5c5f4dbd24502bf07..5443ad9c36a500b95cfa6ecf4ec5aa27ecb84e3f 100644 --- a/automotive/remoteaccess/test_grpc_server/impl/src/main.cpp +++ b/automotive/remoteaccess/test_grpc_server/impl/src/main.cpp @@ -14,7 +14,17 @@ * limitations under the License. */ +#include +#include +#include +#include +#include #include +#include + +#ifndef HOST +#include "ApPowerControl.h" +#endif // #ifndef HOST #include "TestWakeupClientServiceImpl.h" @@ -28,10 +38,18 @@ using ::grpc::Server; using ::grpc::ServerBuilder; using ::grpc::ServerWriter; -void RunServer(const std::string& serviceAddr) { - std::shared_ptr service = - std::make_unique(); +constexpr int SHUTDOWN_REQUEST = 289410889; +constexpr int VEHICLE_IN_USE = 287313738; +const char* COMMAND_RUN_EMU = "source ~/.aae-toolbox/bin/bashrc && aae emulator run"; +const char* COMMAND_SET_VHAL_PROP = + "adb -s emulator-5554 wait-for-device && adb -s emulator-5554 root " + "&& sleep 1 && adb -s emulator-5554 wait-for-device && adb -s emulator-5554 shell " + "dumpsys android.hardware.automotive.vehicle.IVehicle/default --set %d -i %d"; + +pid_t emuPid = 0; +void RunServer(const std::string& serviceAddr, + std::shared_ptr service) { ServerBuilder builder; builder.AddListeningPort(serviceAddr, grpc::InsecureServerCredentials()); builder.RegisterService(service.get()); @@ -40,11 +58,228 @@ void RunServer(const std::string& serviceAddr) { server->Wait(); } +pid_t runCommand(const char* bashCommand) { + pid_t pid = fork(); + if (pid == 0) { + // In child process. Put it into a separate process group so we can kill it. + setpgid(0, 0); + execl("/bin/bash", "bash", "-c", bashCommand, /*terminateArg=*/nullptr); + exit(0); + } else { + return pid; + } +} + +void updateEmuStatus() { + if (emuPid == 0) { + return; + } + pid_t pid = waitpid(emuPid, nullptr, WNOHANG); + if (pid == emuPid) { + // Emu process already exited. If Emu process is still running, pid will be 0. + emuPid = 0; + } +} + +bool powerOnEmu() { + updateEmuStatus(); + if (emuPid != 0) { + printf("The emulator is already running\n"); + return false; + } + emuPid = runCommand(COMMAND_RUN_EMU); + printf("Emulator started in process: %d\n", emuPid); + return true; +} + +bool powerOn() { +#ifdef HOST + return powerOnEmu(); +#else + printf("power on is only supported on host\n"); + return false; +#endif +} + +const char* getSetPropCommand(int propId, int value) { + int size = snprintf(nullptr, 0, COMMAND_SET_VHAL_PROP, propId, value); + char* command = new char[size + 1]; + snprintf(command, size + 1, COMMAND_SET_VHAL_PROP, propId, value); + return command; +} + +const char* getSetPropCommand(int propId) { + return getSetPropCommand(propId, /*value=*/1); +} + +void powerOffEmu() { + updateEmuStatus(); + if (emuPid == 0) { + printf("The emulator is not running\n"); + return; + } + const char* command = getSetPropCommand(SHUTDOWN_REQUEST); + runCommand(command); + delete[] command; + waitpid(emuPid, nullptr, /*options=*/0); + emuPid = 0; +} + +void powerOff() { +#ifdef HOST + powerOffEmu(); +#else + printf("power off is only supported on host\n"); +#endif +} + +void setVehicleInUse(bool vehicleInUse) { +#ifdef HOST + printf("Set vehicleInUse to %d\n", vehicleInUse); + int value = 0; + if (vehicleInUse) { + value = 1; + } + const char* command = getSetPropCommand(VEHICLE_IN_USE, value); + runCommand(command); + delete[] command; +#else + printf("set vehicleInUse is only supported on host\n"); +#endif +} + +void help() { + std::cout << "Remote Access Host Test Utility" << std::endl + << "help:\t" + << "Print out this help info" << std::endl + << "genFakeTask start [clientID]:\t" + << "Start generating a fake task every 5s" << std::endl + << "genFakeTask stop:\t" + << "Stop the fake task generation" << std::endl + << "status:\t" + << "Print current status" << std::endl + << "power on:\t" + << "Power on the emulator, simulate user enters vehicle while AP is off" + << " (only supported on host)" << std::endl + << "power off:\t" + << "Power off the emulator, simulate user leaves vehicle" + << " (only supported on host)" << std::endl + << "inject task [clientID] [taskData]:\t" + << "Inject a remote task" << std::endl + << "set vehicleInUse:\t" + << "Set vehicle in use, simulate user enter vehicle while boot up for remote task " + << "(only supported on host)" << std::endl; +} + +void parseCommand(const std::string& userInput, + std::shared_ptr service) { + if (userInput == "") { + // ignore empty line. + } else if (userInput == "help") { + help(); + } else if (userInput.rfind("genFakeTask start", 0) == 0) { + std::string clientId; + std::stringstream ss; + ss << userInput; + int i = 0; + while (std::getline(ss, clientId, ' ')) { + i++; + if (i == 3) { + break; + } + } + if (i != 3) { + printf("Missing clientId, see 'help'\n"); + return; + } + service->startGeneratingFakeTask(clientId); + } else if (userInput == "genFakeTask stop") { + service->stopGeneratingFakeTask(); + } else if (userInput == "status") { + printf("isWakeupRequired: %B, isRemoteTaskConnectionAlive: %B\n", + service->isWakeupRequired(), service->isRemoteTaskConnectionAlive()); + } else if (userInput == "power on") { + powerOn(); + } else if (userInput == "power off") { + powerOff(); + } else if (userInput.rfind("inject task", 0) == 0) { + std::stringstream ss; + ss << userInput; + std::string data; + std::string taskData; + std::string clientId; + int i = 0; + while (std::getline(ss, data, ' ')) { + i++; + if (i == 3) { + clientId = data; + } + if (i == 4) { + taskData = data; + } + } + if (taskData == "" || clientId == "") { + printf("Missing taskData or clientId, see 'help'\n"); + return; + } + service->injectTask(taskData, clientId); + printf("Remote task with client ID: %s, data: %s injected\n", clientId.c_str(), + taskData.c_str()); + } else if (userInput == "set vehicleInUse") { + setVehicleInUse(true); + } else { + printf("Unknown command, see 'help'\n"); + } +} + +void saHandler(int signum) { + if (emuPid != 0) { + kill(-emuPid, signum); + waitpid(emuPid, nullptr, /*options=*/0); + // Sleep for 1 seconds to allow emulator to print out logs. + sleep(1); + } + exit(-1); +} + +class MyTestWakeupClientServiceImpl final : public TestWakeupClientServiceImpl { + public: + void wakeupApplicationProcessor() override { +#ifdef HOST + if (powerOnEmu()) { + // If we wake up AP to execute remote task, vehicle in use should be false. + setVehicleInUse(false); + } +#else + wakeupAp(); +#endif + }; +}; + int main(int argc, char** argv) { std::string serviceAddr = GRPC_SERVICE_ADDRESS; if (argc > 1) { serviceAddr = argv[1]; } - RunServer(serviceAddr); + // Let the server thread run, we will force kill the server when we exit the program. + std::shared_ptr service = + std::make_shared(); + std::thread serverThread([serviceAddr, service] { RunServer(serviceAddr, service); }); + + // Register the signal handler for SIGTERM and SIGINT so that we can stop the emulator before + // exit. + struct sigaction sa = {}; + sigemptyset(&sa.sa_mask); + sa.sa_handler = saHandler; + sigaction(SIGTERM, &sa, nullptr); + sigaction(SIGINT, &sa, nullptr); + + // Start processing the user inputs. + std::string userInput; + while (true) { + std::cout << ">>> "; + std::getline(std::cin, userInput); + parseCommand(userInput, service); + } return 0; } diff --git a/automotive/remoteaccess/test_grpc_server/impl/test/TestWakeupClientServiceImplUnitTest.cpp b/automotive/remoteaccess/test_grpc_server/impl/test/TestWakeupClientServiceImplUnitTest.cpp new file mode 100644 index 0000000000000000000000000000000000000000..960020d9956c14d9e16069078d70cf050a0c9e41 --- /dev/null +++ b/automotive/remoteaccess/test_grpc_server/impl/test/TestWakeupClientServiceImplUnitTest.cpp @@ -0,0 +1,339 @@ +/* + * Copyright (C) 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "TestWakeupClientServiceImpl.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace android::hardware::automotive::remoteaccess::test { + +using ::android::base::ScopedLockAssertion; + +using ::grpc::Channel; +using ::grpc::ClientContext; +using ::grpc::Server; +using ::grpc::ServerBuilder; +using ::grpc::Status; + +const std::string kTestClientId = "test client id"; +const std::string kTestScheduleId = "test schedule id"; +const std::vector kTestData = {0xde, 0xad, 0xbe, 0xef}; +constexpr int32_t kTestCount = 1234; +constexpr int64_t kTestStartTimeInEpochSeconds = 2345; +constexpr int64_t kTestPeriodicInSeconds = 123; +const std::string kTestGrpcAddr = "localhost:50051"; + +class MyTestWakeupClientServiceImpl final : public TestWakeupClientServiceImpl { + public: + void wakeupApplicationProcessor() override { + // Do nothing. + } +}; + +class TestWakeupClientServiceImplUnitTest : public ::testing::Test { + public: + virtual void SetUp() override { + mServerThread = std::thread([this] { + { + std::unique_lock lock(mLock); + mService = std::make_unique(); + ServerBuilder builder; + builder.AddListeningPort(kTestGrpcAddr, grpc::InsecureServerCredentials()); + builder.RegisterService(mService.get()); + mServer = builder.BuildAndStart(); + mServerStartCv.notify_one(); + } + mServer->Wait(); + }); + { + std::unique_lock lock(mLock); + mServerStartCv.wait(lock, [this] { + ScopedLockAssertion lockAssertion(mLock); + return mServer != nullptr; + }); + } + mChannel = grpc::CreateChannel(kTestGrpcAddr, grpc::InsecureChannelCredentials()); + mStub = WakeupClient::NewStub(mChannel); + } + + virtual void TearDown() override { + printf("Start server shutdown\n"); + mService->stopServer(); + mServer->Shutdown(); + printf("Server shutdown complete\n"); + mServerThread.join(); + printf("Server thread exits\n"); + mServer.reset(); + mService.reset(); + printf("Server and service classes reset\n"); + } + + WakeupClient::Stub* getStub() { return mStub.get(); } + + size_t waitForRemoteTasks(size_t count) { + ClientContext context = {}; + GetRemoteTasksResponse response; + auto reader = mStub->GetRemoteTasks(&context, GetRemoteTasksRequest{}); + size_t got = 0; + while (reader->Read(&response)) { + got++; + mRemoteTaskResponses.push_back(response); + if (got == count) { + break; + } + } + // If there is more messages to be read in the reader, cancel them all so that we can + // finish. + context.TryCancel(); + reader->Finish(); + return got; + } + + std::vector getRemoteTaskResponses() { return mRemoteTaskResponses; } + + Status scheduleTask(int32_t count, int64_t startTimeInEpochSeconds, int64_t periodicInSeconds) { + return scheduleTask(kTestScheduleId, count, startTimeInEpochSeconds, periodicInSeconds); + } + + Status scheduleTask(const std::string& scheduleId, int32_t count, + int64_t startTimeInEpochSeconds, int64_t periodicInSeconds) { + ClientContext context; + ScheduleTaskRequest request; + ScheduleTaskResponse response; + int64_t now = std::chrono::duration_cast( + std::chrono::system_clock::now().time_since_epoch()) + .count(); + request.mutable_scheduleinfo()->set_clientid(kTestClientId); + request.mutable_scheduleinfo()->set_scheduleid(scheduleId); + request.mutable_scheduleinfo()->set_data(kTestData.data(), kTestData.size()); + request.mutable_scheduleinfo()->set_count(count); + request.mutable_scheduleinfo()->set_starttimeinepochseconds(startTimeInEpochSeconds); + request.mutable_scheduleinfo()->set_periodicinseconds(periodicInSeconds); + + return getStub()->ScheduleTask(&context, request, &response); + } + + int64_t getNow() { + return std::chrono::duration_cast( + std::chrono::system_clock::now().time_since_epoch()) + .count(); + } + + private: + std::condition_variable mServerStartCv; + std::mutex mLock; + std::thread mServerThread; + std::unique_ptr mService; + std::unique_ptr mServer; + std::shared_ptr mChannel; + std::unique_ptr mStub; + std::vector mRemoteTaskResponses; +}; + +TEST_F(TestWakeupClientServiceImplUnitTest, TestScheduleTask) { + ClientContext context = {}; + ScheduleTaskRequest request = {}; + ScheduleTaskResponse response = {}; + + request.mutable_scheduleinfo()->set_clientid(kTestClientId); + request.mutable_scheduleinfo()->set_scheduleid(kTestScheduleId); + request.mutable_scheduleinfo()->set_data(kTestData.data(), kTestData.size()); + request.mutable_scheduleinfo()->set_count(2); + // Schedule the task to be executed 1s later. + request.mutable_scheduleinfo()->set_starttimeinepochseconds(getNow() + 1); + request.mutable_scheduleinfo()->set_periodicinseconds(1); + + Status status = getStub()->ScheduleTask(&context, request, &response); + + ASSERT_TRUE(status.ok()); + ASSERT_EQ(response.errorcode(), ErrorCode::OK); + + size_t gotTaskCount = waitForRemoteTasks(/*count=*/2); + + EXPECT_EQ(gotTaskCount, 2); + auto responses = getRemoteTaskResponses(); + for (const auto& response : responses) { + EXPECT_EQ(response.clientid(), kTestClientId); + EXPECT_EQ(response.data(), std::string(kTestData.begin(), kTestData.end())); + } +} + +TEST_F(TestWakeupClientServiceImplUnitTest, TestScheduleTask_conflictScheduleId) { + Status status = scheduleTask(/*count=*/2, /*startTimeInEpochSeconds=*/getNow() + 1, + /*periodicInSeconds=*/1); + + ASSERT_TRUE(status.ok()); + + // Schedule the same task again. + ClientContext context = {}; + ScheduleTaskRequest request = {}; + ScheduleTaskResponse response = {}; + + request.mutable_scheduleinfo()->set_clientid(kTestClientId); + request.mutable_scheduleinfo()->set_scheduleid(kTestScheduleId); + request.mutable_scheduleinfo()->set_data(kTestData.data(), kTestData.size()); + request.mutable_scheduleinfo()->set_count(2); + request.mutable_scheduleinfo()->set_starttimeinepochseconds(getNow() + 1); + request.mutable_scheduleinfo()->set_periodicinseconds(1); + + status = getStub()->ScheduleTask(&context, request, &response); + + ASSERT_TRUE(status.ok()); + ASSERT_EQ(response.errorcode(), ErrorCode::INVALID_ARG); +} + +TEST_F(TestWakeupClientServiceImplUnitTest, TestUnscheduleTask) { + Status status = scheduleTask(/*count=*/2, /*startTimeInEpochSeconds=*/getNow() + 1, + /*periodicInSeconds=*/1); + + ASSERT_TRUE(status.ok()); + + ClientContext context; + UnscheduleTaskRequest request; + UnscheduleTaskResponse response; + request.set_clientid(kTestClientId); + request.set_scheduleid(kTestScheduleId); + status = getStub()->UnscheduleTask(&context, request, &response); + + ASSERT_TRUE(status.ok()); + + sleep(2); + + // There should be no remote tasks received after 2s because the task was unscheduled. + EXPECT_EQ(getRemoteTaskResponses().size(), 0); +} + +TEST_F(TestWakeupClientServiceImplUnitTest, TestIsTaskScheduled) { + int64_t startTimeInEpochSeconds = getNow() + 1; + int64_t periodicInSeconds = 1234; + + Status status = scheduleTask(/*count=*/2, startTimeInEpochSeconds, periodicInSeconds); + + ASSERT_TRUE(status.ok()); + + ClientContext context; + IsTaskScheduledRequest request; + IsTaskScheduledResponse response; + request.set_clientid(kTestClientId); + request.set_scheduleid(kTestScheduleId); + status = getStub()->IsTaskScheduled(&context, request, &response); + + ASSERT_TRUE(status.ok()); + EXPECT_TRUE(response.istaskscheduled()); + + ClientContext context2; + IsTaskScheduledRequest request2; + IsTaskScheduledResponse response2; + request.set_clientid(kTestClientId); + request.set_scheduleid("invalid id"); + status = getStub()->IsTaskScheduled(&context2, request2, &response2); + + ASSERT_TRUE(status.ok()); + EXPECT_FALSE(response2.istaskscheduled()); +} + +TEST_F(TestWakeupClientServiceImplUnitTest, TestUnscheduleAllTasks) { + std::string scheduleId1 = "scheduleId1"; + std::string scheduleId2 = "scheduleId2"; + int64_t time1 = getNow(); + int64_t time2 = getNow() + 1; + int64_t periodicInSeconds1 = 1; + int64_t periodicInSeconds2 = 1; + int32_t count1 = 2; + int64_t count2 = 5; + + Status status = scheduleTask(scheduleId1, count1, time1, periodicInSeconds1); + ASSERT_TRUE(status.ok()); + status = scheduleTask(scheduleId2, count2, time2, periodicInSeconds2); + ASSERT_TRUE(status.ok()); + + ClientContext context; + UnscheduleAllTasksRequest request; + UnscheduleAllTasksResponse response; + request.set_clientid(kTestClientId); + status = getStub()->UnscheduleAllTasks(&context, request, &response); + ASSERT_TRUE(status.ok()); + + sleep(2); + + // There should be no remote tasks received after 2s because the tasks were unscheduled. + EXPECT_EQ(getRemoteTaskResponses().size(), 0); +} + +TEST_F(TestWakeupClientServiceImplUnitTest, TestGetAllScheduledTasks) { + std::string scheduleId1 = "scheduleId1"; + std::string scheduleId2 = "scheduleId2"; + int64_t time1 = getNow(); + int64_t time2 = getNow() + 1; + int64_t periodicInSeconds1 = 1; + int64_t periodicInSeconds2 = 1; + int32_t count1 = 2; + int64_t count2 = 5; + + Status status = scheduleTask(scheduleId1, count1, time1, periodicInSeconds1); + ASSERT_TRUE(status.ok()); + status = scheduleTask(scheduleId2, count2, time2, periodicInSeconds2); + ASSERT_TRUE(status.ok()); + + ClientContext context; + GetAllScheduledTasksRequest request; + GetAllScheduledTasksResponse response; + request.set_clientid("invalid client Id"); + status = getStub()->GetAllScheduledTasks(&context, request, &response); + + ASSERT_TRUE(status.ok()); + EXPECT_EQ(response.allscheduledtasks_size(), 0); + + ClientContext context2; + GetAllScheduledTasksRequest request2; + GetAllScheduledTasksResponse response2; + request2.set_clientid(kTestClientId); + status = getStub()->GetAllScheduledTasks(&context2, request2, &response2); + + ASSERT_TRUE(status.ok()); + ASSERT_EQ(response2.allscheduledtasks_size(), 2); + for (int i = 0; i < 2; i++) { + EXPECT_EQ(response2.allscheduledtasks(i).clientid(), kTestClientId); + if (response2.allscheduledtasks(i).scheduleid() == scheduleId1) { + EXPECT_EQ(response2.allscheduledtasks(i).data(), + std::string(kTestData.begin(), kTestData.end())); + EXPECT_EQ(response2.allscheduledtasks(i).count(), count1); + EXPECT_EQ(response2.allscheduledtasks(i).starttimeinepochseconds(), time1); + EXPECT_EQ(response2.allscheduledtasks(i).periodicinseconds(), periodicInSeconds1); + } else { + EXPECT_EQ(response2.allscheduledtasks(i).scheduleid(), scheduleId2); + EXPECT_EQ(response2.allscheduledtasks(i).data(), + std::string(kTestData.begin(), kTestData.end())); + EXPECT_EQ(response2.allscheduledtasks(i).count(), count2); + EXPECT_EQ(response2.allscheduledtasks(i).starttimeinepochseconds(), time2); + EXPECT_EQ(response2.allscheduledtasks(i).periodicinseconds(), periodicInSeconds2); + } + } +} + +} // namespace android::hardware::automotive::remoteaccess::test + +int main(int argc, char** argv) { + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} diff --git a/automotive/remoteaccess/test_grpc_server/lib/Android.bp b/automotive/remoteaccess/test_grpc_server/lib/Android.bp index 7e95f53dfea5f6d0c5e111985ae46d023f4d0955..8391018a30db55708ca5b9c6ba626475738c7840 100644 --- a/automotive/remoteaccess/test_grpc_server/lib/Android.bp +++ b/automotive/remoteaccess/test_grpc_server/lib/Android.bp @@ -26,7 +26,7 @@ package { cc_library_shared { name: "ApPowerControlLib", vendor: true, - srcs: ["*.cpp"], + srcs: ["ApPowerControl.cpp"], local_include_dirs: ["."], export_include_dirs: ["."], } diff --git a/automotive/vehicle/aidl/impl/utils/test/Android.bp b/automotive/remoteaccess/test_grpc_server/lib/ApPowerControlHost.cpp similarity index 66% rename from automotive/vehicle/aidl/impl/utils/test/Android.bp rename to automotive/remoteaccess/test_grpc_server/lib/ApPowerControlHost.cpp index ad9954fbf2b70c0eb729421efd38bfcb8f387cbf..a475b00ecf95fbf605786d04c764b93eff055cc6 100644 --- a/automotive/vehicle/aidl/impl/utils/test/Android.bp +++ b/automotive/remoteaccess/test_grpc_server/lib/ApPowerControlHost.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021 The Android Open Source Project + * Copyright (C) 2023 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,13 +14,10 @@ * limitations under the License. */ -package { - default_applicable_licenses: ["Android-Apache-2.0"], -} +#include "ApPowerControl.h" + +#include -cc_library_headers { - name: "VehicleHalTestUtilHeaders", - vendor: true, - header_libs: ["VehicleHalUtilHeaders"], - export_include_dirs: ["include"], +void wakeupAp() { + printf("Waking up application processor...\n"); } diff --git a/automotive/vehicle/2.0/default/TEST_MAPPING b/automotive/vehicle/2.0/default/TEST_MAPPING index bb58700f623bb917a228f3a586274b408d3cdd02..63ea3d595b6f2e8f3eead0699ceed906f2e2bf8f 100644 --- a/automotive/vehicle/2.0/default/TEST_MAPPING +++ b/automotive/vehicle/2.0/default/TEST_MAPPING @@ -2,7 +2,9 @@ "presubmit": [ { "name": "android.hardware.automotive.vehicle@2.0-manager-unit-tests" - }, + } + ], + "postsubmit": [ { "name": "android.hardware.automotive.vehicle@2.0-default-impl-unit-tests" } diff --git a/automotive/vehicle/2.0/default/common/include/vhal_v2_0/RecurrentTimer.h b/automotive/vehicle/2.0/default/common/include/vhal_v2_0/RecurrentTimer.h index 0ed87422a1ffbf2d8666e0105758c007488c054f..0f5987e25c3b511aebed1c4ec6a5148e5521f051 100644 --- a/automotive/vehicle/2.0/default/common/include/vhal_v2_0/RecurrentTimer.h +++ b/automotive/vehicle/2.0/default/common/include/vhal_v2_0/RecurrentTimer.h @@ -122,21 +122,29 @@ private: } std::unique_lock g(mLock); + // mStopRequested might be set to true after we enter the loop. Must check inside + // the lock to make sure the value will not change before we start the wait. + if (mStopRequested) { + return; + } mCond.wait_until(g, nextEventTime); // nextEventTime can be nanoseconds::max() } } void stop() { - mStopRequested = true; { std::lock_guard g(mLock); mCookieToEventsMap.clear(); + // Even though this is atomic, this must be set inside the lock to make sure we will + // not change this after we check mStopRequested, but before we start the wait. + mStopRequested = true; } mCond.notify_one(); if (mTimerThread.joinable()) { mTimerThread.join(); } } + private: mutable std::mutex mLock; std::thread mTimerThread; diff --git a/automotive/vehicle/2.0/default/common/include/vhal_v2_0/VehiclePropertyStore.h b/automotive/vehicle/2.0/default/common/include/vhal_v2_0/VehiclePropertyStore.h index 6a02cf3cab0196ccd8d0ff6dbd4cc1e8f89ed47f..abbcd35f847d0aef4c5cec4f321b07ec9a9a3b4f 100644 --- a/automotive/vehicle/2.0/default/common/include/vhal_v2_0/VehiclePropertyStore.h +++ b/automotive/vehicle/2.0/default/common/include/vhal_v2_0/VehiclePropertyStore.h @@ -70,6 +70,16 @@ public: * example wasn't registered. */ bool writeValue(const VehiclePropValue& propValue, bool updateStatus); + /* + * Stores provided value. Returns true if value was written returns false if config for + * example wasn't registered. + * + * The property value's timestamp will be set to the current ElapsedRealTimeNano. + */ + bool writeValueWithCurrentTimestamp(VehiclePropValue* propValuePtr, bool updateStatus); + + std::unique_ptr refreshTimestamp(int32_t propId, int32_t areaId); + void removeValue(const VehiclePropValue& propValue); void removeValuesForProperty(int32_t propId); @@ -94,6 +104,8 @@ private: std::unordered_map mConfigs; PropertyMap mPropertyValues; // Sorted map of RecordId : VehiclePropValue. + + bool writeValueLocked(const VehiclePropValue& propValue, bool updateStatus); }; } // namespace V2_0 diff --git a/automotive/vehicle/2.0/default/common/src/VehiclePropertyStore.cpp b/automotive/vehicle/2.0/default/common/src/VehiclePropertyStore.cpp index 6087bfa52608d6172f5f80ddc1d7b687b9a492de..c12904ecbf6e808b52c045c6c9c28acaa0b0f566 100644 --- a/automotive/vehicle/2.0/default/common/src/VehiclePropertyStore.cpp +++ b/automotive/vehicle/2.0/default/common/src/VehiclePropertyStore.cpp @@ -15,6 +15,7 @@ */ #define LOG_TAG "VehiclePropertyStore" #include +#include #include #include "VehiclePropertyStore.h" @@ -41,9 +42,7 @@ void VehiclePropertyStore::registerProperty(const VehiclePropConfig& config, mConfigs.insert({ config.prop, RecordConfig { config, tokenFunc } }); } -bool VehiclePropertyStore::writeValue(const VehiclePropValue& propValue, - bool updateStatus) { - MuxGuard g(mLock); +bool VehiclePropertyStore::writeValueLocked(const VehiclePropValue& propValue, bool updateStatus) { if (!mConfigs.count(propValue.prop)) return false; RecordId recId = getRecordIdLocked(propValue); @@ -68,6 +67,36 @@ bool VehiclePropertyStore::writeValue(const VehiclePropValue& propValue, return true; } +bool VehiclePropertyStore::writeValue(const VehiclePropValue& propValue, bool updateStatus) { + MuxGuard g(mLock); + + return writeValueLocked(propValue, updateStatus); +} + +bool VehiclePropertyStore::writeValueWithCurrentTimestamp(VehiclePropValue* propValuePtr, + bool updateStatus) { + MuxGuard g(mLock); + + propValuePtr->timestamp = elapsedRealtimeNano(); + return writeValueLocked(*propValuePtr, updateStatus); +} + +std::unique_ptr VehiclePropertyStore::refreshTimestamp(int32_t propId, + int32_t areaId) { + MuxGuard g(mLock); + RecordId recId = getRecordIdLocked(VehiclePropValue{ + .prop = propId, + .areaId = areaId, + }); + auto it = mPropertyValues.find(recId); + if (it == mPropertyValues.end()) { + return nullptr; + } + + it->second.timestamp = elapsedRealtimeNano(); + return std::make_unique(it->second); +} + void VehiclePropertyStore::removeValue(const VehiclePropValue& propValue) { MuxGuard g(mLock); RecordId recId = getRecordIdLocked(propValue); diff --git a/automotive/vehicle/2.0/default/impl/vhal_v2_0/BackportedPropertyHelper.h b/automotive/vehicle/2.0/default/impl/vhal_v2_0/BackportedPropertyHelper.h new file mode 100644 index 0000000000000000000000000000000000000000..78ae94058d93c27a10be8c8eb0c2e113e49fd6f8 --- /dev/null +++ b/automotive/vehicle/2.0/default/impl/vhal_v2_0/BackportedPropertyHelper.h @@ -0,0 +1,106 @@ +/* + * Copyright (C) 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// This file contains backported system property definitions and backported enums. + +#pragma once + +namespace android { +namespace hardware { +namespace automotive { +namespace vehicle { +namespace V2_0 { +namespace backportedproperty { + +/** + * Characterization of inputs used for computing location. + * + * This property must indicate what (if any) data and sensor inputs are considered by the system + * when computing the vehicle's location that is shared with Android through the GNSS HAL. + * + * The value must return a collection of bit flags. The bit flags are defined in + * LocationCharacterization. The value must also include exactly one of DEAD_RECKONED or + * RAW_GNSS_ONLY among its collection of bit flags. + * + * When this property is not supported, it is assumed that no additional sensor inputs are fused + * into the GNSS updates provided through the GNSS HAL. That is unless otherwise specified + * through the GNSS HAL interfaces. + * + * @change_mode VehiclePropertyChangeMode.STATIC + * @access VehiclePropertyAccess.READ + */ +constexpr int32_t LOCATION_CHARACTERIZATION = 0x31400C10; + +/** + * Used by LOCATION_CHARACTERIZATION to enumerate the supported bit flags. + * + * These flags are used to indicate to what transformations are performed on the + * GNSS data before the location data is sent, so that location processing + * algorithms can take into account prior fusion. + * + * This enum can be extended in future releases to include additional bit flags. + */ +enum class LocationCharacterization : int32_t { + /** + * Prior location samples have been used to refine the raw GNSS data (e.g. a + * Kalman Filter). + */ + PRIOR_LOCATIONS = 0x1, + /** + * Gyroscope data has been used to refine the raw GNSS data. + */ + GYROSCOPE_FUSION = 0x2, + /** + * Accelerometer data has been used to refine the raw GNSS data. + */ + ACCELEROMETER_FUSION = 0x4, + /** + * Compass data has been used to refine the raw GNSS data. + */ + COMPASS_FUSION = 0x8, + /** + * Wheel speed has been used to refine the raw GNSS data. + */ + WHEEL_SPEED_FUSION = 0x10, + /** + * Steering angle has been used to refine the raw GNSS data. + */ + STEERING_ANGLE_FUSION = 0x20, + /** + * Car speed has been used to refine the raw GNSS data. + */ + CAR_SPEED_FUSION = 0x40, + /** + * Some effort is made to dead-reckon location. In particular, this means that + * relative changes in location have meaning when no GNSS satellite is + * available. + */ + DEAD_RECKONED = 0x80, + /** + * Location is based on GNSS satellite signals without sufficient fusion of + * other sensors for complete dead reckoning. This flag should be set when + * relative changes to location cannot be relied on when no GNSS satellite is + * available. + */ + RAW_GNSS_ONLY = 0x100, +}; + +} // namespace backportedproperty +} // namespace V2_0 +} // namespace vehicle +} // namespace automotive +} // namespace hardware +} // namespace android diff --git a/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultConfig.h b/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultConfig.h index cfa3b0cd399df6272d18a9ceb2249646e83439f1..4846bfb00a5392ea6baa811578a566b001f0ca23 100644 --- a/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultConfig.h +++ b/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultConfig.h @@ -17,6 +17,7 @@ #ifndef android_hardware_automotive_vehicle_V2_0_impl_DefaultConfig_H_ #define android_hardware_automotive_vehicle_V2_0_impl_DefaultConfig_H_ +#include "BackportedPropertyHelper.h" #include "PropertyUtils.h" #include @@ -29,6 +30,9 @@ namespace V2_0 { namespace impl { +using ::android::hardware::automotive::vehicle::V2_0::backportedproperty::LOCATION_CHARACTERIZATION; +using ::android::hardware::automotive::vehicle::V2_0::backportedproperty::LocationCharacterization; + struct ConfigDeclaration { VehiclePropConfig config; @@ -938,7 +942,10 @@ const ConfigDeclaration kVehicleProperties[]{ (int)VehicleVendorPermission::PERMISSION_NOT_ACCESSIBLE, VENDOR_EXTENSION_FLOAT_PROPERTY, (int)VehicleVendorPermission::PERMISSION_DEFAULT, - (int)VehicleVendorPermission::PERMISSION_DEFAULT}, + (int)VehicleVendorPermission::PERMISSION_DEFAULT, + LOCATION_CHARACTERIZATION, + (int)VehicleVendorPermission::PERMISSION_GET_VENDOR_CATEGORY_INFO, + (int)VehicleVendorPermission::PERMISSION_NOT_ACCESSIBLE}, }, .initialValue = {.int32Values = {1}}}, @@ -1131,6 +1138,15 @@ const ConfigDeclaration kVehicleProperties[]{ // GsrComplianceRequirementType::GSR_COMPLIANCE_REQUIRED_V1 .initialValue = {.int32Values = {1}}, }, + { + .config = + { + .prop = LOCATION_CHARACTERIZATION, + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::STATIC, + }, + .initialValue = {.int32Values = {toInt(LocationCharacterization::RAW_GNSS_ONLY)}}, + }, #ifdef ENABLE_VENDOR_CLUSTER_PROPERTY_FOR_TESTING // Vendor propetry for E2E ClusterHomeService testing. { @@ -1195,29 +1211,131 @@ const ConfigDeclaration kVehicleProperties[]{ }, // All supported property IDs. This list is checked by // DefaultConfigSupportedPropertyIds_test. - .initialValue = - {.int32Values = - {291504388, 289472773, 291504390, 289472775, 289407240, 289407241, - 289472780, 286261505, 286261506, 289407235, 289472779, 291504647, - 289408517, 356518832, 356516106, 291504644, 291504649, 291504656, - 291504901, 291504903, 287310600, 291504905, 287310602, 287310603, - 291504908, 291504904, 392168201, 392168202, 289408514, 289408001, - 287310850, 287310851, 287310853, 289408513, 289475088, 289475104, - 289475120, 354419984, 320865540, 320865556, 354419975, 354419976, - 354419986, 354419973, 354419974, 354419978, 354419977, 356517120, - 356517121, 356582673, 356517139, 289408269, 356517131, 358614275, - 291570965, 291505923, 289408270, 289408512, 287310855, 289408000, - 289408008, 289408009, 289407747, 291504900, 568332561, 371198722, - 373295872, 320867268, 322964416, 290521862, 287310858, 287310859, - 289475072, 289475073, 289409539, 299896064, 299896065, 299896066, - 299896067, 289410560, 289410561, 289410562, 289410563, 289410576, - 289410577, 289410578, 289410579, 289476368, 299895808, 639631617, - 627048706, 591397123, 554696964, 289410873, 289410874, 287313669, - 299896583, 299896584, 299896585, 299896586, 299896587, 286265121, - 286265122, 286265123, 290457094, 290459441, 299896626, 290459443, - 289410868, 289476405, 299896630, 289410871, 292556600, 557853201, - 559950353, 555756049, 554707473, 289410887, 557846324, 557911861, - 568332086, 557846327, 560992056, 289476424}}, + .initialValue = {.int32Values = {291504388, + 289472773, + 291504390, + 289472775, + 289407240, + 289407241, + 289472780, + 286261505, + 286261506, + 289407235, + 289472779, + 291504647, + 289408517, + 356518832, + 356516106, + 291504644, + 291504649, + 291504656, + 291504901, + 291504903, + 287310600, + 291504905, + 287310602, + 287310603, + 291504908, + 291504904, + 392168201, + 392168202, + 289408514, + 289408001, + 287310850, + 287310851, + 287310853, + 289408513, + 289475088, + 289475104, + 289475120, + 354419984, + 320865540, + 320865556, + 354419975, + 354419976, + 354419986, + 354419973, + 354419974, + 354419978, + 354419977, + 356517120, + 356517121, + 356582673, + 356517139, + 289408269, + 356517131, + 358614275, + 291570965, + 291505923, + 289408270, + 289408512, + 287310855, + 289408000, + 289408008, + 289408009, + 289407747, + 291504900, + 568332561, + 371198722, + 373295872, + 320867268, + 322964416, + 290521862, + 287310858, + 287310859, + 289475072, + 289475073, + 289409539, + 299896064, + 299896065, + 299896066, + 299896067, + 289410560, + 289410561, + 289410562, + 289410563, + 289410576, + 289410577, + 289410578, + 289410579, + 289476368, + 299895808, + 639631617, + 627048706, + 591397123, + 554696964, + 289410873, + 289410874, + 287313669, + 299896583, + 299896584, + 299896585, + 299896586, + 299896587, + 286265121, + 286265122, + 286265123, + 290457094, + 290459441, + 299896626, + 290459443, + 289410868, + 289476405, + 299896630, + 289410871, + 292556600, + 557853201, + 559950353, + 555756049, + 554707473, + 289410887, + 557846324, + 557911861, + 568332086, + 557846327, + 560992056, + 289476424, + LOCATION_CHARACTERIZATION}}, }, #endif // ENABLE_GET_PROP_CONFIGS_BY_MULTIPLE_REQUESTS }; diff --git a/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultVehicleHal.cpp b/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultVehicleHal.cpp index 318e9ddade49f9c23b553cc07d88f79d151c7dc9..b56a1907c83660e45d93b14235df6081a152ec4a 100644 --- a/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultVehicleHal.cpp +++ b/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultVehicleHal.cpp @@ -57,12 +57,6 @@ const VehicleAreaConfig* getAreaConfig(const VehiclePropValue& propValue, return nullptr; } -VehicleHal::VehiclePropValuePtr addTimestamp(VehicleHal::VehiclePropValuePtr v) { - if (v.get()) { - v->timestamp = elapsedRealtimeNano(); - } - return v; -} } // namespace VehicleHal::VehiclePropValuePtr DefaultVehicleHal::createVhalHeartBeatProp() { @@ -102,7 +96,7 @@ VehicleHal::VehiclePropValuePtr DefaultVehicleHal::getUserHalProp( *outStatus = StatusCode::INTERNAL_ERROR; } } - return addTimestamp(std::move(v)); + return v; } VehicleHal::VehiclePropValuePtr DefaultVehicleHal::get(const VehiclePropValue& requestedPropValue, @@ -118,13 +112,13 @@ VehicleHal::VehiclePropValuePtr DefaultVehicleHal::get(const VehiclePropValue& r if (propId == OBD2_FREEZE_FRAME) { v = getValuePool()->obtainComplex(); *outStatus = fillObd2FreezeFrame(mPropStore, requestedPropValue, v.get()); - return addTimestamp(std::move(v)); + return v; } if (propId == OBD2_FREEZE_FRAME_INFO) { v = getValuePool()->obtainComplex(); *outStatus = fillObd2DtcInfo(mPropStore, v.get()); - return addTimestamp(std::move(v)); + return v; } auto internalPropValue = mPropStore->readValueOrNull(requestedPropValue); @@ -139,7 +133,7 @@ VehicleHal::VehiclePropValuePtr DefaultVehicleHal::get(const VehiclePropValue& r } else { *outStatus = StatusCode::TRY_AGAIN; } - return addTimestamp(std::move(v)); + return v; } std::vector DefaultVehicleHal::listProperties() { @@ -486,26 +480,42 @@ VehicleHal::VehiclePropValuePtr DefaultVehicleHal::doInternalHealthCheck() { void DefaultVehicleHal::onContinuousPropertyTimer(const std::vector& properties) { auto& pool = *getValuePool(); - for (int32_t property : properties) { - VehiclePropValuePtr v; + std::vector events; if (isContinuousProperty(property)) { - auto internalPropValue = mPropStore->readValueOrNull(property); - if (internalPropValue != nullptr) { - v = pool.obtain(*internalPropValue); + const VehiclePropConfig* config = mPropStore->getConfigOrNull(property); + std::vector areaIds; + if (isGlobalProp(property)) { + areaIds.push_back(0); + } else { + for (auto& c : config->areaConfigs) { + areaIds.push_back(c.areaId); + } + } + + for (int areaId : areaIds) { + auto v = pool.obtain(*mPropStore->refreshTimestamp(property, areaId)); + if (v.get()) { + events.push_back(std::move(v)); + } } } else if (property == static_cast(VehicleProperty::VHAL_HEARTBEAT)) { // VHAL_HEARTBEAT is not a continuous value, but it needs to be updated periodically. // So, the update is done through onContinuousPropertyTimer. - v = doInternalHealthCheck(); + auto v = doInternalHealthCheck(); + if (!v.get()) { + // Internal health check failed. + continue; + } + mPropStore->writeValueWithCurrentTimestamp(v.get(), /*updateStatus=*/true); + events.push_back(std::move(v)); } else { ALOGE("Unexpected onContinuousPropertyTimer for property: 0x%x", property); continue; } - if (v.get()) { - v->timestamp = elapsedRealtimeNano(); - doHalEvent(std::move(v)); + for (VehiclePropValuePtr& event : events) { + doHalEvent(std::move(event)); } } } @@ -556,7 +566,7 @@ bool DefaultVehicleHal::isContinuousProperty(int32_t propId) const { void DefaultVehicleHal::onPropertyValue(const VehiclePropValue& value, bool updateStatus) { VehiclePropValuePtr updatedPropValue = getValuePool()->obtain(value); - if (mPropStore->writeValue(*updatedPropValue, updateStatus)) { + if (mPropStore->writeValueWithCurrentTimestamp(updatedPropValue.get(), updateStatus)) { doHalEvent(std::move(updatedPropValue)); } } diff --git a/automotive/vehicle/2.0/default/impl/vhal_v2_0/tests/DefaultVhalImpl_test.cpp b/automotive/vehicle/2.0/default/impl/vhal_v2_0/tests/DefaultVhalImpl_test.cpp index edd4484016eae0bead3a0052a1e8565100ef2211..c876836783fa1391235576fd3afcbcc57bc58bb3 100644 --- a/automotive/vehicle/2.0/default/impl/vhal_v2_0/tests/DefaultVhalImpl_test.cpp +++ b/automotive/vehicle/2.0/default/impl/vhal_v2_0/tests/DefaultVhalImpl_test.cpp @@ -81,8 +81,13 @@ using ::android::hardware::automotive::vehicle::V2_0::impl::OBD2_FREEZE_FRAME; using ::android::hardware::automotive::vehicle::V2_0::impl::OBD2_FREEZE_FRAME_CLEAR; using ::android::hardware::automotive::vehicle::V2_0::impl::OBD2_FREEZE_FRAME_INFO; using ::android::hardware::automotive::vehicle::V2_0::impl::OBD2_LIVE_FRAME; +using ::android::hardware::automotive::vehicle::V2_0::impl::WHEEL_FRONT_LEFT; +using ::android::hardware::automotive::vehicle::V2_0::impl::WHEEL_FRONT_RIGHT; +using ::android::hardware::automotive::vehicle::V2_0::impl::WHEEL_REAR_LEFT; +using ::android::hardware::automotive::vehicle::V2_0::impl::WHEEL_REAR_RIGHT; using ::testing::HasSubstr; +using ::testing::UnorderedElementsAre; using VehiclePropValuePtr = recyclable_ptr; @@ -152,7 +157,7 @@ class DefaultVhalImplTest : public ::testing::Test { TEST_F(DefaultVhalImplTest, testListProperties) { std::vector configs = mHal->listProperties(); - EXPECT_EQ((size_t)124, configs.size()); + EXPECT_EQ((size_t)125, configs.size()); } TEST_F(DefaultVhalImplTest, testGetDefaultPropertyFloat) { @@ -346,6 +351,38 @@ TEST_F(DefaultVhalImplTest, testSubscribe) { EXPECT_EQ(1.0f, lastEvent->value.floatValues[0]); } +TEST_F(DefaultVhalImplTest, testSubscribeContinuous_withMultipleAreaIds) { + // Clear existing events. + mEventQueue.flush(); + int propId = toInt(VehicleProperty::TIRE_PRESSURE); + + auto status = mHal->subscribe(propId, 1); + + ASSERT_EQ(StatusCode::OK, status); + + std::vector receivedEvents; + // Wait for 2 updates, each for 4 area IDs. + waitForEvents(&receivedEvents, 4 * 2); + + std::vector areasForUpdate1; + std::vector areasForUpdate2; + + for (size_t i = 0; i < receivedEvents.size(); i++) { + ASSERT_EQ(receivedEvents[i]->prop, propId); + + if (i < 4) { + areasForUpdate1.push_back(receivedEvents[i]->areaId); + } else { + areasForUpdate2.push_back(receivedEvents[i]->areaId); + } + } + + ASSERT_THAT(areasForUpdate1, UnorderedElementsAre(WHEEL_FRONT_LEFT, WHEEL_FRONT_RIGHT, + WHEEL_REAR_LEFT, WHEEL_REAR_RIGHT)); + ASSERT_THAT(areasForUpdate2, UnorderedElementsAre(WHEEL_FRONT_LEFT, WHEEL_FRONT_RIGHT, + WHEEL_REAR_LEFT, WHEEL_REAR_RIGHT)); +} + TEST_F(DefaultVhalImplTest, testSubscribeInvalidProp) { EXPECT_EQ(StatusCode::INVALID_ARG, mHal->subscribe(toInt(VehicleProperty::INFO_MAKE), 10)); } @@ -1318,7 +1355,6 @@ TEST_F(DefaultVhalImplTest, testDebugSetInt) { ASSERT_EQ((size_t)1, events.size()); ASSERT_EQ((size_t)1, events[0]->value.int32Values.size()); EXPECT_EQ(2022, events[0]->value.int32Values[0]); - EXPECT_EQ(1000, events[0]->timestamp); VehiclePropValue value; StatusCode status; @@ -1352,7 +1388,6 @@ TEST_F(DefaultVhalImplTest, testDebugSetBool) { ASSERT_EQ((size_t)1, events.size()); EXPECT_EQ(0, events[0]->value.int32Values[0]); EXPECT_EQ(DOOR_1_LEFT, events[0]->areaId); - EXPECT_EQ(1000, events[0]->timestamp); VehiclePropValue value; StatusCode status; @@ -1391,7 +1426,6 @@ TEST_F(DefaultVhalImplTest, testDebugSetFloat) { ASSERT_EQ((size_t)1, events.size()); ASSERT_EQ((size_t)1, events[0]->value.floatValues.size()); EXPECT_EQ(10.5, events[0]->value.floatValues[0]); - EXPECT_EQ(1000, events[0]->timestamp); VehiclePropValue value; StatusCode status; diff --git a/automotive/vehicle/Android.bp b/automotive/vehicle/Android.bp index c0d71d7dac4f0512235f037cd48a905f1c475523..3549519ead8506f242a5dd88b43518ec5d8b18fe 100644 --- a/automotive/vehicle/Android.bp +++ b/automotive/vehicle/Android.bp @@ -21,7 +21,7 @@ package { cc_defaults { name: "VehicleHalInterfaceDefaults", static_libs: [ - "android.hardware.automotive.vehicle-V2-ndk", - "android.hardware.automotive.vehicle.property-V2-ndk", + "android.hardware.automotive.vehicle-V3-ndk", + "android.hardware.automotive.vehicle.property-V3-ndk", ], } diff --git a/automotive/vehicle/TEST_MAPPING b/automotive/vehicle/TEST_MAPPING index da8416cd73ded2c0784b5880a3a8c4150448959d..e1a90cba396012d2df7ca500b42cf2ca668b95b4 100644 --- a/automotive/vehicle/TEST_MAPPING +++ b/automotive/vehicle/TEST_MAPPING @@ -43,6 +43,17 @@ "auto-presubmit": [ { "name": "VtsHalAutomotiveVehicle_TargetTest" + }, + { + "name": "CarServiceUnitTest", + "options" : [ + { + "include-filter": "com.android.car.hal.fakevhal.FakeVehicleStubUnitTest" + } + ] + }, + { + "name": "VehicleHalProtoMessageConverterTest" } ] } diff --git a/automotive/vehicle/aidl/Android.bp b/automotive/vehicle/aidl/Android.bp index 7405d4cc28debfd599305c74eb3ac6dc07a2e38a..5ca1fc8262b140e00e4b20383e85fd7254b99774 100644 --- a/automotive/vehicle/aidl/Android.bp +++ b/automotive/vehicle/aidl/Android.bp @@ -27,7 +27,7 @@ aidl_interface { srcs: [ "android/hardware/automotive/vehicle/*.aidl", ], - frozen: true, + frozen: false, stability: "vintf", backend: { cpp: { diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/SubscribeOptions.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/SubscribeOptions.aidl index 91e7c1499a54a87e5af10f5e08b04e3f113ebed9..1b1696b240c1920c92d18b5b41632704ebce44b3 100644 --- a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/SubscribeOptions.aidl +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/SubscribeOptions.aidl @@ -37,4 +37,6 @@ parcelable SubscribeOptions { int propId; int[] areaIds; float sampleRate; + float resolution = 0.0f; + boolean enableVariableUpdateRate; } diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleAreaConfig.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleAreaConfig.aidl index 6960894f13f48c599ec34e9f47351a44a4127a23..08d4ee46e8db345509c2a7ec172bbd1d0f639cdb 100644 --- a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleAreaConfig.aidl +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleAreaConfig.aidl @@ -42,4 +42,6 @@ parcelable VehicleAreaConfig { float minFloatValue; float maxFloatValue; @nullable long[] supportedEnumValues; + android.hardware.automotive.vehicle.VehiclePropertyAccess access = android.hardware.automotive.vehicle.VehiclePropertyAccess.NONE; + boolean supportVariableUpdateRate; } diff --git a/automotive/vehicle/aidl/aidl_test/Android.bp b/automotive/vehicle/aidl/aidl_test/Android.bp index d752b2a6df556723418ef96eced4fc881f29e773..bb976af3bd348eb129c59eaf84f7cca8820b1a93 100644 --- a/automotive/vehicle/aidl/aidl_test/Android.bp +++ b/automotive/vehicle/aidl/aidl_test/Android.bp @@ -51,8 +51,8 @@ android_test { ":IVehicleGeneratedJavaFiles", ], static_libs: [ - "android.hardware.automotive.vehicle-V2-java", - "android.hardware.automotive.vehicle.property-V2-java", + "android.hardware.automotive.vehicle-V3-java", + "android.hardware.automotive.vehicle.property-V3-java", "androidx.test.runner", "truth", ], diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/SubscribeOptions.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/SubscribeOptions.aidl index e68f7e3631a008afbdc0b898eba4d508a59f37fa..69f6190363c4bf7ccb1a5e0cbd93cc3cbcabae13 100644 --- a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/SubscribeOptions.aidl +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/SubscribeOptions.aidl @@ -39,4 +39,29 @@ parcelable SubscribeOptions { * This value indicates how many updates per second client wants to receive. */ float sampleRate; + + /** + * Requested resolution of property updates. + * + * This value indicates the resolution at which continuous property updates should be sent to + * the platform. For example, if resolution is 0.01, the subscribed property value should be + * rounded to two decimal places. If the incoming resolution value is not an integer multiple of + * 10, VHAL should return a StatusCode::INVALID_ARG. + */ + float resolution = 0.0f; + + /** + * Whether to enable variable update rate. + * + * This only applies for continuous property. If variable update rate is + * enabled, for each given areaId, if VHAL supports variable update rate for + * the [propId, areaId], VHAL must ignore duplicate property value events + * and only sends changed value events (a.k.a treat continuous as an + * on-change property). + * + * If VHAL does not support variable update rate for the [propId, areaId], + * indicated by 'supportVariableUpdateRate' in 'VehicleAreaConfig', or if + * this property is not a continuous property, this option must be ignored. + */ + boolean enableVariableUpdateRate; } diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleAreaConfig.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleAreaConfig.aidl index 20c046d574d306f5129b8b7c364b2d7317dc6b2a..aab3c46d760257ef986e62c3c410885599ad84ff 100644 --- a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleAreaConfig.aidl +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleAreaConfig.aidl @@ -16,6 +16,8 @@ package android.hardware.automotive.vehicle; +import android.hardware.automotive.vehicle.VehiclePropertyAccess; + @VintfStability @JavaDerive(equals=true, toString=true) parcelable VehicleAreaConfig { @@ -47,4 +49,55 @@ parcelable VehicleAreaConfig { * assumed all @data_enum values are supported unless specified through another mechanism. */ @nullable long[] supportedEnumValues; + + /** + * Defines if the area ID for this property is READ, WRITE or READ_WRITE. This only applies if + * the property is defined in the framework as a READ_WRITE property. Access (if set) should be + * equal to, or a superset of, the VehiclePropConfig.access of the property. + * + * For example, if a property is defined as READ_WRITE, but the OEM wants to specify certain + * area Ids as READ-only, the corresponding areaIds should have an access set to READ, while the + * others must be set to READ_WRITE. We do not support setting specific area Ids to WRITE-only + * when the property is READ-WRITE. + * + * Exclusively one of VehiclePropConfig and the VehicleAreaConfigs should be specified for a + * single property. If VehiclePropConfig.access is populated, none of the + * VehicleAreaConfig.access values should be populated. If VehicleAreaConfig.access values are + * populated, VehiclePropConfig.access must not be populated. + * + * VehicleAreaConfigs should not be partially populated with access. If the OEM wants to specify + * access for one area Id, all other configs should be populated with their access levels as + * well. + */ + VehiclePropertyAccess access = VehiclePropertyAccess.NONE; + + /** + * Whether variable update rate is supported. + * + * This applies for continuous property only. + * + * It is HIGHLY RECOMMENDED to support variable update rate for all non-heartbeat continuous + * properties for better performance unless the property is large. + * + * If variable update rate is supported and 'enableVariableUpdateRate' is true in subscribe + * options, VHAL must only sends property update event when the property's value changes + * (a.k.a treat continuous as an on-change property). + * + * E.g. if the client is subscribing at 5hz at time 0. If the property's value is 0 initially + * and becomes 1 after 1 second. + + * If variable update rate is not enabled, VHAL clients will receive 5 property change events + * with value 0 and 5 events with value 1 after 2 seconds. + * + * If variable update rate is enabled, VHAL clients will receive 1 property change event + * with value 1 at time 1s. VHAL may/may not send a property event for the initial value (e.g. + * a property change event with value 0 at time 0s). VHAL client must not rely on the first + * property event, and must use getValues to fetch the initial value. In fact, car service is + * using getValues to fetch the initial value, convert it to a property event and deliver to + * car service clients. + * + * NOTE: If this is true, car service may cache the property update event for filtering purpose, + * so this should be false if the property is large (e.g. a byte array of 1k in size). + */ + boolean supportVariableUpdateRate; } diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehiclePropConfig.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehiclePropConfig.aidl index 61b936932d53a531510dda2c2bd41797a0abdf56..1135b267bb73855e77ca104774926767b2b0df55 100644 --- a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehiclePropConfig.aidl +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehiclePropConfig.aidl @@ -28,6 +28,10 @@ parcelable VehiclePropConfig { /** * Defines if the property is read or write or both. + * + * If populating VehicleAreaConfig.access fields for this property, this field should not be + * populated. If the OEM decides to populate this field, none of the VehicleAreaConfig.access + * fields should be populated. */ VehiclePropertyAccess access = VehiclePropertyAccess.NONE; diff --git a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h index d0c6e83ebe72deadc2e33d7ffd177f0985192ce0..e7d446484f60f4f1f267cee4d92c249779479999 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 The Android Open Source Project + * Copyright (C) 2023 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -68,9 +68,11 @@ std::unordered_map AccessForVehiclePrope {VehicleProperty::EV_CHARGE_PORT_CONNECTED, VehiclePropertyAccess::READ}, {VehicleProperty::EV_BATTERY_INSTANTANEOUS_CHARGE_RATE, VehiclePropertyAccess::READ}, {VehicleProperty::RANGE_REMAINING, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::EV_BATTERY_AVERAGE_TEMPERATURE, VehiclePropertyAccess::READ}, {VehicleProperty::TIRE_PRESSURE, VehiclePropertyAccess::READ}, {VehicleProperty::CRITICALLY_LOW_TIRE_PRESSURE, VehiclePropertyAccess::READ}, {VehicleProperty::ENGINE_IDLE_AUTO_STOP_ENABLED, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::IMPACT_DETECTED, VehiclePropertyAccess::READ}, {VehicleProperty::GEAR_SELECTION, VehiclePropertyAccess::READ}, {VehicleProperty::CURRENT_GEAR, VehiclePropertyAccess::READ}, {VehicleProperty::PARKING_BRAKE_ON, VehiclePropertyAccess::READ}, @@ -83,6 +85,8 @@ std::unordered_map AccessForVehiclePrope {VehicleProperty::ABS_ACTIVE, VehiclePropertyAccess::READ}, {VehicleProperty::TRACTION_CONTROL_ACTIVE, VehiclePropertyAccess::READ}, {VehicleProperty::EV_STOPPING_MODE, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::ELECTRONIC_STABILITY_CONTROL_ENABLED, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::ELECTRONIC_STABILITY_CONTROL_STATE, VehiclePropertyAccess::READ}, {VehicleProperty::HVAC_FAN_SPEED, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::HVAC_FAN_DIRECTION, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::HVAC_TEMPERATURE_CURRENT, VehiclePropertyAccess::READ}, @@ -120,6 +124,7 @@ std::unordered_map AccessForVehiclePrope {VehicleProperty::AP_POWER_BOOTUP_REASON, VehiclePropertyAccess::READ}, {VehicleProperty::DISPLAY_BRIGHTNESS, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::PER_DISPLAY_BRIGHTNESS, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::VALET_MODE_ENABLED, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::HW_KEY_INPUT, VehiclePropertyAccess::READ}, {VehicleProperty::HW_KEY_INPUT_V2, VehiclePropertyAccess::READ}, {VehicleProperty::HW_MOTION_INPUT, VehiclePropertyAccess::READ}, @@ -169,11 +174,13 @@ std::unordered_map AccessForVehiclePrope {VehicleProperty::SEAT_FOOTWELL_LIGHTS_SWITCH, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::SEAT_EASY_ACCESS_ENABLED, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::SEAT_AIRBAG_ENABLED, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::SEAT_AIRBAGS_DEPLOYED, VehiclePropertyAccess::READ}, {VehicleProperty::SEAT_CUSHION_SIDE_SUPPORT_POS, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::SEAT_CUSHION_SIDE_SUPPORT_MOVE, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::SEAT_LUMBAR_VERTICAL_POS, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::SEAT_LUMBAR_VERTICAL_MOVE, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::SEAT_WALK_IN_POS, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::SEAT_BELT_PRETENSIONER_DEPLOYED, VehiclePropertyAccess::READ}, {VehicleProperty::SEAT_OCCUPANCY, VehiclePropertyAccess::READ}, {VehicleProperty::WINDOW_POS, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::WINDOW_MOVE, VehiclePropertyAccess::READ_WRITE}, @@ -192,6 +199,11 @@ std::unordered_map AccessForVehiclePrope {VehicleProperty::GLOVE_BOX_LOCKED, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::VEHICLE_MAP_SERVICE, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::LOCATION_CHARACTERIZATION, VehiclePropertyAccess::READ}, + {VehicleProperty::ULTRASONICS_SENSOR_POSITION, VehiclePropertyAccess::READ}, + {VehicleProperty::ULTRASONICS_SENSOR_ORIENTATION, VehiclePropertyAccess::READ}, + {VehicleProperty::ULTRASONICS_SENSOR_FIELD_OF_VIEW, VehiclePropertyAccess::READ}, + {VehicleProperty::ULTRASONICS_SENSOR_DETECTION_RANGE, VehiclePropertyAccess::READ}, + {VehicleProperty::ULTRASONICS_SENSOR_SUPPORTED_RANGES, VehiclePropertyAccess::READ}, {VehicleProperty::OBD2_LIVE_FRAME, VehiclePropertyAccess::READ}, {VehicleProperty::OBD2_FREEZE_FRAME, VehiclePropertyAccess::READ}, {VehicleProperty::OBD2_FREEZE_FRAME_INFO, VehiclePropertyAccess::READ}, @@ -247,6 +259,8 @@ std::unordered_map AccessForVehiclePrope {VehicleProperty::SUPPORTED_PROPERTY_IDS, VehiclePropertyAccess::READ}, {VehicleProperty::SHUTDOWN_REQUEST, VehiclePropertyAccess::WRITE}, {VehicleProperty::VEHICLE_IN_USE, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::CLUSTER_HEARTBEAT, VehiclePropertyAccess::WRITE}, + {VehicleProperty::VEHICLE_DRIVING_AUTOMATION_CURRENT_LEVEL, VehiclePropertyAccess::READ}, {VehicleProperty::AUTOMATIC_EMERGENCY_BRAKING_ENABLED, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::AUTOMATIC_EMERGENCY_BRAKING_STATE, VehiclePropertyAccess::READ}, {VehicleProperty::FORWARD_COLLISION_WARNING_ENABLED, VehiclePropertyAccess::READ_WRITE}, @@ -272,6 +286,18 @@ std::unordered_map AccessForVehiclePrope {VehicleProperty::HANDS_ON_DETECTION_ENABLED, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::HANDS_ON_DETECTION_DRIVER_STATE, VehiclePropertyAccess::READ}, {VehicleProperty::HANDS_ON_DETECTION_WARNING, VehiclePropertyAccess::READ}, + {VehicleProperty::DRIVER_DROWSINESS_ATTENTION_SYSTEM_ENABLED, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::DRIVER_DROWSINESS_ATTENTION_STATE, VehiclePropertyAccess::READ}, + {VehicleProperty::DRIVER_DROWSINESS_ATTENTION_WARNING_ENABLED, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::DRIVER_DROWSINESS_ATTENTION_WARNING, VehiclePropertyAccess::READ}, + {VehicleProperty::DRIVER_DISTRACTION_SYSTEM_ENABLED, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::DRIVER_DISTRACTION_STATE, VehiclePropertyAccess::READ}, + {VehicleProperty::DRIVER_DISTRACTION_WARNING_ENABLED, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::DRIVER_DISTRACTION_WARNING, VehiclePropertyAccess::READ}, + {VehicleProperty::LOW_SPEED_COLLISION_WARNING_ENABLED, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::LOW_SPEED_COLLISION_WARNING_STATE, VehiclePropertyAccess::READ}, + {VehicleProperty::CROSS_TRAFFIC_MONITORING_ENABLED, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::CROSS_TRAFFIC_MONITORING_WARNING_STATE, VehiclePropertyAccess::READ}, }; } // namespace vehicle diff --git a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h index 48532c93ca771d479ad304c0222b612fc90899fa..3a46a9245ca5fa78d5ec9b8f89b69c5fb94be3d1 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 The Android Open Source Project + * Copyright (C) 2023 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -68,9 +68,11 @@ std::unordered_map ChangeModeForVehi {VehicleProperty::EV_CHARGE_PORT_CONNECTED, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::EV_BATTERY_INSTANTANEOUS_CHARGE_RATE, VehiclePropertyChangeMode::CONTINUOUS}, {VehicleProperty::RANGE_REMAINING, VehiclePropertyChangeMode::CONTINUOUS}, + {VehicleProperty::EV_BATTERY_AVERAGE_TEMPERATURE, VehiclePropertyChangeMode::CONTINUOUS}, {VehicleProperty::TIRE_PRESSURE, VehiclePropertyChangeMode::CONTINUOUS}, {VehicleProperty::CRITICALLY_LOW_TIRE_PRESSURE, VehiclePropertyChangeMode::STATIC}, {VehicleProperty::ENGINE_IDLE_AUTO_STOP_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::IMPACT_DETECTED, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::GEAR_SELECTION, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::CURRENT_GEAR, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::PARKING_BRAKE_ON, VehiclePropertyChangeMode::ON_CHANGE}, @@ -83,6 +85,8 @@ std::unordered_map ChangeModeForVehi {VehicleProperty::ABS_ACTIVE, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::TRACTION_CONTROL_ACTIVE, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::EV_STOPPING_MODE, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::ELECTRONIC_STABILITY_CONTROL_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::ELECTRONIC_STABILITY_CONTROL_STATE, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::HVAC_FAN_SPEED, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::HVAC_FAN_DIRECTION, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::HVAC_TEMPERATURE_CURRENT, VehiclePropertyChangeMode::ON_CHANGE}, @@ -120,6 +124,7 @@ std::unordered_map ChangeModeForVehi {VehicleProperty::AP_POWER_BOOTUP_REASON, VehiclePropertyChangeMode::STATIC}, {VehicleProperty::DISPLAY_BRIGHTNESS, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::PER_DISPLAY_BRIGHTNESS, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::VALET_MODE_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::HW_KEY_INPUT, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::HW_KEY_INPUT_V2, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::HW_MOTION_INPUT, VehiclePropertyChangeMode::ON_CHANGE}, @@ -169,11 +174,13 @@ std::unordered_map ChangeModeForVehi {VehicleProperty::SEAT_FOOTWELL_LIGHTS_SWITCH, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::SEAT_EASY_ACCESS_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::SEAT_AIRBAG_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::SEAT_AIRBAGS_DEPLOYED, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::SEAT_CUSHION_SIDE_SUPPORT_POS, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::SEAT_CUSHION_SIDE_SUPPORT_MOVE, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::SEAT_LUMBAR_VERTICAL_POS, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::SEAT_LUMBAR_VERTICAL_MOVE, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::SEAT_WALK_IN_POS, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::SEAT_BELT_PRETENSIONER_DEPLOYED, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::SEAT_OCCUPANCY, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::WINDOW_POS, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::WINDOW_MOVE, VehiclePropertyChangeMode::ON_CHANGE}, @@ -192,6 +199,11 @@ std::unordered_map ChangeModeForVehi {VehicleProperty::GLOVE_BOX_LOCKED, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::VEHICLE_MAP_SERVICE, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::LOCATION_CHARACTERIZATION, VehiclePropertyChangeMode::STATIC}, + {VehicleProperty::ULTRASONICS_SENSOR_POSITION, VehiclePropertyChangeMode::STATIC}, + {VehicleProperty::ULTRASONICS_SENSOR_ORIENTATION, VehiclePropertyChangeMode::STATIC}, + {VehicleProperty::ULTRASONICS_SENSOR_FIELD_OF_VIEW, VehiclePropertyChangeMode::STATIC}, + {VehicleProperty::ULTRASONICS_SENSOR_DETECTION_RANGE, VehiclePropertyChangeMode::STATIC}, + {VehicleProperty::ULTRASONICS_SENSOR_SUPPORTED_RANGES, VehiclePropertyChangeMode::STATIC}, {VehicleProperty::OBD2_LIVE_FRAME, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::OBD2_FREEZE_FRAME, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::OBD2_FREEZE_FRAME_INFO, VehiclePropertyChangeMode::ON_CHANGE}, @@ -247,6 +259,8 @@ std::unordered_map ChangeModeForVehi {VehicleProperty::SUPPORTED_PROPERTY_IDS, VehiclePropertyChangeMode::STATIC}, {VehicleProperty::SHUTDOWN_REQUEST, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::VEHICLE_IN_USE, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::CLUSTER_HEARTBEAT, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::VEHICLE_DRIVING_AUTOMATION_CURRENT_LEVEL, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::AUTOMATIC_EMERGENCY_BRAKING_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::AUTOMATIC_EMERGENCY_BRAKING_STATE, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::FORWARD_COLLISION_WARNING_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, @@ -272,6 +286,18 @@ std::unordered_map ChangeModeForVehi {VehicleProperty::HANDS_ON_DETECTION_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::HANDS_ON_DETECTION_DRIVER_STATE, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::HANDS_ON_DETECTION_WARNING, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::DRIVER_DROWSINESS_ATTENTION_SYSTEM_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::DRIVER_DROWSINESS_ATTENTION_STATE, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::DRIVER_DROWSINESS_ATTENTION_WARNING_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::DRIVER_DROWSINESS_ATTENTION_WARNING, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::DRIVER_DISTRACTION_SYSTEM_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::DRIVER_DISTRACTION_STATE, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::DRIVER_DISTRACTION_WARNING_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::DRIVER_DISTRACTION_WARNING, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::LOW_SPEED_COLLISION_WARNING_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::LOW_SPEED_COLLISION_WARNING_STATE, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::CROSS_TRAFFIC_MONITORING_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::CROSS_TRAFFIC_MONITORING_WARNING_STATE, VehiclePropertyChangeMode::ON_CHANGE}, }; } // namespace vehicle diff --git a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java index 758670d588dcad4a900a0c6518cbcca161c5bc90..7b5412f9bcb5ddec20972dba4eed1072c2db0958 100644 --- a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 The Android Open Source Project + * Copyright (C) 2023 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -60,9 +60,11 @@ public final class AccessForVehicleProperty { Map.entry(VehicleProperty.EV_CHARGE_PORT_CONNECTED, VehiclePropertyAccess.READ), Map.entry(VehicleProperty.EV_BATTERY_INSTANTANEOUS_CHARGE_RATE, VehiclePropertyAccess.READ), Map.entry(VehicleProperty.RANGE_REMAINING, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.EV_BATTERY_AVERAGE_TEMPERATURE, VehiclePropertyAccess.READ), Map.entry(VehicleProperty.TIRE_PRESSURE, VehiclePropertyAccess.READ), Map.entry(VehicleProperty.CRITICALLY_LOW_TIRE_PRESSURE, VehiclePropertyAccess.READ), Map.entry(VehicleProperty.ENGINE_IDLE_AUTO_STOP_ENABLED, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.IMPACT_DETECTED, VehiclePropertyAccess.READ), Map.entry(VehicleProperty.GEAR_SELECTION, VehiclePropertyAccess.READ), Map.entry(VehicleProperty.CURRENT_GEAR, VehiclePropertyAccess.READ), Map.entry(VehicleProperty.PARKING_BRAKE_ON, VehiclePropertyAccess.READ), @@ -75,6 +77,8 @@ public final class AccessForVehicleProperty { Map.entry(VehicleProperty.ABS_ACTIVE, VehiclePropertyAccess.READ), Map.entry(VehicleProperty.TRACTION_CONTROL_ACTIVE, VehiclePropertyAccess.READ), Map.entry(VehicleProperty.EV_STOPPING_MODE, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.ELECTRONIC_STABILITY_CONTROL_ENABLED, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.ELECTRONIC_STABILITY_CONTROL_STATE, VehiclePropertyAccess.READ), Map.entry(VehicleProperty.HVAC_FAN_SPEED, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.HVAC_FAN_DIRECTION, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.HVAC_TEMPERATURE_CURRENT, VehiclePropertyAccess.READ), @@ -112,6 +116,7 @@ public final class AccessForVehicleProperty { Map.entry(VehicleProperty.AP_POWER_BOOTUP_REASON, VehiclePropertyAccess.READ), Map.entry(VehicleProperty.DISPLAY_BRIGHTNESS, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.PER_DISPLAY_BRIGHTNESS, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.VALET_MODE_ENABLED, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.HW_KEY_INPUT, VehiclePropertyAccess.READ), Map.entry(VehicleProperty.HW_KEY_INPUT_V2, VehiclePropertyAccess.READ), Map.entry(VehicleProperty.HW_MOTION_INPUT, VehiclePropertyAccess.READ), @@ -161,11 +166,13 @@ public final class AccessForVehicleProperty { Map.entry(VehicleProperty.SEAT_FOOTWELL_LIGHTS_SWITCH, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.SEAT_EASY_ACCESS_ENABLED, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.SEAT_AIRBAG_ENABLED, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.SEAT_AIRBAGS_DEPLOYED, VehiclePropertyAccess.READ), Map.entry(VehicleProperty.SEAT_CUSHION_SIDE_SUPPORT_POS, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.SEAT_CUSHION_SIDE_SUPPORT_MOVE, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.SEAT_LUMBAR_VERTICAL_POS, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.SEAT_LUMBAR_VERTICAL_MOVE, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.SEAT_WALK_IN_POS, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.SEAT_BELT_PRETENSIONER_DEPLOYED, VehiclePropertyAccess.READ), Map.entry(VehicleProperty.SEAT_OCCUPANCY, VehiclePropertyAccess.READ), Map.entry(VehicleProperty.WINDOW_POS, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.WINDOW_MOVE, VehiclePropertyAccess.READ_WRITE), @@ -184,6 +191,11 @@ public final class AccessForVehicleProperty { Map.entry(VehicleProperty.GLOVE_BOX_LOCKED, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.VEHICLE_MAP_SERVICE, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.LOCATION_CHARACTERIZATION, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.ULTRASONICS_SENSOR_POSITION, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.ULTRASONICS_SENSOR_ORIENTATION, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.ULTRASONICS_SENSOR_FIELD_OF_VIEW, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.ULTRASONICS_SENSOR_DETECTION_RANGE, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.ULTRASONICS_SENSOR_SUPPORTED_RANGES, VehiclePropertyAccess.READ), Map.entry(VehicleProperty.OBD2_LIVE_FRAME, VehiclePropertyAccess.READ), Map.entry(VehicleProperty.OBD2_FREEZE_FRAME, VehiclePropertyAccess.READ), Map.entry(VehicleProperty.OBD2_FREEZE_FRAME_INFO, VehiclePropertyAccess.READ), @@ -239,6 +251,8 @@ public final class AccessForVehicleProperty { Map.entry(VehicleProperty.SUPPORTED_PROPERTY_IDS, VehiclePropertyAccess.READ), Map.entry(VehicleProperty.SHUTDOWN_REQUEST, VehiclePropertyAccess.WRITE), Map.entry(VehicleProperty.VEHICLE_IN_USE, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.CLUSTER_HEARTBEAT, VehiclePropertyAccess.WRITE), + Map.entry(VehicleProperty.VEHICLE_DRIVING_AUTOMATION_CURRENT_LEVEL, VehiclePropertyAccess.READ), Map.entry(VehicleProperty.AUTOMATIC_EMERGENCY_BRAKING_ENABLED, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.AUTOMATIC_EMERGENCY_BRAKING_STATE, VehiclePropertyAccess.READ), Map.entry(VehicleProperty.FORWARD_COLLISION_WARNING_ENABLED, VehiclePropertyAccess.READ_WRITE), @@ -263,7 +277,19 @@ public final class AccessForVehicleProperty { Map.entry(VehicleProperty.ADAPTIVE_CRUISE_CONTROL_LEAD_VEHICLE_MEASURED_DISTANCE, VehiclePropertyAccess.READ), Map.entry(VehicleProperty.HANDS_ON_DETECTION_ENABLED, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.HANDS_ON_DETECTION_DRIVER_STATE, VehiclePropertyAccess.READ), - Map.entry(VehicleProperty.HANDS_ON_DETECTION_WARNING, VehiclePropertyAccess.READ) + Map.entry(VehicleProperty.HANDS_ON_DETECTION_WARNING, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.DRIVER_DROWSINESS_ATTENTION_SYSTEM_ENABLED, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.DRIVER_DROWSINESS_ATTENTION_STATE, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.DRIVER_DROWSINESS_ATTENTION_WARNING_ENABLED, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.DRIVER_DROWSINESS_ATTENTION_WARNING, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.DRIVER_DISTRACTION_SYSTEM_ENABLED, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.DRIVER_DISTRACTION_STATE, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.DRIVER_DISTRACTION_WARNING_ENABLED, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.DRIVER_DISTRACTION_WARNING, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.LOW_SPEED_COLLISION_WARNING_ENABLED, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.LOW_SPEED_COLLISION_WARNING_STATE, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.CROSS_TRAFFIC_MONITORING_ENABLED, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.CROSS_TRAFFIC_MONITORING_WARNING_STATE, VehiclePropertyAccess.READ) ); } diff --git a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java index 29069f8de46d0598f6b8ce695536bd6bfe389843..4fe45ef8d4655dbbceabf3f3798307be862e238d 100644 --- a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 The Android Open Source Project + * Copyright (C) 2023 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -60,9 +60,11 @@ public final class ChangeModeForVehicleProperty { Map.entry(VehicleProperty.EV_CHARGE_PORT_CONNECTED, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.EV_BATTERY_INSTANTANEOUS_CHARGE_RATE, VehiclePropertyChangeMode.CONTINUOUS), Map.entry(VehicleProperty.RANGE_REMAINING, VehiclePropertyChangeMode.CONTINUOUS), + Map.entry(VehicleProperty.EV_BATTERY_AVERAGE_TEMPERATURE, VehiclePropertyChangeMode.CONTINUOUS), Map.entry(VehicleProperty.TIRE_PRESSURE, VehiclePropertyChangeMode.CONTINUOUS), Map.entry(VehicleProperty.CRITICALLY_LOW_TIRE_PRESSURE, VehiclePropertyChangeMode.STATIC), Map.entry(VehicleProperty.ENGINE_IDLE_AUTO_STOP_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.IMPACT_DETECTED, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.GEAR_SELECTION, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.CURRENT_GEAR, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.PARKING_BRAKE_ON, VehiclePropertyChangeMode.ON_CHANGE), @@ -75,6 +77,8 @@ public final class ChangeModeForVehicleProperty { Map.entry(VehicleProperty.ABS_ACTIVE, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.TRACTION_CONTROL_ACTIVE, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.EV_STOPPING_MODE, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.ELECTRONIC_STABILITY_CONTROL_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.ELECTRONIC_STABILITY_CONTROL_STATE, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.HVAC_FAN_SPEED, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.HVAC_FAN_DIRECTION, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.HVAC_TEMPERATURE_CURRENT, VehiclePropertyChangeMode.ON_CHANGE), @@ -112,6 +116,7 @@ public final class ChangeModeForVehicleProperty { Map.entry(VehicleProperty.AP_POWER_BOOTUP_REASON, VehiclePropertyChangeMode.STATIC), Map.entry(VehicleProperty.DISPLAY_BRIGHTNESS, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.PER_DISPLAY_BRIGHTNESS, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.VALET_MODE_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.HW_KEY_INPUT, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.HW_KEY_INPUT_V2, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.HW_MOTION_INPUT, VehiclePropertyChangeMode.ON_CHANGE), @@ -161,11 +166,13 @@ public final class ChangeModeForVehicleProperty { Map.entry(VehicleProperty.SEAT_FOOTWELL_LIGHTS_SWITCH, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.SEAT_EASY_ACCESS_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.SEAT_AIRBAG_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.SEAT_AIRBAGS_DEPLOYED, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.SEAT_CUSHION_SIDE_SUPPORT_POS, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.SEAT_CUSHION_SIDE_SUPPORT_MOVE, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.SEAT_LUMBAR_VERTICAL_POS, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.SEAT_LUMBAR_VERTICAL_MOVE, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.SEAT_WALK_IN_POS, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.SEAT_BELT_PRETENSIONER_DEPLOYED, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.SEAT_OCCUPANCY, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.WINDOW_POS, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.WINDOW_MOVE, VehiclePropertyChangeMode.ON_CHANGE), @@ -184,6 +191,11 @@ public final class ChangeModeForVehicleProperty { Map.entry(VehicleProperty.GLOVE_BOX_LOCKED, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.VEHICLE_MAP_SERVICE, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.LOCATION_CHARACTERIZATION, VehiclePropertyChangeMode.STATIC), + Map.entry(VehicleProperty.ULTRASONICS_SENSOR_POSITION, VehiclePropertyChangeMode.STATIC), + Map.entry(VehicleProperty.ULTRASONICS_SENSOR_ORIENTATION, VehiclePropertyChangeMode.STATIC), + Map.entry(VehicleProperty.ULTRASONICS_SENSOR_FIELD_OF_VIEW, VehiclePropertyChangeMode.STATIC), + Map.entry(VehicleProperty.ULTRASONICS_SENSOR_DETECTION_RANGE, VehiclePropertyChangeMode.STATIC), + Map.entry(VehicleProperty.ULTRASONICS_SENSOR_SUPPORTED_RANGES, VehiclePropertyChangeMode.STATIC), Map.entry(VehicleProperty.OBD2_LIVE_FRAME, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.OBD2_FREEZE_FRAME, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.OBD2_FREEZE_FRAME_INFO, VehiclePropertyChangeMode.ON_CHANGE), @@ -239,6 +251,8 @@ public final class ChangeModeForVehicleProperty { Map.entry(VehicleProperty.SUPPORTED_PROPERTY_IDS, VehiclePropertyChangeMode.STATIC), Map.entry(VehicleProperty.SHUTDOWN_REQUEST, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.VEHICLE_IN_USE, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.CLUSTER_HEARTBEAT, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.VEHICLE_DRIVING_AUTOMATION_CURRENT_LEVEL, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.AUTOMATIC_EMERGENCY_BRAKING_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.AUTOMATIC_EMERGENCY_BRAKING_STATE, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.FORWARD_COLLISION_WARNING_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), @@ -263,7 +277,19 @@ public final class ChangeModeForVehicleProperty { Map.entry(VehicleProperty.ADAPTIVE_CRUISE_CONTROL_LEAD_VEHICLE_MEASURED_DISTANCE, VehiclePropertyChangeMode.CONTINUOUS), Map.entry(VehicleProperty.HANDS_ON_DETECTION_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.HANDS_ON_DETECTION_DRIVER_STATE, VehiclePropertyChangeMode.ON_CHANGE), - Map.entry(VehicleProperty.HANDS_ON_DETECTION_WARNING, VehiclePropertyChangeMode.ON_CHANGE) + Map.entry(VehicleProperty.HANDS_ON_DETECTION_WARNING, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.DRIVER_DROWSINESS_ATTENTION_SYSTEM_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.DRIVER_DROWSINESS_ATTENTION_STATE, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.DRIVER_DROWSINESS_ATTENTION_WARNING_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.DRIVER_DROWSINESS_ATTENTION_WARNING, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.DRIVER_DISTRACTION_SYSTEM_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.DRIVER_DISTRACTION_STATE, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.DRIVER_DISTRACTION_WARNING_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.DRIVER_DISTRACTION_WARNING, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.LOW_SPEED_COLLISION_WARNING_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.LOW_SPEED_COLLISION_WARNING_STATE, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.CROSS_TRAFFIC_MONITORING_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.CROSS_TRAFFIC_MONITORING_WARNING_STATE, VehiclePropertyChangeMode.ON_CHANGE) ); } diff --git a/automotive/vehicle/aidl/generated_lib/java/EnumForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/EnumForVehicleProperty.java new file mode 100644 index 0000000000000000000000000000000000000000..b4f24a6e857feb2719eef35b6ac76421eb8c3747 --- /dev/null +++ b/automotive/vehicle/aidl/generated_lib/java/EnumForVehicleProperty.java @@ -0,0 +1,109 @@ +/* + * Copyright (C) 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * DO NOT EDIT MANUALLY!!! + * + * Generated by tools/generate_annotation_enums.py. + */ + +// clang-format off + +package android.hardware.automotive.vehicle; + +import java.util.List; +import java.util.Map; + +public final class EnumForVehicleProperty { + + public static final Map>> values = Map.ofEntries( + Map.entry(VehicleProperty.INFO_FUEL_TYPE, List.of(FuelType.class)), + Map.entry(VehicleProperty.INFO_EV_CONNECTOR_TYPE, List.of(EvConnectorType.class)), + Map.entry(VehicleProperty.INFO_FUEL_DOOR_LOCATION, List.of(PortLocationType.class)), + Map.entry(VehicleProperty.INFO_EV_PORT_LOCATION, List.of(PortLocationType.class)), + Map.entry(VehicleProperty.INFO_DRIVER_SEAT, List.of(VehicleAreaSeat.class)), + Map.entry(VehicleProperty.INFO_MULTI_EV_PORT_LOCATIONS, List.of(PortLocationType.class)), + Map.entry(VehicleProperty.ENGINE_OIL_LEVEL, List.of(VehicleOilLevel.class)), + Map.entry(VehicleProperty.IMPACT_DETECTED, List.of(ImpactSensorLocation.class)), + Map.entry(VehicleProperty.GEAR_SELECTION, List.of(VehicleGear.class)), + Map.entry(VehicleProperty.CURRENT_GEAR, List.of(VehicleGear.class)), + Map.entry(VehicleProperty.TURN_SIGNAL_STATE, List.of(VehicleTurnSignal.class)), + Map.entry(VehicleProperty.IGNITION_STATE, List.of(VehicleIgnitionState.class)), + Map.entry(VehicleProperty.EV_STOPPING_MODE, List.of(EvStoppingMode.class)), + Map.entry(VehicleProperty.ELECTRONIC_STABILITY_CONTROL_STATE, List.of(ElectronicStabilityControlState.class, ErrorState.class)), + Map.entry(VehicleProperty.HVAC_FAN_DIRECTION, List.of(VehicleHvacFanDirection.class)), + Map.entry(VehicleProperty.HVAC_TEMPERATURE_DISPLAY_UNITS, List.of(VehicleUnit.class)), + Map.entry(VehicleProperty.HVAC_FAN_DIRECTION_AVAILABLE, List.of(VehicleHvacFanDirection.class)), + Map.entry(VehicleProperty.DISTANCE_DISPLAY_UNITS, List.of(VehicleUnit.class)), + Map.entry(VehicleProperty.FUEL_VOLUME_DISPLAY_UNITS, List.of(VehicleUnit.class)), + Map.entry(VehicleProperty.TIRE_PRESSURE_DISPLAY_UNITS, List.of(VehicleUnit.class)), + Map.entry(VehicleProperty.EV_BATTERY_DISPLAY_UNITS, List.of(VehicleUnit.class)), + Map.entry(VehicleProperty.HW_ROTARY_INPUT, List.of(RotaryInputType.class)), + Map.entry(VehicleProperty.HW_CUSTOM_INPUT, List.of(CustomInputType.class)), + Map.entry(VehicleProperty.SEAT_FOOTWELL_LIGHTS_STATE, List.of(VehicleLightState.class)), + Map.entry(VehicleProperty.SEAT_FOOTWELL_LIGHTS_SWITCH, List.of(VehicleLightSwitch.class)), + Map.entry(VehicleProperty.SEAT_AIRBAGS_DEPLOYED, List.of(VehicleAirbagLocation.class)), + Map.entry(VehicleProperty.SEAT_OCCUPANCY, List.of(VehicleSeatOccupancyState.class)), + Map.entry(VehicleProperty.WINDSHIELD_WIPERS_STATE, List.of(WindshieldWipersState.class)), + Map.entry(VehicleProperty.WINDSHIELD_WIPERS_SWITCH, List.of(WindshieldWipersSwitch.class)), + Map.entry(VehicleProperty.HEADLIGHTS_STATE, List.of(VehicleLightState.class)), + Map.entry(VehicleProperty.HIGH_BEAM_LIGHTS_STATE, List.of(VehicleLightState.class)), + Map.entry(VehicleProperty.FOG_LIGHTS_STATE, List.of(VehicleLightState.class)), + Map.entry(VehicleProperty.HAZARD_LIGHTS_STATE, List.of(VehicleLightState.class)), + Map.entry(VehicleProperty.HEADLIGHTS_SWITCH, List.of(VehicleLightSwitch.class)), + Map.entry(VehicleProperty.HIGH_BEAM_LIGHTS_SWITCH, List.of(VehicleLightSwitch.class)), + Map.entry(VehicleProperty.FOG_LIGHTS_SWITCH, List.of(VehicleLightSwitch.class)), + Map.entry(VehicleProperty.HAZARD_LIGHTS_SWITCH, List.of(VehicleLightSwitch.class)), + Map.entry(VehicleProperty.CABIN_LIGHTS_STATE, List.of(VehicleLightState.class)), + Map.entry(VehicleProperty.CABIN_LIGHTS_SWITCH, List.of(VehicleLightSwitch.class)), + Map.entry(VehicleProperty.READING_LIGHTS_STATE, List.of(VehicleLightState.class)), + Map.entry(VehicleProperty.READING_LIGHTS_SWITCH, List.of(VehicleLightSwitch.class)), + Map.entry(VehicleProperty.STEERING_WHEEL_LIGHTS_STATE, List.of(VehicleLightState.class)), + Map.entry(VehicleProperty.STEERING_WHEEL_LIGHTS_SWITCH, List.of(VehicleLightSwitch.class)), + Map.entry(VehicleProperty.ELECTRONIC_TOLL_COLLECTION_CARD_TYPE, List.of(ElectronicTollCollectionCardType.class)), + Map.entry(VehicleProperty.ELECTRONIC_TOLL_COLLECTION_CARD_STATUS, List.of(ElectronicTollCollectionCardStatus.class)), + Map.entry(VehicleProperty.FRONT_FOG_LIGHTS_STATE, List.of(VehicleLightState.class)), + Map.entry(VehicleProperty.FRONT_FOG_LIGHTS_SWITCH, List.of(VehicleLightSwitch.class)), + Map.entry(VehicleProperty.REAR_FOG_LIGHTS_STATE, List.of(VehicleLightState.class)), + Map.entry(VehicleProperty.REAR_FOG_LIGHTS_SWITCH, List.of(VehicleLightSwitch.class)), + Map.entry(VehicleProperty.EV_CHARGE_STATE, List.of(EvChargeState.class)), + Map.entry(VehicleProperty.EV_REGENERATIVE_BRAKING_STATE, List.of(EvRegenerativeBrakingState.class)), + Map.entry(VehicleProperty.TRAILER_PRESENT, List.of(TrailerState.class)), + Map.entry(VehicleProperty.GENERAL_SAFETY_REGULATION_COMPLIANCE_REQUIREMENT, List.of(GsrComplianceRequirementType.class)), + Map.entry(VehicleProperty.SHUTDOWN_REQUEST, List.of(VehicleApPowerStateShutdownParam.class)), + Map.entry(VehicleProperty.VEHICLE_DRIVING_AUTOMATION_CURRENT_LEVEL, List.of(VehicleAutonomousState.class)), + Map.entry(VehicleProperty.AUTOMATIC_EMERGENCY_BRAKING_STATE, List.of(AutomaticEmergencyBrakingState.class, ErrorState.class)), + Map.entry(VehicleProperty.FORWARD_COLLISION_WARNING_STATE, List.of(ForwardCollisionWarningState.class, ErrorState.class)), + Map.entry(VehicleProperty.BLIND_SPOT_WARNING_STATE, List.of(BlindSpotWarningState.class, ErrorState.class)), + Map.entry(VehicleProperty.LANE_DEPARTURE_WARNING_STATE, List.of(LaneDepartureWarningState.class, ErrorState.class)), + Map.entry(VehicleProperty.LANE_KEEP_ASSIST_STATE, List.of(LaneKeepAssistState.class, ErrorState.class)), + Map.entry(VehicleProperty.LANE_CENTERING_ASSIST_COMMAND, List.of(LaneCenteringAssistCommand.class)), + Map.entry(VehicleProperty.LANE_CENTERING_ASSIST_STATE, List.of(LaneCenteringAssistState.class, ErrorState.class)), + Map.entry(VehicleProperty.EMERGENCY_LANE_KEEP_ASSIST_STATE, List.of(EmergencyLaneKeepAssistState.class, ErrorState.class)), + Map.entry(VehicleProperty.CRUISE_CONTROL_TYPE, List.of(CruiseControlType.class, ErrorState.class)), + Map.entry(VehicleProperty.CRUISE_CONTROL_STATE, List.of(CruiseControlState.class, ErrorState.class)), + Map.entry(VehicleProperty.CRUISE_CONTROL_COMMAND, List.of(CruiseControlCommand.class)), + Map.entry(VehicleProperty.HANDS_ON_DETECTION_DRIVER_STATE, List.of(HandsOnDetectionDriverState.class, ErrorState.class)), + Map.entry(VehicleProperty.HANDS_ON_DETECTION_WARNING, List.of(HandsOnDetectionWarning.class, ErrorState.class)), + Map.entry(VehicleProperty.DRIVER_DROWSINESS_ATTENTION_STATE, List.of(DriverDrowsinessAttentionState.class, ErrorState.class)), + Map.entry(VehicleProperty.DRIVER_DROWSINESS_ATTENTION_WARNING, List.of(DriverDrowsinessAttentionWarning.class, ErrorState.class)), + Map.entry(VehicleProperty.DRIVER_DISTRACTION_STATE, List.of(DriverDistractionState.class, ErrorState.class)), + Map.entry(VehicleProperty.DRIVER_DISTRACTION_WARNING, List.of(DriverDistractionWarning.class, ErrorState.class)), + Map.entry(VehicleProperty.LOW_SPEED_COLLISION_WARNING_STATE, List.of(LowSpeedCollisionWarningState.class, ErrorState.class)), + Map.entry(VehicleProperty.CROSS_TRAFFIC_MONITORING_WARNING_STATE, List.of(CrossTrafficMonitoringWarningState.class, ErrorState.class)) + ); + +} diff --git a/automotive/vehicle/aidl/impl/README.md b/automotive/vehicle/aidl/impl/README.md index 121ffd15e7d07a1b5858bc8615735db746c88925..2cd3a3eb5b6715c4c279ee0d4f596016a77a3914 100644 --- a/automotive/vehicle/aidl/impl/README.md +++ b/automotive/vehicle/aidl/impl/README.md @@ -46,7 +46,7 @@ implementations (including reference VHAL). Vendor VHAL implementation could use this library, along with their own implementation for `IVehicleHardware` interface. -Also defines a binary `android.hardware.automotive.vehicle@V1-default-service` +Also defines a binary `android.hardware.automotive.vehicle@V3-default-service` which is the reference VHAL implementation. It implements `IVehicle.aidl` interface. It uses `DefaultVehicleHal`, along with `FakeVehicleHardware` (in fake_impl). It simulates the vehicle bus interaction by using an diff --git a/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/Android.bp b/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/Android.bp index 6984d5e2d54d2e1588fa70341e3ac2bc6c6bedc5..75a3541cdd5e07ed8651743c798a107bd75d8207 100644 --- a/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/Android.bp +++ b/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/Android.bp @@ -35,14 +35,17 @@ cc_library { cc_library { name: "VehicleHalJsonConfigLoaderEnableTestProperties", vendor: true, - srcs: ["src/*.cpp"], + srcs: [ + "src/*.cpp", + ":VhalTestVendorProperties", + ], local_include_dirs: ["include"], export_include_dirs: ["include"], defaults: ["VehicleHalDefaults"], static_libs: ["VehicleHalUtils"], header_libs: [ - "VehicleHalTestUtilHeaders", "IVehicleGeneratedHeaders", + "libbinder_headers", ], cflags: ["-DENABLE_VEHICLE_HAL_TEST_PROPERTIES"], shared_libs: ["libjsoncpp"], diff --git a/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp b/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp index 0a1f90414ea50320cd6dcec9ae0c5ad4d233fec0..146da69bd229031d32d485383e9e44683c85e672 100644 --- a/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp +++ b/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp @@ -21,7 +21,7 @@ #include #ifdef ENABLE_VEHICLE_HAL_TEST_PROPERTIES -#include +#include #endif // ENABLE_VEHICLE_HAL_TEST_PROPERTIES #include @@ -38,9 +38,15 @@ using ::aidl::android::hardware::automotive::vehicle::AccessForVehicleProperty; using ::aidl::android::hardware::automotive::vehicle::AutomaticEmergencyBrakingState; using ::aidl::android::hardware::automotive::vehicle::BlindSpotWarningState; using ::aidl::android::hardware::automotive::vehicle::ChangeModeForVehicleProperty; +using ::aidl::android::hardware::automotive::vehicle::CrossTrafficMonitoringWarningState; using ::aidl::android::hardware::automotive::vehicle::CruiseControlCommand; using ::aidl::android::hardware::automotive::vehicle::CruiseControlState; using ::aidl::android::hardware::automotive::vehicle::CruiseControlType; +using ::aidl::android::hardware::automotive::vehicle::DriverDistractionState; +using ::aidl::android::hardware::automotive::vehicle::DriverDistractionWarning; +using ::aidl::android::hardware::automotive::vehicle::DriverDrowsinessAttentionState; +using ::aidl::android::hardware::automotive::vehicle::DriverDrowsinessAttentionWarning; +using ::aidl::android::hardware::automotive::vehicle::ElectronicStabilityControlState; using ::aidl::android::hardware::automotive::vehicle::EmergencyLaneKeepAssistState; using ::aidl::android::hardware::automotive::vehicle::ErrorState; using ::aidl::android::hardware::automotive::vehicle::EvConnectorType; @@ -51,17 +57,21 @@ using ::aidl::android::hardware::automotive::vehicle::FuelType; using ::aidl::android::hardware::automotive::vehicle::GsrComplianceRequirementType; using ::aidl::android::hardware::automotive::vehicle::HandsOnDetectionDriverState; using ::aidl::android::hardware::automotive::vehicle::HandsOnDetectionWarning; +using ::aidl::android::hardware::automotive::vehicle::ImpactSensorLocation; using ::aidl::android::hardware::automotive::vehicle::LaneCenteringAssistCommand; using ::aidl::android::hardware::automotive::vehicle::LaneCenteringAssistState; using ::aidl::android::hardware::automotive::vehicle::LaneDepartureWarningState; using ::aidl::android::hardware::automotive::vehicle::LaneKeepAssistState; using ::aidl::android::hardware::automotive::vehicle::LocationCharacterization; +using ::aidl::android::hardware::automotive::vehicle::LowSpeedCollisionWarningState; using ::aidl::android::hardware::automotive::vehicle::RawPropValues; +using ::aidl::android::hardware::automotive::vehicle::VehicleAirbagLocation; using ::aidl::android::hardware::automotive::vehicle::VehicleApPowerStateReport; using ::aidl::android::hardware::automotive::vehicle::VehicleApPowerStateReq; using ::aidl::android::hardware::automotive::vehicle::VehicleAreaConfig; using ::aidl::android::hardware::automotive::vehicle::VehicleAreaMirror; using ::aidl::android::hardware::automotive::vehicle::VehicleAreaWindow; +using ::aidl::android::hardware::automotive::vehicle::VehicleAutonomousState; using ::aidl::android::hardware::automotive::vehicle::VehicleGear; using ::aidl::android::hardware::automotive::vehicle::VehicleHvacFanDirection; using ::aidl::android::hardware::automotive::vehicle::VehicleIgnitionState; @@ -91,10 +101,6 @@ const std::unordered_map CONSTANTS_BY_NAME = { {"HVAC_ALL", HVAC_ALL}, {"HVAC_LEFT", HVAC_LEFT}, {"HVAC_RIGHT", HVAC_RIGHT}, - {"VENDOR_EXTENSION_INT_PROPERTY", VENDOR_EXTENSION_INT_PROPERTY}, - {"VENDOR_EXTENSION_BOOLEAN_PROPERTY", VENDOR_EXTENSION_BOOLEAN_PROPERTY}, - {"VENDOR_EXTENSION_STRING_PROPERTY", VENDOR_EXTENSION_STRING_PROPERTY}, - {"VENDOR_EXTENSION_FLOAT_PROPERTY", VENDOR_EXTENSION_FLOAT_PROPERTY}, {"WINDOW_1_LEFT", WINDOW_1_LEFT}, {"WINDOW_1_RIGHT", WINDOW_1_RIGHT}, {"WINDOW_2_LEFT", WINDOW_2_LEFT}, @@ -133,24 +139,9 @@ const std::unordered_map CONSTANTS_BY_NAME = { {"EV_STOPPING_MODE_HOLD", EV_STOPPING_MODE_HOLD}, {"MIRROR_DRIVER_LEFT_RIGHT", toInt(VehicleAreaMirror::DRIVER_LEFT) | toInt(VehicleAreaMirror::DRIVER_RIGHT)}, -#ifdef ENABLE_VEHICLE_HAL_TEST_PROPERTIES - // Following are test properties: - {"ECHO_REVERSE_BYTES", ECHO_REVERSE_BYTES}, - {"VENDOR_PROPERTY_ID", VENDOR_PROPERTY_ID}, - {"kMixedTypePropertyForTest", kMixedTypePropertyForTest}, - {"VENDOR_CLUSTER_NAVIGATION_STATE", VENDOR_CLUSTER_NAVIGATION_STATE}, - {"VENDOR_CLUSTER_REQUEST_DISPLAY", VENDOR_CLUSTER_REQUEST_DISPLAY}, - {"VENDOR_CLUSTER_SWITCH_UI", VENDOR_CLUSTER_SWITCH_UI}, - {"VENDOR_CLUSTER_DISPLAY_STATE", VENDOR_CLUSTER_DISPLAY_STATE}, - {"VENDOR_CLUSTER_REPORT_STATE", VENDOR_CLUSTER_REPORT_STATE}, - {"PLACEHOLDER_PROPERTY_INT", PLACEHOLDER_PROPERTY_INT}, - {"PLACEHOLDER_PROPERTY_FLOAT", PLACEHOLDER_PROPERTY_FLOAT}, - {"PLACEHOLDER_PROPERTY_BOOLEAN", PLACEHOLDER_PROPERTY_BOOLEAN}, - {"PLACEHOLDER_PROPERTY_STRING", PLACEHOLDER_PROPERTY_STRING} -#endif // ENABLE_VEHICLE_HAL_TEST_PROPERTIES }; -// A class to parse constant values for type T. +// A class to parse constant values for type T where T is defined as an enum in NDK AIDL backend. template class ConstantParser final : public ConstantParserInterface { public: @@ -181,6 +172,33 @@ class ConstantParser final : public ConstantParserInterface { std::unordered_map mValueByName; }; +#ifdef ENABLE_VEHICLE_HAL_TEST_PROPERTIES +// A class to parse constant values for type T where T is defined as an enum in CPP AIDL backend. +template +class CppConstantParser final : public ConstantParserInterface { + public: + CppConstantParser() { + for (const T& v : android::enum_range()) { + std::string name = android::hardware::automotive::vehicle::toString(v); + mValueByName[name] = toInt(v); + } + } + + ~CppConstantParser() = default; + + Result parseValue(const std::string& name) const override { + auto it = mValueByName.find(name); + if (it == mValueByName.end()) { + return Error() << "Constant name: " << name << " is not defined"; + } + return it->second; + } + + private: + std::unordered_map mValueByName; +}; +#endif + // A class to parse constant values defined in CONSTANTS_BY_NAME map. class LocalVariableParser final : public ConstantParserInterface { public: @@ -232,6 +250,12 @@ JsonValueParser::JsonValueParser() { std::make_unique>(); mConstantParsersByType["WindshieldWipersSwitch"] = std::make_unique>(); + mConstantParsersByType["VehicleAutonomousState"] = + std::make_unique>(); + mConstantParsersByType["VehicleAirbagLocation"] = + std::make_unique>(); + mConstantParsersByType["ImpactSensorLocation"] = + std::make_unique>(); mConstantParsersByType["EmergencyLaneKeepAssistState"] = std::make_unique>(); mConstantParsersByType["CruiseControlType"] = @@ -244,6 +268,14 @@ JsonValueParser::JsonValueParser() { std::make_unique>(); mConstantParsersByType["HandsOnDetectionWarning"] = std::make_unique>(); + mConstantParsersByType["DriverDrowsinessAttentionState"] = + std::make_unique>(); + mConstantParsersByType["DriverDrowsinessAttentionWarning"] = + std::make_unique>(); + mConstantParsersByType["DriverDistractionState"] = + std::make_unique>(); + mConstantParsersByType["DriverDistractionWarning"] = + std::make_unique>(); mConstantParsersByType["ErrorState"] = std::make_unique>(); mConstantParsersByType["AutomaticEmergencyBrakingState"] = std::make_unique>(); @@ -259,7 +291,27 @@ JsonValueParser::JsonValueParser() { std::make_unique>(); mConstantParsersByType["LaneCenteringAssistState"] = std::make_unique>(); + mConstantParsersByType["LowSpeedCollisionWarningState"] = + std::make_unique>(); + mConstantParsersByType["ElectronicStabilityControlState"] = + std::make_unique>(); + mConstantParsersByType["CrossTrafficMonitoringWarningState"] = + std::make_unique>(); mConstantParsersByType["Constants"] = std::make_unique(); +#ifdef ENABLE_VEHICLE_HAL_TEST_PROPERTIES + mConstantParsersByType["TestVendorProperty"] = + std::make_unique>(); +#endif // ENABLE_VEHICLE_HAL_TEST_PROPERTIES +} + +template <> +Result JsonValueParser::convertValueToType(const std::string& fieldName, + const Json::Value& value) { + if (!value.isBool()) { + return Error() << "The value: " << value << " for field: " << fieldName + << " is not in correct type, expect bool"; + } + return value.asBool(); } template <> @@ -519,6 +571,12 @@ void JsonConfigParser::parseAreas(const Json::Value& parentJsonNode, const std:: tryParseJsonValueToVariable(jsonAreaConfig, "maxFloatValue", /*optional=*/true, &areaConfig.maxFloatValue, errors); + // By default we support variable update rate for all properties except it is explicitly + // disabled. + areaConfig.supportVariableUpdateRate = true; + tryParseJsonValueToVariable(jsonAreaConfig, "supportVariableUpdateRate", /*optional=*/true, + &areaConfig.supportVariableUpdateRate, errors); + std::vector supportedEnumValues; tryParseJsonArrayToVariable(jsonAreaConfig, "supportedEnumValues", /*optional=*/true, &supportedEnumValues, errors); @@ -573,6 +631,16 @@ std::optional JsonConfigParser::parseEachProperty( if (errors->size() != initialErrorCount) { return std::nullopt; } + + // If there is no area config, by default we allow variable update rate, so we have to add + // a global area config. + if (configDecl.config.areaConfigs.size() == 0) { + VehicleAreaConfig areaConfig = { + .areaId = 0, + .supportVariableUpdateRate = true, + }; + configDecl.config.areaConfigs.push_back(std::move(areaConfig)); + } return configDecl; } diff --git a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json index 5503de22ec1b24fd1c6058ce245730d6f1f10385..665c10e8e37bdc28fa55dd18182bbe44f5d6fd73 100644 --- a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json +++ b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json @@ -1327,6 +1327,75 @@ } ] }, + { + "property": "VehicleProperty::SEAT_AIRBAGS_DEPLOYED", + "defaultValue": { + "int32Values": [ + 0 + ] + }, + "areas": [ + { + "areaId": "Constants::SEAT_1_LEFT", + "supportedEnumValues": [ + "VehicleAirbagLocation::FRONT", + "VehicleAirbagLocation::KNEE", + "VehicleAirbagLocation::LEFT_SIDE", + "VehicleAirbagLocation::RIGHT_SIDE", + "VehicleAirbagLocation::CURTAIN" + ] + }, + { + "areaId": "Constants::SEAT_1_RIGHT", + "supportedEnumValues": [ + "VehicleAirbagLocation::FRONT", + "VehicleAirbagLocation::KNEE", + "VehicleAirbagLocation::LEFT_SIDE", + "VehicleAirbagLocation::RIGHT_SIDE", + "VehicleAirbagLocation::CURTAIN" + ] + }, + { + "areaId": "Constants::SEAT_2_LEFT", + "supportedEnumValues": [ + "VehicleAirbagLocation::FRONT", + "VehicleAirbagLocation::CURTAIN" + ] + }, + { + "areaId": "Constants::SEAT_2_RIGHT", + "supportedEnumValues": [ + "VehicleAirbagLocation::FRONT", + "VehicleAirbagLocation::CURTAIN" + ] + } + ] + }, + { + "property": "VehicleProperty::SEAT_BELT_PRETENSIONER_DEPLOYED", + "defaultValue": { + "int32Values": [ + 0 + ] + }, + "areas": [ + { + "areaId": "Constants::SEAT_1_LEFT" + }, + { + "areaId": "Constants::SEAT_1_RIGHT" + }, + { + "areaId": "Constants::SEAT_2_LEFT" + }, + { + "areaId": "Constants::SEAT_2_RIGHT" + }, + { + "areaId": "Constants::SEAT_2_CENTER" + } + ] + }, { "property": "VehicleProperty::SEAT_OCCUPANCY", "defaultValue": { @@ -1559,6 +1628,16 @@ "maxSampleRate": 2.0, "minSampleRate": 1.0 }, + { + "property": "VehicleProperty::EV_BATTERY_AVERAGE_TEMPERATURE", + "defaultValue": { + "floatValues": [ + 25.0 + ] + }, + "maxSampleRate": 2.0, + "minSampleRate": 1.0 + }, { "property": "VehicleProperty::TIRE_PRESSURE", "defaultValue": { @@ -1899,8 +1978,16 @@ } ], "configArray": [ + "VehicleProperty::HVAC_ACTUAL_FAN_SPEED_RPM", + "VehicleProperty::HVAC_AC_ON", + "VehicleProperty::HVAC_AUTO_ON", + "VehicleProperty::HVAC_AUTO_RECIRC_ON", + "VehicleProperty::HVAC_FAN_DIRECTION", "VehicleProperty::HVAC_FAN_SPEED", - "VehicleProperty::HVAC_FAN_DIRECTION" + "VehicleProperty::HVAC_MAX_AC_ON", + "VehicleProperty::HVAC_RECIRC_ON", + "VehicleProperty::HVAC_TEMPERATURE_CURRENT", + "VehicleProperty::HVAC_TEMPERATURE_SET" ] }, { @@ -2360,9 +2447,9 @@ 160, 280, 5, - 600, - 840, - 10 + 608, + 824, + 9 ] }, { @@ -2372,7 +2459,7 @@ 66.19999694824219, "VehicleUnit::FAHRENHEIT", 19.0, - 66.0 + 66.2 ] } }, @@ -2494,6 +2581,27 @@ ] } }, + { + "property": "VehicleProperty::IMPACT_DETECTED", + "defaultValue": { + "int32Values": [ + 0 + ] + }, + "areas": [ + { + "areaId": 0, + "supportedEnumValues": [ + "ImpactSensorLocation::FRONT", + "ImpactSensorLocation::FRONT_LEFT_DOOR_SIDE", + "ImpactSensorLocation::FRONT_RIGHT_DOOR_SIDE", + "ImpactSensorLocation::REAR_LEFT_DOOR_SIDE", + "ImpactSensorLocation::REAR_RIGHT_DOOR_SIDE", + "ImpactSensorLocation::REAR" + ] + } + ] + }, { "property": "VehicleProperty::DOOR_LOCK", "areas": [ @@ -3102,6 +3210,14 @@ } ] }, + { + "property": "VehicleProperty::VALET_MODE_ENABLED", + "defaultValue": { + "int32Values": [ + 0 + ] + } + }, { "property": "VehicleProperty::OBD2_LIVE_FRAME", "configArray": [ @@ -3387,7 +3503,7 @@ "property": "VehicleProperty::CRUISE_CONTROL_TYPE", "defaultValue": { "int32Values": [ - "CruiseControlType::STANDARD" + "CruiseControlType::ADAPTIVE" ] }, "areas": [ @@ -3537,6 +3653,117 @@ } ] }, + { + "property": "VehicleProperty::DRIVER_DROWSINESS_ATTENTION_SYSTEM_ENABLED", + "defaultValue": { + "int32Values": [ + 1 + ] + } + }, + { + "property": "VehicleProperty::DRIVER_DROWSINESS_ATTENTION_STATE", + "defaultValue": { + "int32Values": [ + "DriverDrowsinessAttentionState::KSS_RATING_3_ALERT" + ] + }, + "areas": [ + { + "areaId": 0, + "supportedEnumValues": [ + "ErrorState::NOT_AVAILABLE_DISABLED", + "DriverDrowsinessAttentionState::KSS_RATING_1_EXTREMELY_ALERT", + "DriverDrowsinessAttentionState::KSS_RATING_2_VERY_ALERT", + "DriverDrowsinessAttentionState::KSS_RATING_3_ALERT", + "DriverDrowsinessAttentionState::KSS_RATING_4_RATHER_ALERT", + "DriverDrowsinessAttentionState::KSS_RATING_5_NEITHER_ALERT_NOR_SLEEPY", + "DriverDrowsinessAttentionState::KSS_RATING_6_SOME_SLEEPINESS", + "DriverDrowsinessAttentionState::KSS_RATING_7_SLEEPY_NO_EFFORT", + "DriverDrowsinessAttentionState::KSS_RATING_8_SLEEPY_SOME_EFFORT", + "DriverDrowsinessAttentionState::KSS_RATING_9_VERY_SLEEPY" + ] + } + ] + }, + { + "property": "VehicleProperty::DRIVER_DROWSINESS_ATTENTION_WARNING_ENABLED", + "defaultValue": { + "int32Values": [ + 1 + ] + } + }, + { + "property": "VehicleProperty::DRIVER_DROWSINESS_ATTENTION_WARNING", + "defaultValue": { + "int32Values": [ + "DriverDrowsinessAttentionWarning::NO_WARNING" + ] + }, + "areas": [ + { + "areaId": 0, + "supportedEnumValues": [ + "ErrorState::NOT_AVAILABLE_DISABLED", + "DriverDrowsinessAttentionWarning::NO_WARNING", + "DriverDrowsinessAttentionWarning::WARNING" + ] + } + ] + }, + { + "property": "VehicleProperty::DRIVER_DISTRACTION_SYSTEM_ENABLED", + "defaultValue": { + "int32Values": [ + 1 + ] + } + }, + { + "property": "VehicleProperty::DRIVER_DISTRACTION_STATE", + "defaultValue": { + "int32Values": [ + "DriverDistractionState::NOT_DISTRACTED" + ] + }, + "areas": [ + { + "areaId": 0, + "supportedEnumValues": [ + "ErrorState::NOT_AVAILABLE_DISABLED", + "DriverDistractionState::NOT_DISTRACTED", + "DriverDistractionState::DISTRACTED" + ] + } + ] + }, + { + "property": "VehicleProperty::DRIVER_DISTRACTION_WARNING_ENABLED", + "defaultValue": { + "int32Values": [ + 1 + ] + } + }, + { + "property": "VehicleProperty::DRIVER_DISTRACTION_WARNING", + "defaultValue": { + "int32Values": [ + "DriverDistractionWarning::NO_WARNING" + ] + }, + "areas": [ + { + "areaId": 0, + "supportedEnumValues": [ + "ErrorState::NOT_AVAILABLE_DISABLED", + "DriverDistractionWarning::NO_WARNING", + "DriverDistractionWarning::WARNING" + ] + } + ] + }, { "property": "VehicleProperty::INITIAL_USER_INFO" }, @@ -3571,7 +3798,13 @@ "property": "VehicleProperty::WATCHDOG_TERMINATED_PROCESS" }, { - "property": "VehicleProperty::VHAL_HEARTBEAT" + "property": "VehicleProperty::VHAL_HEARTBEAT", + "areas": [ + { + "areaId": 0, + "supportVariableUpdateRate": false + } + ] }, { "property": "VehicleProperty::CLUSTER_SWITCH_UI", @@ -3620,6 +3853,27 @@ { "property": "VehicleProperty::CLUSTER_NAVIGATION_STATE" }, + { + "property": "VehicleProperty::CLUSTER_HEARTBEAT", + "configArray": [ + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 16 + ], + "areas": [ + { + "areaId": 0, + "supportVariableUpdateRate": false + } + ], + "comment": "configArray specifies it consists of int64[2] and byte[16]." + }, { "property": "VehicleProperty::GENERAL_SAFETY_REGULATION_COMPLIANCE_REQUIREMENT", "defaultValue": { @@ -3628,6 +3882,25 @@ ] } }, + { + "property": "VehicleProperty::SHUTDOWN_REQUEST" + }, + { + "property": "VehicleProperty::VEHICLE_IN_USE", + "defaultValue": { + "int32Values": [ + 1 + ] + } + }, + { + "property": "VehicleProperty::VEHICLE_DRIVING_AUTOMATION_CURRENT_LEVEL", + "defaultValue": { + "int32Values": [ + "VehicleAutonomousState::LEVEL_0" + ] + } + }, { "property": "VehicleProperty::AUTOMATIC_EMERGENCY_BRAKING_ENABLED", "defaultValue": { @@ -3826,6 +4099,98 @@ ] } ] + }, + { + "property": "VehicleProperty::LOW_SPEED_COLLISION_WARNING_ENABLED", + "defaultValue": { + "int32Values": [ + 1 + ] + } + }, + { + "property": "VehicleProperty::LOW_SPEED_COLLISION_WARNING_STATE", + "defaultValue": { + "int32Values": [ + "LowSpeedCollisionWarningState::NO_WARNING" + ] + }, + "areas": [ + { + "areaId": 0, + "supportedEnumValues": [ + "ErrorState::NOT_AVAILABLE_SAFETY", + "ErrorState::NOT_AVAILABLE_POOR_VISIBILITY", + "ErrorState::NOT_AVAILABLE_SPEED_HIGH", + "ErrorState::NOT_AVAILABLE_DISABLED", + "LowSpeedCollisionWarningState::NO_WARNING", + "LowSpeedCollisionWarningState::WARNING" + ] + } + ] + }, + { + "property": "VehicleProperty::ELECTRONIC_STABILITY_CONTROL_ENABLED", + "defaultValue": { + "int32Values": [ + 1 + ] + } + }, + { + "property": "VehicleProperty::ELECTRONIC_STABILITY_CONTROL_STATE", + "defaultValue": { + "int32Values": [ + "ElectronicStabilityControlState::ENABLED" + ] + }, + "areas": [ + { + "areaId": 0, + "supportedEnumValues": [ + "ErrorState::NOT_AVAILABLE_SAFETY", + "ErrorState::NOT_AVAILABLE_SPEED_HIGH", + "ErrorState::NOT_AVAILABLE_SPEED_LOW", + "ErrorState::NOT_AVAILABLE_DISABLED", + "ElectronicStabilityControlState::ENABLED", + "ElectronicStabilityControlState::ACTIVATED" + ] + } + ] + }, + { + "property": "VehicleProperty::CROSS_TRAFFIC_MONITORING_ENABLED", + "defaultValue": { + "int32Values": [ + 1 + ] + } + }, + { + "property": "VehicleProperty::CROSS_TRAFFIC_MONITORING_WARNING_STATE", + "defaultValue": { + "int32Values": [ + "CrossTrafficMonitoringWarningState::NO_WARNING" + ] + }, + "areas": [ + { + "areaId": 0, + "supportedEnumValues": [ + "ErrorState::NOT_AVAILABLE_SAFETY", + "ErrorState::NOT_AVAILABLE_POOR_VISIBILITY", + "ErrorState::NOT_AVAILABLE_SPEED_HIGH", + "ErrorState::NOT_AVAILABLE_DISABLED", + "CrossTrafficMonitoringWarningState::NO_WARNING", + "CrossTrafficMonitoringWarningState::WARNING_FRONT_LEFT", + "CrossTrafficMonitoringWarningState::WARNING_FRONT_RIGHT", + "CrossTrafficMonitoringWarningState::WARNING_FRONT_BOTH", + "CrossTrafficMonitoringWarningState::WARNING_REAR_LEFT", + "CrossTrafficMonitoringWarningState::WARNING_REAR_RIGHT", + "CrossTrafficMonitoringWarningState::WARNING_REAR_BOTH" + ] + } + ] } ] } diff --git a/automotive/vehicle/aidl/impl/default_config/config/TestProperties.json b/automotive/vehicle/aidl/impl/default_config/config/TestProperties.json index fd4b0026bd1a5f4570fcd08f835c92e9931b0e5f..73e4d44d0cf61ffe7ebf8a9a8745e534dd04314c 100644 --- a/automotive/vehicle/aidl/impl/default_config/config/TestProperties.json +++ b/automotive/vehicle/aidl/impl/default_config/config/TestProperties.json @@ -1,7 +1,7 @@ { "properties": [ { - "property": "Constants::kMixedTypePropertyForTest", + "property": "TestVendorProperty::MIXED_TYPE_PROPERTY_FOR_TEST", "defaultValue": { "floatValues": [ 4.5 @@ -28,7 +28,7 @@ "changeMode": "VehiclePropertyChangeMode::ON_CHANGE" }, { - "property": "Constants::VENDOR_EXTENSION_BOOLEAN_PROPERTY", + "property": "TestVendorProperty::VENDOR_EXTENSION_BOOLEAN_PROPERTY", "areas": [ { "defaultValue": { @@ -67,7 +67,7 @@ "changeMode": "VehiclePropertyChangeMode::ON_CHANGE" }, { - "property": "Constants::VENDOR_EXTENSION_FLOAT_PROPERTY", + "property": "TestVendorProperty::VENDOR_EXTENSION_FLOAT_PROPERTY", "areas": [ { "defaultValue": { @@ -94,7 +94,7 @@ "changeMode": "VehiclePropertyChangeMode::ON_CHANGE" }, { - "property": "Constants::VENDOR_EXTENSION_INT_PROPERTY", + "property": "TestVendorProperty::VENDOR_EXTENSION_INT_PROPERTY", "areas": [ { "defaultValue": { @@ -131,7 +131,7 @@ "changeMode": "VehiclePropertyChangeMode::ON_CHANGE" }, { - "property": "Constants::VENDOR_EXTENSION_STRING_PROPERTY", + "property": "TestVendorProperty::VENDOR_EXTENSION_STRING_PROPERTY", "defaultValue": { "stringValue": "Vendor String Property" }, @@ -139,7 +139,7 @@ "changeMode": "VehiclePropertyChangeMode::ON_CHANGE" }, { - "property": "Constants::PLACEHOLDER_PROPERTY_INT", + "property": "TestVendorProperty::PLACEHOLDER_PROPERTY_INT", "defaultValue": { "int32Values": [ 0 @@ -149,7 +149,7 @@ "changeMode": "VehiclePropertyChangeMode::ON_CHANGE" }, { - "property": "Constants::PLACEHOLDER_PROPERTY_FLOAT", + "property": "TestVendorProperty::PLACEHOLDER_PROPERTY_FLOAT", "defaultValue": { "floatValues": [ 0.0 @@ -159,7 +159,7 @@ "changeMode": "VehiclePropertyChangeMode::ON_CHANGE" }, { - "property": "Constants::PLACEHOLDER_PROPERTY_BOOLEAN", + "property": "TestVendorProperty::PLACEHOLDER_PROPERTY_BOOLEAN", "defaultValue": { "int32Values": [ 0 @@ -169,7 +169,7 @@ "changeMode": "VehiclePropertyChangeMode::ON_CHANGE" }, { - "property": "Constants::PLACEHOLDER_PROPERTY_STRING", + "property": "TestVendorProperty::PLACEHOLDER_PROPERTY_STRING", "defaultValue": { "stringValue": "Test" }, @@ -177,12 +177,12 @@ "changeMode": "VehiclePropertyChangeMode::ON_CHANGE" }, { - "property": "Constants::ECHO_REVERSE_BYTES", + "property": "TestVendorProperty::ECHO_REVERSE_BYTES", "access": "VehiclePropertyAccess::READ_WRITE", "changeMode": "VehiclePropertyChangeMode::ON_CHANGE" }, { - "property": "Constants::VENDOR_PROPERTY_ID", + "property": "TestVendorProperty::VENDOR_PROPERTY_FOR_ERROR_CODE_TESTING", "access": "VehiclePropertyAccess::READ_WRITE", "changeMode": "VehiclePropertyChangeMode::ON_CHANGE" }, @@ -194,13 +194,13 @@ ] }, "configArray": [ - "Constants::kMixedTypePropertyForTest", + "TestVendorProperty::MIXED_TYPE_PROPERTY_FOR_TEST", "VehicleVendorPermission::PERMISSION_GET_VENDOR_CATEGORY_INFO", "VehicleVendorPermission::PERMISSION_SET_VENDOR_CATEGORY_INFO", - "Constants::VENDOR_EXTENSION_INT_PROPERTY", + "TestVendorProperty::VENDOR_EXTENSION_INT_PROPERTY", "VehicleVendorPermission::PERMISSION_GET_VENDOR_CATEGORY_SEAT", "VehicleVendorPermission::PERMISSION_NOT_ACCESSIBLE", - "Constants::VENDOR_EXTENSION_FLOAT_PROPERTY", + "TestVendorProperty::VENDOR_EXTENSION_FLOAT_PROPERTY", "VehicleVendorPermission::PERMISSION_DEFAULT", "VehicleVendorPermission::PERMISSION_DEFAULT" ] diff --git a/automotive/vehicle/aidl/impl/default_config/config/VendorClusterTestProperties.json b/automotive/vehicle/aidl/impl/default_config/config/VendorClusterTestProperties.json index 3a1a783b84aa2b444d3f208ded713564e4765f17..8c2bc93e1cd235758b09a74d34e24c8a513d440f 100644 --- a/automotive/vehicle/aidl/impl/default_config/config/VendorClusterTestProperties.json +++ b/automotive/vehicle/aidl/impl/default_config/config/VendorClusterTestProperties.json @@ -1,17 +1,17 @@ { "properties": [ { - "property": "Constants::VENDOR_CLUSTER_SWITCH_UI", + "property": "TestVendorProperty::VENDOR_CLUSTER_SWITCH_UI", "access": "VehiclePropertyAccess::WRITE", "changeMode": "VehiclePropertyChangeMode::ON_CHANGE" }, { - "property": "Constants::VENDOR_CLUSTER_DISPLAY_STATE", + "property": "TestVendorProperty::VENDOR_CLUSTER_DISPLAY_STATE", "access": "VehiclePropertyAccess::WRITE", "changeMode": "VehiclePropertyChangeMode::ON_CHANGE" }, { - "property": "Constants::VENDOR_CLUSTER_REPORT_STATE", + "property": "TestVendorProperty::VENDOR_CLUSTER_REPORT_STATE", "defaultValue": { "int32Values": [ 0, @@ -44,7 +44,7 @@ "Value means 0 /* Off */, -1, -1, -1, -1 /* Bounds */, -1, -1, -1, -1 /* Insets */, 0 /* ClusterHome */, -1 /* ClusterNone */" }, { - "property": "Constants::VENDOR_CLUSTER_REQUEST_DISPLAY", + "property": "TestVendorProperty::VENDOR_CLUSTER_REQUEST_DISPLAY", "defaultValue": { "int32Values": [ 0 @@ -55,7 +55,7 @@ "comment": "0 means ClusterHome" }, { - "property": "Constants::VENDOR_CLUSTER_NAVIGATION_STATE", + "property": "TestVendorProperty::VENDOR_CLUSTER_NAVIGATION_STATE", "access": "VehiclePropertyAccess::READ", "changeMode": "VehiclePropertyChangeMode::ON_CHANGE" } diff --git a/automotive/vehicle/aidl/impl/fake_impl/hardware/Android.bp b/automotive/vehicle/aidl/impl/fake_impl/hardware/Android.bp index 4c17cded42a159cb3de115687aff8a2cf25faf18..e75f6485b8e3cf786a99121433c3e311bf1ea65e 100644 --- a/automotive/vehicle/aidl/impl/fake_impl/hardware/Android.bp +++ b/automotive/vehicle/aidl/impl/fake_impl/hardware/Android.bp @@ -21,7 +21,10 @@ package { cc_library { name: "FakeVehicleHardware", vendor: true, - srcs: ["src/*.cpp"], + srcs: [ + "src/*.cpp", + ":VhalTestVendorProperties", + ], local_include_dirs: ["include"], export_include_dirs: ["include"], cflags: ["-DENABLE_VEHICLE_HAL_TEST_PROPERTIES"], @@ -35,7 +38,7 @@ cc_defaults { name: "FakeVehicleHardwareDefaults", header_libs: [ "IVehicleHardware", - "VehicleHalTestUtilHeaders", + "libbinder_headers", ], export_header_lib_headers: ["IVehicleHardware"], static_libs: [ 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 af1bb1d16d22e59c4cd30553330eb70ee3860634..8cd92b3b896777a67eb75f981ac540686722b675 100644 --- a/automotive/vehicle/aidl/impl/fake_impl/hardware/include/FakeVehicleHardware.h +++ b/automotive/vehicle/aidl/impl/fake_impl/hardware/include/FakeVehicleHardware.h @@ -36,6 +36,7 @@ #include #include #include +#include #include namespace android { @@ -90,9 +91,13 @@ class FakeVehicleHardware : public IVehicleHardware { void registerOnPropertySetErrorEvent( std::unique_ptr callback) override; - // Update the sample rate for the [propId, areaId] pair. - aidl::android::hardware::automotive::vehicle::StatusCode updateSampleRate( - int32_t propId, int32_t areaId, float sampleRate) override; + // Subscribe to a new [propId, areaId] or change the update rate. + aidl::android::hardware::automotive::vehicle::StatusCode subscribe( + aidl::android::hardware::automotive::vehicle::SubscribeOptions options) override; + + // Unsubscribe to a [propId, areaId]. + aidl::android::hardware::automotive::vehicle::StatusCode unsubscribe(int32_t propId, + int32_t areaId) override; protected: // mValuePool is also used in mServerSidePropStore. @@ -137,6 +142,16 @@ class FakeVehicleHardware : public IVehicleHardware { void handleRequestsOnce(); }; + struct RefreshInfo { + VehiclePropertyStore::EventMode eventMode; + int64_t intervalInNanos; + }; + + struct ActionForInterval { + std::unordered_set propIdAreaIdsToRefresh; + std::shared_ptr recurrentAction; + }; + const std::unique_ptr mFakeObd2Frame; const std::unique_ptr mFakeUserHal; // RecurrentTimer is thread-safe. @@ -149,10 +164,12 @@ class FakeVehicleHardware : public IVehicleHardware { std::unique_ptr mOnPropertySetErrorCallback; std::mutex mLock; - std::unordered_map, PropIdAreaIdHash> - mRecurrentActions GUARDED_BY(mLock); + std::unordered_map mRefreshInfoByPropIdAreaId + GUARDED_BY(mLock); + std::unordered_map mActionByIntervalInNanos GUARDED_BY(mLock); std::unordered_map mSavedProps GUARDED_BY(mLock); + std::unordered_set mSubOnChangePropIdAreaIds GUARDED_BY(mLock); // PendingRequestHandler is thread-safe. mutable PendingRequestHandler @@ -161,6 +178,9 @@ class FakeVehicleHardware : public IVehicleHardware { aidl::android::hardware::automotive::vehicle::SetValueRequest> mPendingSetValueRequests; + // Set of HVAC properties dependent on HVAC_POWER_ON + std::unordered_set hvacPowerDependentProps; + const bool mForceOverride; bool mAddExtraTestVendorConfigs; @@ -172,7 +192,12 @@ class FakeVehicleHardware : public IVehicleHardware { void storePropInitialValue(const ConfigDeclaration& config); // The callback that would be called when a vehicle property value change happens. void onValueChangeCallback( - const aidl::android::hardware::automotive::vehicle::VehiclePropValue& value); + const aidl::android::hardware::automotive::vehicle::VehiclePropValue& value) + EXCLUDES(mLock); + // The callback that would be called when multiple vehicle property value changes happen. + void onValuesChangeCallback( + std::vector values) + EXCLUDES(mLock); // Load the config files in format '*.json' from the directory and parse the config files // into a map from property ID to ConfigDeclarations. void loadPropConfigsFromDir(const std::string& dirPath, @@ -192,11 +217,14 @@ class FakeVehicleHardware : public IVehicleHardware { VhalResult maybeSetSpecialValue( const aidl::android::hardware::automotive::vehicle::VehiclePropValue& value, bool* isSpecialValue); + VhalResult isCruiseControlTypeStandard() const; ValueResultType maybeGetSpecialValue( const aidl::android::hardware::automotive::vehicle::VehiclePropValue& value, bool* isSpecialValue) const; VhalResult setApPowerStateReport( const aidl::android::hardware::automotive::vehicle::VehiclePropValue& value); + VhalResult setApPowerStateReqShutdown( + const aidl::android::hardware::automotive::vehicle::VehiclePropValue& value); VehiclePropValuePool::RecyclableType createApPowerStateReq( aidl::android::hardware::automotive::vehicle::VehicleApPowerStateReq state); VehiclePropValuePool::RecyclableType createAdasStateReq(int32_t propertyId, int32_t areaId, @@ -209,6 +237,9 @@ class FakeVehicleHardware : public IVehicleHardware { const aidl::android::hardware::automotive::vehicle::VehiclePropValue& value) const; bool isHvacPropAndHvacNotAvailable(int32_t propId, int32_t areaId) const; VhalResult isAdasPropertyAvailable(int32_t adasStatePropertyId) const; + VhalResult synchronizeHvacTemp(int32_t hvacDualOnAreaId, + std::optional newTempC) const; + std::optional getSyncedAreaIdIfHvacDualOn(int32_t hvacTemperatureSetAreaId) const; std::unordered_map loadConfigDeclarations(); @@ -250,11 +281,21 @@ class FakeVehicleHardware : public IVehicleHardware { const aidl::android::hardware::automotive::vehicle::SetValueRequest& request); std::string genFakeDataCommand(const std::vector& options); - void sendHvacPropertiesCurrentValues(int32_t areaId); + void sendHvacPropertiesCurrentValues(int32_t areaId, int32_t hvacPowerOnVal); void sendAdasPropertiesState(int32_t propertyId, int32_t state); void generateVendorConfigs( std::vector&) const; + aidl::android::hardware::automotive::vehicle::StatusCode subscribePropIdAreaIdLocked( + int32_t propId, int32_t areaId, float sampleRateHz, bool enableVariableUpdateRate, + const aidl::android::hardware::automotive::vehicle::VehiclePropConfig& + vehiclePropConfig) REQUIRES(mLock); + + void registerRefreshLocked(PropIdAreaId propIdAreaId, VehiclePropertyStore::EventMode eventMode, + float sampleRateHz) REQUIRES(mLock); + void unregisterRefreshLocked(PropIdAreaId propIdAreaId) REQUIRES(mLock); + void refreshTimeStampForInterval(int64_t intervalInNanos) EXCLUDES(mLock); + static aidl::android::hardware::automotive::vehicle::VehiclePropValue createHwInputKeyProp( aidl::android::hardware::automotive::vehicle::VehicleHwKeyInputAction action, int32_t keyCode, int32_t targetDisplay); @@ -268,6 +309,10 @@ class FakeVehicleHardware : public IVehicleHardware { static std::string genFakeDataHelp(); static std::string parseErrMsg(std::string fieldName, std::string value, std::string type); + static bool isVariableUpdateRateSupported( + const aidl::android::hardware::automotive::vehicle::VehiclePropConfig& + vehiclePropConfig, + int32_t areaId); }; } // namespace fake 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 250a226bd596902fd3e97172afa7e155b1f8395c..dced62446c2182d8f7f965910f5f29b70549ea1a 100644 --- a/automotive/vehicle/aidl/impl/fake_impl/hardware/src/FakeVehicleHardware.cpp +++ b/automotive/vehicle/aidl/impl/fake_impl/hardware/src/FakeVehicleHardware.cpp @@ -24,7 +24,6 @@ #include #include #include -#include #include #include @@ -32,6 +31,7 @@ #include #include #include +#include #include #include #include @@ -51,6 +51,12 @@ namespace fake { namespace { +using ::aidl::android::hardware::automotive::vehicle::CruiseControlCommand; +using ::aidl::android::hardware::automotive::vehicle::CruiseControlType; +using ::aidl::android::hardware::automotive::vehicle::DriverDistractionState; +using ::aidl::android::hardware::automotive::vehicle::DriverDistractionWarning; +using ::aidl::android::hardware::automotive::vehicle::DriverDrowsinessAttentionState; +using ::aidl::android::hardware::automotive::vehicle::DriverDrowsinessAttentionWarning; using ::aidl::android::hardware::automotive::vehicle::ErrorState; using ::aidl::android::hardware::automotive::vehicle::GetValueRequest; using ::aidl::android::hardware::automotive::vehicle::GetValueResult; @@ -58,12 +64,16 @@ using ::aidl::android::hardware::automotive::vehicle::RawPropValues; using ::aidl::android::hardware::automotive::vehicle::SetValueRequest; using ::aidl::android::hardware::automotive::vehicle::SetValueResult; using ::aidl::android::hardware::automotive::vehicle::StatusCode; +using ::aidl::android::hardware::automotive::vehicle::SubscribeOptions; +using ::aidl::android::hardware::automotive::vehicle::toString; using ::aidl::android::hardware::automotive::vehicle::VehicleApPowerStateReport; using ::aidl::android::hardware::automotive::vehicle::VehicleApPowerStateReq; +using ::aidl::android::hardware::automotive::vehicle::VehicleArea; using ::aidl::android::hardware::automotive::vehicle::VehicleHwKeyInputAction; using ::aidl::android::hardware::automotive::vehicle::VehiclePropConfig; using ::aidl::android::hardware::automotive::vehicle::VehicleProperty; using ::aidl::android::hardware::automotive::vehicle::VehiclePropertyAccess; +using ::aidl::android::hardware::automotive::vehicle::VehiclePropertyChangeMode; using ::aidl::android::hardware::automotive::vehicle::VehiclePropertyGroup; using ::aidl::android::hardware::automotive::vehicle::VehiclePropertyStatus; using ::aidl::android::hardware::automotive::vehicle::VehiclePropertyType; @@ -84,14 +94,12 @@ using ::android::base::StringPrintf; // getPropertiesAsync, and setPropertiesAsync. // 0x21403000 constexpr int32_t STARTING_VENDOR_CODE_PROPERTIES_FOR_TEST = - 0x3000 | toInt(testpropertyutils_impl::VehiclePropertyGroup::VENDOR) | - toInt(testpropertyutils_impl::VehicleArea::GLOBAL) | - toInt(testpropertyutils_impl::VehiclePropertyType::INT32); + 0x3000 | toInt(VehiclePropertyGroup::VENDOR) | toInt(VehicleArea::GLOBAL) | + toInt(VehiclePropertyType::INT32); // 0x21405000 constexpr int32_t ENDING_VENDOR_CODE_PROPERTIES_FOR_TEST = - 0x5000 | toInt(testpropertyutils_impl::VehiclePropertyGroup::VENDOR) | - toInt(testpropertyutils_impl::VehicleArea::GLOBAL) | - toInt(testpropertyutils_impl::VehiclePropertyType::INT32); + 0x5000 | toInt(VehiclePropertyGroup::VENDOR) | toInt(VehicleArea::GLOBAL) | + toInt(VehiclePropertyType::INT32); // The directory for default property configuration file. // For config file format, see impl/default_config/config/README.md. constexpr char DEFAULT_CONFIG_DIR[] = "/vendor/etc/automotive/vhalconfig/"; @@ -102,7 +110,7 @@ constexpr char OVERRIDE_CONFIG_DIR[] = "/vendor/etc/automotive/vhaloverride/"; // overwrite the default configs. constexpr char OVERRIDE_PROPERTY[] = "persist.vendor.vhal_init_value_override"; constexpr char POWER_STATE_REQ_CONFIG_PROPERTY[] = "ro.vendor.fake_vhal.ap_power_state_req.config"; -// The value to be returned if VENDOR_PROPERTY_ID is set as the property +// The value to be returned if VENDOR_PROPERTY_FOR_ERROR_CODE_TESTING is set as the property constexpr int VENDOR_ERROR_CODE = 0x00ab0005; // A list of supported options for "--set" command. const std::unordered_set SET_PROP_OPTIONS = { @@ -188,6 +196,56 @@ const std::unordered_map> mAdasEnabledPropToAdasPr toInt(VehicleProperty::HANDS_ON_DETECTION_WARNING), }, }, + // Driver Drowsiness and Attention + { + toInt(VehicleProperty::DRIVER_DROWSINESS_ATTENTION_SYSTEM_ENABLED), + { + toInt(VehicleProperty::DRIVER_DROWSINESS_ATTENTION_STATE), + }, + }, + // Driver Drowsiness and Attention Warning + { + toInt(VehicleProperty::DRIVER_DROWSINESS_ATTENTION_WARNING_ENABLED), + { + toInt(VehicleProperty::DRIVER_DROWSINESS_ATTENTION_WARNING), + }, + }, + // Driver Distraction + { + toInt(VehicleProperty::DRIVER_DISTRACTION_SYSTEM_ENABLED), + { + toInt(VehicleProperty::DRIVER_DISTRACTION_STATE), + toInt(VehicleProperty::DRIVER_DISTRACTION_WARNING), + }, + }, + // Driver Distraction Warning + { + toInt(VehicleProperty::DRIVER_DISTRACTION_WARNING_ENABLED), + { + toInt(VehicleProperty::DRIVER_DISTRACTION_WARNING), + }, + }, + // LSCW + { + toInt(VehicleProperty::LOW_SPEED_COLLISION_WARNING_ENABLED), + { + toInt(VehicleProperty::LOW_SPEED_COLLISION_WARNING_STATE), + }, + }, + // ESC + { + toInt(VehicleProperty::ELECTRONIC_STABILITY_CONTROL_ENABLED), + { + toInt(VehicleProperty::ELECTRONIC_STABILITY_CONTROL_STATE), + }, + }, + // CTMW + { + toInt(VehicleProperty::CROSS_TRAFFIC_MONITORING_ENABLED), + { + toInt(VehicleProperty::CROSS_TRAFFIC_MONITORING_WARNING_STATE), + }, + }, }; } // namespace @@ -199,6 +257,11 @@ void FakeVehicleHardware::storePropInitialValue(const ConfigDeclaration& config) bool globalProp = isGlobalProp(propId); size_t numAreas = globalProp ? 1 : vehiclePropConfig.areaConfigs.size(); + if (propId == toInt(VehicleProperty::HVAC_POWER_ON)) { + const auto& configArray = vehiclePropConfig.configArray; + hvacPowerDependentProps.insert(configArray.begin(), configArray.end()); + } + for (size_t i = 0; i < numAreas; i++) { int32_t curArea = globalProp ? 0 : vehiclePropConfig.areaConfigs[i].areaId; @@ -295,17 +358,18 @@ void FakeVehicleHardware::init() { } // OBD2_LIVE_FRAME and OBD2_FREEZE_FRAME must be configured in default configs. - auto maybeObd2LiveFrame = mServerSidePropStore->getConfig(OBD2_LIVE_FRAME); + auto maybeObd2LiveFrame = mServerSidePropStore->getPropConfig(OBD2_LIVE_FRAME); if (maybeObd2LiveFrame.has_value()) { - mFakeObd2Frame->initObd2LiveFrame(*maybeObd2LiveFrame.value()); + mFakeObd2Frame->initObd2LiveFrame(maybeObd2LiveFrame.value()); } - auto maybeObd2FreezeFrame = mServerSidePropStore->getConfig(OBD2_FREEZE_FRAME); + auto maybeObd2FreezeFrame = mServerSidePropStore->getPropConfig(OBD2_FREEZE_FRAME); if (maybeObd2FreezeFrame.has_value()) { - mFakeObd2Frame->initObd2FreezeFrame(*maybeObd2FreezeFrame.value()); + mFakeObd2Frame->initObd2FreezeFrame(maybeObd2FreezeFrame.value()); } - mServerSidePropStore->setOnValueChangeCallback( - [this](const VehiclePropValue& value) { return onValueChangeCallback(value); }); + mServerSidePropStore->setOnValuesChangeCallback([this](std::vector values) { + return onValuesChangeCallback(std::move(values)); + }); } std::vector FakeVehicleHardware::getAllPropertyConfigs() const { @@ -341,6 +405,25 @@ VehiclePropValuePool::RecyclableType FakeVehicleHardware::createAdasStateReq(int return req; } +VhalResult FakeVehicleHardware::setApPowerStateReqShutdown(const VehiclePropValue& value) { + if (value.value.int32Values.size() != 1) { + return StatusError(StatusCode::INVALID_ARG) + << "Failed to set SHUTDOWN_REQUEST, expect 1 int value: " + << "VehicleApPowerStateShutdownParam"; + } + int powerStateShutdownParam = value.value.int32Values[0]; + auto prop = createApPowerStateReq(VehicleApPowerStateReq::SHUTDOWN_PREPARE); + prop->value.int32Values[1] = powerStateShutdownParam; + if (auto writeResult = mServerSidePropStore->writeValue( + std::move(prop), /*updateStatus=*/true, VehiclePropertyStore::EventMode::ALWAYS); + !writeResult.ok()) { + return StatusError(getErrorCode(writeResult)) + << "failed to write AP_POWER_STATE_REQ into property store, error: " + << getErrorMsg(writeResult); + } + return {}; +} + VhalResult FakeVehicleHardware::setApPowerStateReport(const VehiclePropValue& value) { auto updatedValue = mValuePool->obtain(value); updatedValue->timestamp = elapsedRealtimeNano(); @@ -406,7 +489,7 @@ int FakeVehicleHardware::getHvacTempNumIncrements(int requestedTemp, int minTemp int increment) { requestedTemp = std::max(requestedTemp, minTemp); requestedTemp = std::min(requestedTemp, maxTemp); - int numIncrements = (requestedTemp - minTemp) / increment; + int numIncrements = std::round((requestedTemp - minTemp) / static_cast(increment)); return numIncrements; } @@ -444,7 +527,7 @@ void FakeVehicleHardware::updateHvacTemperatureValueSuggestionInput( VhalResult FakeVehicleHardware::setHvacTemperatureValueSuggestion( const VehiclePropValue& hvacTemperatureValueSuggestion) { auto hvacTemperatureSetConfigResult = - mServerSidePropStore->getConfig(toInt(VehicleProperty::HVAC_TEMPERATURE_SET)); + mServerSidePropStore->getPropConfig(toInt(VehicleProperty::HVAC_TEMPERATURE_SET)); if (!hvacTemperatureSetConfigResult.ok()) { return StatusError(getErrorCode(hvacTemperatureSetConfigResult)) << StringPrintf( @@ -471,7 +554,7 @@ VhalResult FakeVehicleHardware::setHvacTemperatureValueSuggestion( } auto updatedValue = mValuePool->obtain(hvacTemperatureValueSuggestion); - const auto& hvacTemperatureSetConfigArray = hvacTemperatureSetConfigResult.value()->configArray; + const auto& hvacTemperatureSetConfigArray = hvacTemperatureSetConfigResult.value().configArray; auto& hvacTemperatureValueSuggestionInput = updatedValue->value.floatValues; updateHvacTemperatureValueSuggestionInput(hvacTemperatureSetConfigArray, @@ -491,9 +574,7 @@ VhalResult FakeVehicleHardware::setHvacTemperatureValueSuggestion( } bool FakeVehicleHardware::isHvacPropAndHvacNotAvailable(int32_t propId, int32_t areaId) const { - std::unordered_set powerProps(std::begin(HVAC_POWER_PROPERTIES), - std::end(HVAC_POWER_PROPERTIES)); - if (powerProps.count(propId)) { + if (hvacPowerDependentProps.count(propId)) { auto hvacPowerOnResults = mServerSidePropStore->readValuesForProperty(toInt(VehicleProperty::HVAC_POWER_ON)); if (!hvacPowerOnResults.ok()) { @@ -575,6 +656,65 @@ VhalResult FakeVehicleHardware::setUserHalProp(const VehiclePropValue& val return {}; } +VhalResult FakeVehicleHardware::synchronizeHvacTemp(int32_t hvacDualOnAreaId, + std::optional newTempC) const { + auto hvacTemperatureSetResults = mServerSidePropStore->readValuesForProperty( + toInt(VehicleProperty::HVAC_TEMPERATURE_SET)); + if (!hvacTemperatureSetResults.ok()) { + return StatusError(StatusCode::NOT_AVAILABLE) + << "Failed to get HVAC_TEMPERATURE_SET, error: " + << getErrorMsg(hvacTemperatureSetResults); + } + auto& hvacTemperatureSetValues = hvacTemperatureSetResults.value(); + std::optional tempCToSynchronize = newTempC; + for (size_t i = 0; i < hvacTemperatureSetValues.size(); i++) { + int32_t areaId = hvacTemperatureSetValues[i]->areaId; + if ((hvacDualOnAreaId & areaId) != areaId) { + continue; + } + if (hvacTemperatureSetValues[i]->status != VehiclePropertyStatus::AVAILABLE) { + continue; + } + // When HVAC_DUAL_ON is initially enabled, synchronize all area IDs + // to the temperature of the first area ID, which is the driver's. + if (!tempCToSynchronize.has_value()) { + tempCToSynchronize = hvacTemperatureSetValues[i]->value.floatValues[0]; + continue; + } + auto updatedValue = std::move(hvacTemperatureSetValues[i]); + updatedValue->value.floatValues[0] = tempCToSynchronize.value(); + updatedValue->timestamp = elapsedRealtimeNano(); + // This will trigger a property change event for the current hvac property value. + auto writeResult = + mServerSidePropStore->writeValue(std::move(updatedValue), /*updateStatus=*/true, + VehiclePropertyStore::EventMode::ALWAYS); + if (!writeResult.ok()) { + return StatusError(getErrorCode(writeResult)) + << "Failed to write value into property store, error: " + << getErrorMsg(writeResult); + } + } + return {}; +} + +std::optional FakeVehicleHardware::getSyncedAreaIdIfHvacDualOn( + int32_t hvacTemperatureSetAreaId) const { + auto hvacDualOnResults = + mServerSidePropStore->readValuesForProperty(toInt(VehicleProperty::HVAC_DUAL_ON)); + if (!hvacDualOnResults.ok()) { + return std::nullopt; + } + auto& hvacDualOnValues = hvacDualOnResults.value(); + for (size_t i = 0; i < hvacDualOnValues.size(); i++) { + if ((hvacDualOnValues[i]->areaId & hvacTemperatureSetAreaId) == hvacTemperatureSetAreaId && + hvacDualOnValues[i]->value.int32Values.size() == 1 && + hvacDualOnValues[i]->value.int32Values[0] == 1) { + return hvacDualOnValues[i]->areaId; + } + } + return std::nullopt; +} + FakeVehicleHardware::ValueResultType FakeVehicleHardware::getUserHalProp( const VehiclePropValue& value) const { auto propId = value.prop; @@ -596,6 +736,18 @@ FakeVehicleHardware::ValueResultType FakeVehicleHardware::getUserHalProp( } } +VhalResult FakeVehicleHardware::isCruiseControlTypeStandard() const { + auto isCruiseControlTypeAvailableResult = + isAdasPropertyAvailable(toInt(VehicleProperty::CRUISE_CONTROL_TYPE)); + if (!isCruiseControlTypeAvailableResult.ok()) { + return isCruiseControlTypeAvailableResult.error(); + } + auto cruiseControlTypeValue = + mServerSidePropStore->readValue(toInt(VehicleProperty::CRUISE_CONTROL_TYPE)); + return cruiseControlTypeValue.value()->value.int32Values[0] == + toInt(CruiseControlType::STANDARD); +} + FakeVehicleHardware::ValueResultType FakeVehicleHardware::maybeGetSpecialValue( const VehiclePropValue& value, bool* isSpecialValue) const { *isSpecialValue = false; @@ -623,6 +775,7 @@ FakeVehicleHardware::ValueResultType FakeVehicleHardware::maybeGetSpecialValue( return StatusError(StatusCode::NOT_AVAILABLE_DISABLED) << "hvac not available"; } + VhalResult isAdasPropertyAvailableResult; switch (propId) { case OBD2_FREEZE_FRAME: *isSpecialValue = true; @@ -638,23 +791,40 @@ FakeVehicleHardware::ValueResultType FakeVehicleHardware::maybeGetSpecialValue( result.value()->timestamp = elapsedRealtimeNano(); } return result; - case ECHO_REVERSE_BYTES: + case toInt(TestVendorProperty::ECHO_REVERSE_BYTES): *isSpecialValue = true; return getEchoReverseBytes(value); - case VENDOR_PROPERTY_ID: + case toInt(TestVendorProperty::VENDOR_PROPERTY_FOR_ERROR_CODE_TESTING): *isSpecialValue = true; return StatusError((StatusCode)VENDOR_ERROR_CODE); case toInt(VehicleProperty::CRUISE_CONTROL_TARGET_SPEED): - [[fallthrough]]; + isAdasPropertyAvailableResult = + isAdasPropertyAvailable(toInt(VehicleProperty::CRUISE_CONTROL_STATE)); + if (!isAdasPropertyAvailableResult.ok()) { + *isSpecialValue = true; + return isAdasPropertyAvailableResult.error(); + } + return nullptr; case toInt(VehicleProperty::ADAPTIVE_CRUISE_CONTROL_TARGET_TIME_GAP): [[fallthrough]]; case toInt(VehicleProperty::ADAPTIVE_CRUISE_CONTROL_LEAD_VEHICLE_MEASURED_DISTANCE): { - auto isAdasPropertyAvailableResult = + isAdasPropertyAvailableResult = isAdasPropertyAvailable(toInt(VehicleProperty::CRUISE_CONTROL_STATE)); if (!isAdasPropertyAvailableResult.ok()) { *isSpecialValue = true; return isAdasPropertyAvailableResult.error(); } + auto isCruiseControlTypeStandardResult = isCruiseControlTypeStandard(); + if (!isCruiseControlTypeStandardResult.ok()) { + *isSpecialValue = true; + return isCruiseControlTypeStandardResult.error(); + } + if (isCruiseControlTypeStandardResult.value()) { + *isSpecialValue = true; + return StatusError(StatusCode::NOT_AVAILABLE_DISABLED) + << "tried to get target time gap or lead vehicle measured distance value " + << "while on a standard CC setting"; + } return nullptr; } default: @@ -681,9 +851,8 @@ FakeVehicleHardware::ValueResultType FakeVehicleHardware::getEchoReverseBytes( return std::move(gotValue); } -void FakeVehicleHardware::sendHvacPropertiesCurrentValues(int32_t areaId) { - for (size_t i = 0; i < sizeof(HVAC_POWER_PROPERTIES) / sizeof(int32_t); i++) { - int powerPropId = HVAC_POWER_PROPERTIES[i]; +void FakeVehicleHardware::sendHvacPropertiesCurrentValues(int32_t areaId, int32_t hvacPowerOnVal) { + for (auto& powerPropId : hvacPowerDependentProps) { auto powerPropResults = mServerSidePropStore->readValuesForProperty(powerPropId); if (!powerPropResults.ok()) { ALOGW("failed to get power prop 0x%x, error: %s", powerPropId, @@ -694,7 +863,8 @@ void FakeVehicleHardware::sendHvacPropertiesCurrentValues(int32_t areaId) { for (size_t j = 0; j < powerPropValues.size(); j++) { auto powerPropValue = std::move(powerPropValues[j]); if ((powerPropValue->areaId & areaId) == powerPropValue->areaId) { - powerPropValue->status = VehiclePropertyStatus::AVAILABLE; + powerPropValue->status = hvacPowerOnVal ? VehiclePropertyStatus::AVAILABLE + : VehiclePropertyStatus::UNAVAILABLE; powerPropValue->timestamp = elapsedRealtimeNano(); // This will trigger a property change event for the current hvac property value. mServerSidePropStore->writeValue(std::move(powerPropValue), /*updateStatus=*/true, @@ -707,15 +877,21 @@ void FakeVehicleHardware::sendHvacPropertiesCurrentValues(int32_t areaId) { void FakeVehicleHardware::sendAdasPropertiesState(int32_t propertyId, int32_t state) { auto& adasDependentPropIds = mAdasEnabledPropToAdasPropWithErrorState.find(propertyId)->second; for (auto dependentPropId : adasDependentPropIds) { - auto dependentPropConfigResult = mServerSidePropStore->getConfig(dependentPropId); + auto dependentPropConfigResult = mServerSidePropStore->getPropConfig(dependentPropId); if (!dependentPropConfigResult.ok()) { ALOGW("Failed to get config for ADAS property 0x%x, error: %s", dependentPropId, getErrorMsg(dependentPropConfigResult).c_str()); continue; } auto& dependentPropConfig = dependentPropConfigResult.value(); - for (auto& areaConfig : dependentPropConfig->areaConfigs) { - auto propValue = createAdasStateReq(dependentPropId, areaConfig.areaId, state); + for (auto& areaConfig : dependentPropConfig.areaConfigs) { + int32_t hardcoded_state = state; + // TODO: restore old/initial values here instead of hardcoded value (b/295542701) + if (state == 1 && dependentPropId == toInt(VehicleProperty::CRUISE_CONTROL_TYPE)) { + hardcoded_state = toInt(CruiseControlType::ADAPTIVE); + } + auto propValue = + createAdasStateReq(dependentPropId, areaConfig.areaId, hardcoded_state); // This will trigger a property change event for the current ADAS property value. mServerSidePropStore->writeValue(std::move(propValue), /*updateStatus=*/true, VehiclePropertyStore::EventMode::ALWAYS); @@ -740,13 +916,6 @@ VhalResult FakeVehicleHardware::maybeSetSpecialValue(const VehiclePropValu return setUserHalProp(value); } - if (propId == toInt(VehicleProperty::HVAC_POWER_ON) && value.value.int32Values.size() == 1 && - value.value.int32Values[0] == 1) { - // If we are turning HVAC power on, send current hvac property values through on change - // event. - sendHvacPropertiesCurrentValues(value.areaId); - } - if (isHvacPropAndHvacNotAvailable(propId, value.areaId)) { *isSpecialValue = true; return StatusError(StatusCode::NOT_AVAILABLE_DISABLED) << "hvac not available"; @@ -762,10 +931,18 @@ VhalResult FakeVehicleHardware::maybeSetSpecialValue(const VehiclePropValu } } + VhalResult isAdasPropertyAvailableResult; + VhalResult isCruiseControlTypeStandardResult; switch (propId) { case toInt(VehicleProperty::AP_POWER_STATE_REPORT): *isSpecialValue = true; return setApPowerStateReport(value); + case toInt(VehicleProperty::SHUTDOWN_REQUEST): + // If we receive SHUTDOWN_REQUEST, we should send this to an external component which + // should shutdown Android system via sending an AP_POWER_STATE_REQ event. Here we have + // no external components to notify, so we just send the event. + *isSpecialValue = true; + return setApPowerStateReqShutdown(value); case toInt(VehicleProperty::VEHICLE_MAP_SERVICE): // Placeholder for future implementation of VMS property in the default hal. For // now, just returns OK; otherwise, hal clients crash with property not supported. @@ -774,14 +951,46 @@ VhalResult FakeVehicleHardware::maybeSetSpecialValue(const VehiclePropValu case OBD2_FREEZE_FRAME_CLEAR: *isSpecialValue = true; return mFakeObd2Frame->clearObd2FreezeFrames(value); - case VENDOR_PROPERTY_ID: + case toInt(TestVendorProperty::VENDOR_PROPERTY_FOR_ERROR_CODE_TESTING): *isSpecialValue = true; return StatusError((StatusCode)VENDOR_ERROR_CODE); + case toInt(VehicleProperty::HVAC_POWER_ON): + if (value.value.int32Values.size() != 1) { + *isSpecialValue = true; + return StatusError(StatusCode::INVALID_ARG) + << "HVAC_POWER_ON requires only one int32 value"; + } + // When changing HVAC power state, send current hvac property values + // through on change event. + sendHvacPropertiesCurrentValues(value.areaId, value.value.int32Values[0]); + return {}; case toInt(VehicleProperty::HVAC_TEMPERATURE_VALUE_SUGGESTION): *isSpecialValue = true; return setHvacTemperatureValueSuggestion(value); + case toInt(VehicleProperty::HVAC_TEMPERATURE_SET): + if (value.value.floatValues.size() != 1) { + *isSpecialValue = true; + return StatusError(StatusCode::INVALID_ARG) + << "HVAC_DUAL_ON requires only one float value"; + } + if (auto hvacDualOnAreaId = getSyncedAreaIdIfHvacDualOn(value.areaId); + hvacDualOnAreaId.has_value()) { + *isSpecialValue = true; + return synchronizeHvacTemp(hvacDualOnAreaId.value(), value.value.floatValues[0]); + } + return {}; + case toInt(VehicleProperty::HVAC_DUAL_ON): + if (value.value.int32Values.size() != 1) { + *isSpecialValue = true; + return StatusError(StatusCode::INVALID_ARG) + << "HVAC_DUAL_ON requires only one int32 value"; + } + if (value.value.int32Values[0] == 1) { + synchronizeHvacTemp(value.areaId, std::nullopt); + } + return {}; case toInt(VehicleProperty::LANE_CENTERING_ASSIST_COMMAND): { - auto isAdasPropertyAvailableResult = + isAdasPropertyAvailableResult = isAdasPropertyAvailable(toInt(VehicleProperty::LANE_CENTERING_ASSIST_STATE)); if (!isAdasPropertyAvailableResult.ok()) { *isSpecialValue = true; @@ -789,14 +998,47 @@ VhalResult FakeVehicleHardware::maybeSetSpecialValue(const VehiclePropValu return isAdasPropertyAvailableResult; } case toInt(VehicleProperty::CRUISE_CONTROL_COMMAND): - [[fallthrough]]; + isAdasPropertyAvailableResult = + isAdasPropertyAvailable(toInt(VehicleProperty::CRUISE_CONTROL_STATE)); + if (!isAdasPropertyAvailableResult.ok()) { + *isSpecialValue = true; + return isAdasPropertyAvailableResult; + } + isCruiseControlTypeStandardResult = isCruiseControlTypeStandard(); + if (!isCruiseControlTypeStandardResult.ok()) { + *isSpecialValue = true; + return isCruiseControlTypeStandardResult.error(); + } + if (isCruiseControlTypeStandardResult.value() && + (value.value.int32Values[0] == + toInt(CruiseControlCommand::INCREASE_TARGET_TIME_GAP) || + value.value.int32Values[0] == + toInt(CruiseControlCommand::DECREASE_TARGET_TIME_GAP))) { + *isSpecialValue = true; + return StatusError(StatusCode::NOT_AVAILABLE_DISABLED) + << "tried to use a change target time gap command while on a standard CC " + << "setting"; + } + return {}; case toInt(VehicleProperty::ADAPTIVE_CRUISE_CONTROL_TARGET_TIME_GAP): { - auto isAdasPropertyAvailableResult = + isAdasPropertyAvailableResult = isAdasPropertyAvailable(toInt(VehicleProperty::CRUISE_CONTROL_STATE)); if (!isAdasPropertyAvailableResult.ok()) { *isSpecialValue = true; + return isAdasPropertyAvailableResult; } - return isAdasPropertyAvailableResult; + isCruiseControlTypeStandardResult = isCruiseControlTypeStandard(); + if (!isCruiseControlTypeStandardResult.ok()) { + *isSpecialValue = true; + return isCruiseControlTypeStandardResult.error(); + } + if (isCruiseControlTypeStandardResult.value()) { + *isSpecialValue = true; + return StatusError(StatusCode::NOT_AVAILABLE_DISABLED) + << "tried to set target time gap or lead vehicle measured distance value " + << "while on a standard CC setting"; + } + return {}; } #ifdef ENABLE_VEHICLE_HAL_TEST_PROPERTIES @@ -806,9 +1048,9 @@ VhalResult FakeVehicleHardware::maybeSetSpecialValue(const VehiclePropValu [[fallthrough]]; case toInt(VehicleProperty::CLUSTER_NAVIGATION_STATE): [[fallthrough]]; - case VENDOR_CLUSTER_SWITCH_UI: + case toInt(TestVendorProperty::VENDOR_CLUSTER_SWITCH_UI): [[fallthrough]]; - case VENDOR_CLUSTER_DISPLAY_STATE: + case toInt(TestVendorProperty::VENDOR_CLUSTER_DISPLAY_STATE): *isSpecialValue = true; updatedValue = mValuePool->obtain(getPropType(value.prop)); updatedValue->prop = value.prop & ~toInt(VehiclePropertyGroup::MASK); @@ -868,10 +1110,11 @@ VhalResult FakeVehicleHardware::setValue(const VehiclePropValue& value) { } auto updatedValue = mValuePool->obtain(value); - int64_t timestamp = elapsedRealtimeNano(); - updatedValue->timestamp = timestamp; - auto writeResult = mServerSidePropStore->writeValue(std::move(updatedValue)); + auto writeResult = mServerSidePropStore->writeValue( + std::move(updatedValue), + /*updateStatus=*/false, /*mode=*/VehiclePropertyStore::EventMode::ON_VALUE_CHANGE, + /*useCurrentTimestamp=*/true); if (!writeResult.ok()) { return StatusError(getErrorCode(writeResult)) << StringPrintf("failed to write value into property store, error: %s", @@ -1514,12 +1757,12 @@ std::string FakeVehicleHardware::dumpSpecificProperty(const std::vectorgetConfig(prop); + auto result = mServerSidePropStore->getPropConfig(prop); if (!result.ok()) { msg += StringPrintf("No property %d\n", prop); continue; } - msg += dumpOnePropertyByConfig(rowNumber++, *result.value()); + msg += dumpOnePropertyByConfig(rowNumber++, result.value()); } return msg; } @@ -1823,54 +2066,196 @@ void FakeVehicleHardware::registerOnPropertySetErrorEvent( mOnPropertySetErrorCallback = std::move(callback); } -StatusCode FakeVehicleHardware::updateSampleRate(int32_t propId, int32_t areaId, float sampleRate) { - // DefaultVehicleHal makes sure that sampleRate must be within minSampleRate and maxSampleRate. - // For fake implementation, we would write the same value with a new timestamp into propStore - // at sample rate. +StatusCode FakeVehicleHardware::subscribe(SubscribeOptions options) { + int32_t propId = options.propId; + + auto configResult = mServerSidePropStore->getPropConfig(propId); + if (!configResult.ok()) { + ALOGE("subscribe: property: %" PRId32 " is not supported", propId); + return StatusCode::INVALID_ARG; + } + std::scoped_lock lockGuard(mLock); + for (int areaId : options.areaIds) { + if (StatusCode status = subscribePropIdAreaIdLocked(propId, areaId, options.sampleRate, + options.enableVariableUpdateRate, + configResult.value()); + status != StatusCode::OK) { + return status; + } + } + return StatusCode::OK; +} + +bool FakeVehicleHardware::isVariableUpdateRateSupported(const VehiclePropConfig& vehiclePropConfig, + int32_t areaId) { + for (size_t i = 0; i < vehiclePropConfig.areaConfigs.size(); i++) { + const auto& areaConfig = vehiclePropConfig.areaConfigs[i]; + if (areaConfig.areaId != areaId) { + continue; + } + if (areaConfig.supportVariableUpdateRate) { + return true; + } + break; + } + return false; +} + +void FakeVehicleHardware::refreshTimeStampForInterval(int64_t intervalInNanos) { + std::unordered_map + eventModeByPropIdAreaId; + + { + std::scoped_lock lockGuard(mLock); + + if (mActionByIntervalInNanos.find(intervalInNanos) == mActionByIntervalInNanos.end()) { + ALOGE("No actions scheduled for the interval: %" PRId64 ", ignore the refresh request", + intervalInNanos); + return; + } + + ActionForInterval actionForInterval = mActionByIntervalInNanos[intervalInNanos]; + + // Make a copy so that we don't hold the lock while trying to refresh the timestamp. + // Refreshing the timestamp will inovke onValueChangeCallback which also requires lock, so + // we must not hold lock. + for (const PropIdAreaId& propIdAreaId : actionForInterval.propIdAreaIdsToRefresh) { + const RefreshInfo& refreshInfo = mRefreshInfoByPropIdAreaId[propIdAreaId]; + eventModeByPropIdAreaId[propIdAreaId] = refreshInfo.eventMode; + } + } + + mServerSidePropStore->refreshTimestamps(eventModeByPropIdAreaId); +} + +void FakeVehicleHardware::registerRefreshLocked(PropIdAreaId propIdAreaId, + VehiclePropertyStore::EventMode eventMode, + float sampleRateHz) { + if (mRefreshInfoByPropIdAreaId.find(propIdAreaId) != mRefreshInfoByPropIdAreaId.end()) { + unregisterRefreshLocked(propIdAreaId); + } + + int64_t intervalInNanos = static_cast(1'000'000'000. / sampleRateHz); + RefreshInfo refreshInfo = { + .eventMode = eventMode, + .intervalInNanos = intervalInNanos, + }; + mRefreshInfoByPropIdAreaId[propIdAreaId] = refreshInfo; + if (mActionByIntervalInNanos.find(intervalInNanos) != mActionByIntervalInNanos.end()) { + // If we have already registered for this interval, then add the action info to the + // actions list. + mActionByIntervalInNanos[intervalInNanos].propIdAreaIdsToRefresh.insert(propIdAreaId); + return; + } + + // This is the first action for the interval, register a timer callback for that interval. + auto action = std::make_shared( + [this, intervalInNanos] { refreshTimeStampForInterval(intervalInNanos); }); + mActionByIntervalInNanos[intervalInNanos] = ActionForInterval{ + .propIdAreaIdsToRefresh = {propIdAreaId}, + .recurrentAction = action, + }; + mRecurrentTimer->registerTimerCallback(intervalInNanos, action); +} + +void FakeVehicleHardware::unregisterRefreshLocked(PropIdAreaId propIdAreaId) { + if (mRefreshInfoByPropIdAreaId.find(propIdAreaId) == mRefreshInfoByPropIdAreaId.end()) { + ALOGW("PropId: %" PRId32 ", areaId: %" PRId32 " was not registered for refresh, ignore", + propIdAreaId.propId, propIdAreaId.areaId); + return; + } + + int64_t intervalInNanos = mRefreshInfoByPropIdAreaId[propIdAreaId].intervalInNanos; + auto& actionForInterval = mActionByIntervalInNanos[intervalInNanos]; + actionForInterval.propIdAreaIdsToRefresh.erase(propIdAreaId); + if (actionForInterval.propIdAreaIdsToRefresh.empty()) { + mRecurrentTimer->unregisterTimerCallback(actionForInterval.recurrentAction); + mActionByIntervalInNanos.erase(intervalInNanos); + } + mRefreshInfoByPropIdAreaId.erase(propIdAreaId); +} + +StatusCode FakeVehicleHardware::subscribePropIdAreaIdLocked( + int32_t propId, int32_t areaId, float sampleRateHz, bool enableVariableUpdateRate, + const VehiclePropConfig& vehiclePropConfig) { PropIdAreaId propIdAreaId{ .propId = propId, .areaId = areaId, }; - if (mRecurrentActions.find(propIdAreaId) != mRecurrentActions.end()) { - mRecurrentTimer->unregisterTimerCallback(mRecurrentActions[propIdAreaId]); + switch (vehiclePropConfig.changeMode) { + case VehiclePropertyChangeMode::STATIC: + ALOGW("subscribe to a static property, do nothing."); + return StatusCode::OK; + case VehiclePropertyChangeMode::ON_CHANGE: + mSubOnChangePropIdAreaIds.insert(std::move(propIdAreaId)); + return StatusCode::OK; + case VehiclePropertyChangeMode::CONTINUOUS: + if (sampleRateHz == 0.f) { + ALOGE("Must not use sample rate 0 for a continuous property"); + return StatusCode::INTERNAL_ERROR; + } + // For continuous properties, we must generate a new onPropertyChange event + // periodically according to the sample rate. + auto eventMode = VehiclePropertyStore::EventMode::ALWAYS; + if (isVariableUpdateRateSupported(vehiclePropConfig, areaId) && + enableVariableUpdateRate) { + eventMode = VehiclePropertyStore::EventMode::ON_VALUE_CHANGE; + } + + registerRefreshLocked(propIdAreaId, eventMode, sampleRateHz); + return StatusCode::OK; } - if (sampleRate == 0) { - return StatusCode::OK; +} + +StatusCode FakeVehicleHardware::unsubscribe(int32_t propId, int32_t areaId) { + std::scoped_lock lockGuard(mLock); + PropIdAreaId propIdAreaId{ + .propId = propId, + .areaId = areaId, + }; + if (mRefreshInfoByPropIdAreaId.find(propIdAreaId) != mRefreshInfoByPropIdAreaId.end()) { + unregisterRefreshLocked(propIdAreaId); } - int64_t interval = static_cast(1'000'000'000. / sampleRate); - auto action = std::make_shared([this, propId, areaId] { - // Refresh the property value. In real implementation, this should poll the latest value - // from vehicle bus. Here, we are just refreshing the existing value with a new timestamp. - auto result = getValue(VehiclePropValue{ - .areaId = areaId, - .prop = propId, - .value = {}, - }); - if (!result.ok()) { - // Failed to read current value, skip refreshing. - return; - } - result.value()->timestamp = elapsedRealtimeNano(); - // For continuous properties, we must generate a new onPropertyChange event periodically - // according to the sample rate. - mServerSidePropStore->writeValue(std::move(result.value()), /*updateStatus=*/true, - VehiclePropertyStore::EventMode::ALWAYS); - }); - mRecurrentTimer->registerTimerCallback(interval, action); - mRecurrentActions[propIdAreaId] = action; + mSubOnChangePropIdAreaIds.erase(propIdAreaId); return StatusCode::OK; } void FakeVehicleHardware::onValueChangeCallback(const VehiclePropValue& value) { - if (mOnPropertyChangeCallback == nullptr) { - return; + ATRACE_CALL(); + onValuesChangeCallback({value}); +} + +void FakeVehicleHardware::onValuesChangeCallback(std::vector values) { + ATRACE_CALL(); + std::vector subscribedUpdatedValues; + + { + std::scoped_lock lockGuard(mLock); + if (mOnPropertyChangeCallback == nullptr) { + return; + } + + for (const auto& value : values) { + PropIdAreaId propIdAreaId{ + .propId = value.prop, + .areaId = value.areaId, + }; + if (mRefreshInfoByPropIdAreaId.find(propIdAreaId) == mRefreshInfoByPropIdAreaId.end() && + mSubOnChangePropIdAreaIds.find(propIdAreaId) == mSubOnChangePropIdAreaIds.end()) { + if (FAKE_VEHICLEHARDWARE_DEBUG) { + ALOGD("The updated property value: %s is not subscribed, ignore", + value.toString().c_str()); + } + continue; + } + + subscribedUpdatedValues.push_back(value); + } } - std::vector updatedValues; - updatedValues.push_back(value); - (*mOnPropertyChangeCallback)(std::move(updatedValues)); + (*mOnPropertyChangeCallback)(std::move(subscribedUpdatedValues)); } void FakeVehicleHardware::loadPropConfigsFromDir( diff --git a/automotive/vehicle/aidl/impl/fake_impl/hardware/test/Android.bp b/automotive/vehicle/aidl/impl/fake_impl/hardware/test/Android.bp index 8d8fcf590809d8ad586f135a2b5c8ff356eb76d9..b763d2f55d0ac71b415005c3ab0118f2b74a46ce 100644 --- a/automotive/vehicle/aidl/impl/fake_impl/hardware/test/Android.bp +++ b/automotive/vehicle/aidl/impl/fake_impl/hardware/test/Android.bp @@ -21,11 +21,14 @@ package { cc_test { name: "FakeVehicleHardwareTest", vendor: true, - srcs: ["*.cpp"], + srcs: [ + "*.cpp", + ":VhalTestVendorProperties", + ], cflags: ["-DENABLE_VEHICLE_HAL_TEST_PROPERTIES"], header_libs: [ "IVehicleHardware", - "VehicleHalTestUtilHeaders", + "libbinder_headers", ], static_libs: [ "VehicleHalJsonConfigLoaderEnableTestProperties", @@ -47,7 +50,9 @@ cc_test { ":FakeVehicleHardwareTestOverrideJson", ":FakeVehicleHardwareTestPropJson", ], - defaults: ["VehicleHalDefaults"], + defaults: [ + "VehicleHalDefaults", + ], test_suites: ["device-tests"], } diff --git a/automotive/vehicle/aidl/impl/fake_impl/hardware/test/FakeVehicleHardwareTest.cpp b/automotive/vehicle/aidl/impl/fake_impl/hardware/test/FakeVehicleHardwareTest.cpp index 8d385ddcfe29fa195cc85ac9a36db4ea1047b813..6d2efd5b5c2b55edb2e6311c14a5e8a83733d887 100644 --- a/automotive/vehicle/aidl/impl/fake_impl/hardware/test/FakeVehicleHardwareTest.cpp +++ b/automotive/vehicle/aidl/impl/fake_impl/hardware/test/FakeVehicleHardwareTest.cpp @@ -19,7 +19,9 @@ #include #include #include -#include + +#include +#include #include #include @@ -33,6 +35,7 @@ #include #include #include +#include #include #include #include @@ -60,6 +63,8 @@ namespace vehicle { namespace fake { namespace { +using ::aidl::android::hardware::automotive::vehicle::CruiseControlCommand; +using ::aidl::android::hardware::automotive::vehicle::CruiseControlType; using ::aidl::android::hardware::automotive::vehicle::ErrorState; using ::aidl::android::hardware::automotive::vehicle::GetValueRequest; using ::aidl::android::hardware::automotive::vehicle::GetValueResult; @@ -67,13 +72,17 @@ using ::aidl::android::hardware::automotive::vehicle::RawPropValues; using ::aidl::android::hardware::automotive::vehicle::SetValueRequest; using ::aidl::android::hardware::automotive::vehicle::SetValueResult; using ::aidl::android::hardware::automotive::vehicle::StatusCode; +using ::aidl::android::hardware::automotive::vehicle::SubscribeOptions; using ::aidl::android::hardware::automotive::vehicle::VehicleApPowerStateReport; using ::aidl::android::hardware::automotive::vehicle::VehicleApPowerStateReq; +using ::aidl::android::hardware::automotive::vehicle::VehicleApPowerStateShutdownParam; using ::aidl::android::hardware::automotive::vehicle::VehicleAreaMirror; using ::aidl::android::hardware::automotive::vehicle::VehicleHwKeyInputAction; using ::aidl::android::hardware::automotive::vehicle::VehiclePropConfig; using ::aidl::android::hardware::automotive::vehicle::VehicleProperty; +using ::aidl::android::hardware::automotive::vehicle::VehiclePropertyAccess; using ::aidl::android::hardware::automotive::vehicle::VehiclePropertyStatus; +using ::aidl::android::hardware::automotive::vehicle::VehiclePropertyType; using ::aidl::android::hardware::automotive::vehicle::VehiclePropValue; using ::aidl::android::hardware::automotive::vehicle::VehicleUnit; using ::android::base::expected; @@ -86,6 +95,7 @@ using ::testing::ContainsRegex; using ::testing::Eq; using ::testing::HasSubstr; using ::testing::IsSubsetOf; +using ::testing::UnorderedElementsAre; using ::testing::WhenSortedBy; using std::chrono::milliseconds; @@ -104,6 +114,10 @@ class FakeVehicleHardwareTestHelper { return mHardware->loadConfigDeclarations(); } + std::unordered_set getHvacPowerDependentProps() { + return mHardware->hvacPowerDependentProps; + } + private: FakeVehicleHardware* mHardware; }; @@ -137,6 +151,15 @@ class FakeVehicleHardwareTest : public ::testing::Test { mHardware = std::move(hardware); } + static SubscribeOptions newSubscribeOptions(int32_t propId, int32_t areaId, + float sampleRateHz) { + SubscribeOptions options; + options.areaIds = {areaId}; + options.propId = propId; + options.sampleRate = sampleRateHz; + return options; + } + StatusCode setValues(const std::vector& requests) { { std::scoped_lock lockGuard(mLock); @@ -324,6 +347,13 @@ class FakeVehicleHardwareTest : public ::testing::Test { return mEventCount[propIdAreaId]; } + void subscribe(int32_t propId, int32_t areaId, float sampleRateHz) { + ASSERT_EQ(StatusCode::OK, + getHardware()->subscribe(newSubscribeOptions(propId, areaId, sampleRateHz))) + << "failed to subscribe to propId: " << propId << "areaId: " << areaId + << ", sampleRateHz: " << sampleRateHz; + } + static void addSetValueRequest(std::vector& requests, std::vector& expectedResults, int64_t requestId, const VehiclePropValue& value, StatusCode expectedStatus) { @@ -358,24 +388,24 @@ class FakeVehicleHardwareTest : public ::testing::Test { } std::vector getTestPropValues() { - VehiclePropValue fuelCapacity = { - .prop = toInt(VehicleProperty::INFO_FUEL_CAPACITY), - .value = {.floatValues = {1.0}}, + VehiclePropValue oilLevel = { + .prop = toInt(VehicleProperty::ENGINE_OIL_LEVEL), + .value = {.int32Values = {1}}, }; - VehiclePropValue leftTirePressure = { - .prop = toInt(VehicleProperty::TIRE_PRESSURE), + VehiclePropValue leftHvacTemp = { + .prop = toInt(VehicleProperty::HVAC_TEMPERATURE_CURRENT), .value = {.floatValues = {170.0}}, - .areaId = WHEEL_FRONT_LEFT, + .areaId = SEAT_1_LEFT, }; - VehiclePropValue rightTirePressure = { - .prop = toInt(VehicleProperty::TIRE_PRESSURE), + VehiclePropValue rightHvacTemp = { + .prop = toInt(VehicleProperty::HVAC_TEMPERATURE_CURRENT), .value = {.floatValues = {180.0}}, - .areaId = WHEEL_FRONT_RIGHT, + .areaId = SEAT_1_RIGHT, }; - return {fuelCapacity, leftTirePressure, rightTirePressure}; + return {oilLevel, leftHvacTemp, rightHvacTemp}; } struct PropValueCmp { @@ -385,6 +415,25 @@ class FakeVehicleHardwareTest : public ::testing::Test { } } mPropValueCmp; + std::unique_ptr getVehiclePropConfig(int32_t propertyId) { + auto configs = mHardware->getAllPropertyConfigs(); + for (auto& config : configs) { + if (config.prop == propertyId) { + auto ptr = std::make_unique(); + ptr->prop = config.prop; + ptr->access = config.access; + ptr->changeMode = config.changeMode; + ptr->areaConfigs = config.areaConfigs; + ptr->configArray = config.configArray; + ptr->configString = config.configString; + ptr->minSampleRate = config.minSampleRate; + ptr->maxSampleRate = config.maxSampleRate; + return ptr; + } + } + return std::unique_ptr(nullptr); + } + private: std::unique_ptr mHardware; std::shared_ptr mSetValuesCallback; @@ -406,6 +455,29 @@ TEST_F(FakeVehicleHardwareTest, testGetAllPropertyConfigs) { ASSERT_EQ(configs.size(), helper.loadConfigDeclarations().size()); } +TEST_F(FakeVehicleHardwareTest, testGetAllPropertyConfigs_defaultSupportVUR) { + std::vector configs = getHardware()->getAllPropertyConfigs(); + + for (const auto& config : configs) { + bool expectedSupportVUR = true; + if (config.prop == toInt(VehicleProperty::VHAL_HEARTBEAT) || + config.prop == toInt(VehicleProperty::CLUSTER_HEARTBEAT)) { + expectedSupportVUR = false; + } + EXPECT_GE(config.areaConfigs.size(), 1u) + << "expect at least one area config, including global area config, propId: " + << config.prop; + if (config.areaConfigs.size() == 0) { + continue; + } + for (const auto& areaConfig : config.areaConfigs) { + EXPECT_EQ(areaConfig.supportVariableUpdateRate, expectedSupportVUR) + << "unexpected supportVariableUpdateRate for propId: " << config.prop + << ", areaId: " << areaConfig.areaId; + } + } +} + TEST_F(FakeVehicleHardwareTest, testGetDefaultValues) { std::vector getValueRequests; std::vector expectedGetValueResults; @@ -424,13 +496,13 @@ TEST_F(FakeVehicleHardwareTest, testGetDefaultValues) { continue; } - if (propId == ECHO_REVERSE_BYTES) { + if (propId == toInt(TestVendorProperty::ECHO_REVERSE_BYTES)) { // Ignore ECHO_REVERSE_BYTES, it has special logic. continue; } - if (propId == VENDOR_PROPERTY_ID) { - // Ignore VENDOR_PROPERTY_ID, it has special logic. + if (propId == toInt(TestVendorProperty::VENDOR_PROPERTY_FOR_ERROR_CODE_TESTING)) { + // Ignore VENDOR_PROPERTY_FOR_ERROR_CODE_TESTING, it has special logic. continue; } @@ -528,17 +600,13 @@ TEST_F(FakeVehicleHardwareTest, testSetValuesError) { ASSERT_THAT(getSetValueResults(), ContainerEq(expectedResults)); } -TEST_F(FakeVehicleHardwareTest, testRegisterOnPropertyChangeEvent) { - // We have already registered this callback in Setup, here we are registering again. - auto callback = std::make_unique( - [this](const std::vector& values) { onPropertyChangeEvent(values); }); - getHardware()->registerOnPropertyChangeEvent(std::move(callback)); - +TEST_F(FakeVehicleHardwareTest, testSetValues_getUpdateEvents) { auto testValues = getTestPropValues(); std::vector requests; std::vector expectedResults; int64_t requestId = 1; for (auto& value : testValues) { + subscribe(value.prop, value.areaId, /*sampleRateHz=*/0); addSetValueRequest(requests, expectedResults, requestId++, value, StatusCode::OK); } int64_t timestamp = elapsedRealtimeNano(); @@ -963,7 +1031,8 @@ std::vector setSpecialValueTestCases() { .expectedValuesToGet = { VehiclePropValue{ - .prop = VENDOR_CLUSTER_REPORT_STATE, + .prop = toInt(TestVendorProperty:: + VENDOR_CLUSTER_REPORT_STATE), .value.int32Values = {1}, }, }, @@ -980,7 +1049,8 @@ std::vector setSpecialValueTestCases() { .expectedValuesToGet = { VehiclePropValue{ - .prop = VENDOR_CLUSTER_REQUEST_DISPLAY, + .prop = toInt(TestVendorProperty:: + VENDOR_CLUSTER_REQUEST_DISPLAY), .value.int32Values = {1}, }, }, @@ -998,7 +1068,8 @@ std::vector setSpecialValueTestCases() { .expectedValuesToGet = { VehiclePropValue{ - .prop = VENDOR_CLUSTER_NAVIGATION_STATE, + .prop = toInt(TestVendorProperty:: + VENDOR_CLUSTER_NAVIGATION_STATE), .value.byteValues = {0x1}, }, }, @@ -1008,7 +1079,8 @@ std::vector setSpecialValueTestCases() { .valuesToSet = { VehiclePropValue{ - .prop = VENDOR_CLUSTER_SWITCH_UI, + .prop = toInt( + TestVendorProperty::VENDOR_CLUSTER_SWITCH_UI), .value.int32Values = {1}, }, }, @@ -1025,7 +1097,8 @@ std::vector setSpecialValueTestCases() { .valuesToSet = { VehiclePropValue{ - .prop = VENDOR_CLUSTER_DISPLAY_STATE, + .prop = toInt(TestVendorProperty:: + VENDOR_CLUSTER_DISPLAY_STATE), .value.int32Values = {1, 2}, }, }, @@ -1451,7 +1524,7 @@ std::vector setSpecialValueTestCases() { }, VehiclePropValue{ .prop = toInt(VehicleProperty::CRUISE_CONTROL_TYPE), - .value.int32Values = {1}, + .value.int32Values = {2}, }, VehiclePropValue{ .prop = toInt(VehicleProperty::CRUISE_CONTROL_STATE), @@ -1519,6 +1592,143 @@ std::vector setSpecialValueTestCases() { }, }, }, + SetSpecialValueTestCase{ + .name = "set_low_speed_collision_warning_enabled_false", + .valuesToSet = + { + VehiclePropValue{ + .prop = toInt( + VehicleProperty:: + LOW_SPEED_COLLISION_WARNING_ENABLED), + .value.int32Values = {0}, + }, + }, + .expectedValuesToGet = + { + VehiclePropValue{ + .prop = toInt( + VehicleProperty:: + LOW_SPEED_COLLISION_WARNING_ENABLED), + .value.int32Values = {0}, + }, + VehiclePropValue{ + .prop = toInt( + VehicleProperty:: + LOW_SPEED_COLLISION_WARNING_STATE), + .value.int32Values = {toInt( + ErrorState::NOT_AVAILABLE_DISABLED)}, + }, + }, + }, + SetSpecialValueTestCase{ + .name = "set_low_speed_collision_warning_enabled_true", + .valuesToSet = + { + VehiclePropValue{ + .prop = toInt( + VehicleProperty:: + LOW_SPEED_COLLISION_WARNING_ENABLED), + .value.int32Values = {1}, + }, + }, + .expectedValuesToGet = + { + VehiclePropValue{ + .prop = toInt( + VehicleProperty:: + LOW_SPEED_COLLISION_WARNING_ENABLED), + .value.int32Values = {1}, + }, + VehiclePropValue{ + .prop = toInt( + VehicleProperty:: + LOW_SPEED_COLLISION_WARNING_STATE), + .value.int32Values = {1}, + }, + }, + }, + SetSpecialValueTestCase{ + .name = "set_electronic_stability_control_enabled_false", + .valuesToSet = + { + VehiclePropValue{ + .prop = toInt( + VehicleProperty:: + ELECTRONIC_STABILITY_CONTROL_ENABLED), + .value.int32Values = {0}, + }, + }, + .expectedValuesToGet = + { + VehiclePropValue{ + .prop = toInt( + VehicleProperty:: + ELECTRONIC_STABILITY_CONTROL_ENABLED), + .value.int32Values = {0}, + }, + VehiclePropValue{ + .prop = toInt( + VehicleProperty:: + ELECTRONIC_STABILITY_CONTROL_STATE), + .value.int32Values = {toInt( + ErrorState::NOT_AVAILABLE_DISABLED)}, + }, + }, + }, + SetSpecialValueTestCase{ + .name = "set_electronic_stability_control_enabled_true", + .valuesToSet = + { + VehiclePropValue{ + .prop = toInt( + VehicleProperty:: + ELECTRONIC_STABILITY_CONTROL_ENABLED), + .value.int32Values = {1}, + }, + }, + .expectedValuesToGet = + { + VehiclePropValue{ + .prop = toInt( + VehicleProperty:: + ELECTRONIC_STABILITY_CONTROL_ENABLED), + .value.int32Values = {1}, + }, + VehiclePropValue{ + .prop = toInt( + VehicleProperty:: + ELECTRONIC_STABILITY_CONTROL_STATE), + .value.int32Values = {1}, + }, + }, + }, + SetSpecialValueTestCase{ + .name = "set_shutdown_request", + .valuesToSet = + { + VehiclePropValue{ + .prop = toInt(VehicleProperty::SHUTDOWN_REQUEST), + .value.int32Values = + { + toInt(VehicleApPowerStateShutdownParam:: + SHUTDOWN_ONLY), + }, + }, + }, + .expectedValuesToGet = + { + VehiclePropValue{ + .prop = toInt(VehicleProperty::AP_POWER_STATE_REQ), + .value.int32Values = + { + toInt(VehicleApPowerStateReq:: + SHUTDOWN_PREPARE), + toInt(VehicleApPowerStateShutdownParam:: + SHUTDOWN_ONLY), + }, + }, + }, + }, }; } @@ -1561,27 +1771,30 @@ INSTANTIATE_TEST_SUITE_P( return info.param.name; }); -TEST_F(FakeVehicleHardwareTest, testSetWaitForVhalAfterCarServiceCrash) { - int32_t propId = toInt(VehicleProperty::AP_POWER_STATE_REPORT); +TEST_F(FakeVehicleHardwareTest, testSetWaitForVhal_alwaysTriggerEvents) { + int32_t powerReq = toInt(VehicleProperty::AP_POWER_STATE_REQ); + subscribe(powerReq, /*areaId*/ 0, /*sampleRateHz*/ 0); + + int32_t powerReport = toInt(VehicleProperty::AP_POWER_STATE_REPORT); VehiclePropValue request = VehiclePropValue{ - .prop = propId, + .prop = powerReport, .value.int32Values = {toInt(VehicleApPowerStateReport::WAIT_FOR_VHAL)}, }; - ASSERT_EQ(setValue(request), StatusCode::OK) << "failed to set property " << propId; + ASSERT_EQ(setValue(request), StatusCode::OK) << "failed to set property " << powerReport; // Clear existing events. clearChangedProperties(); // Simulate a Car Service crash, Car Service would restart and send the message again. - ASSERT_EQ(setValue(request), StatusCode::OK) << "failed to set property " << propId; + ASSERT_EQ(setValue(request), StatusCode::OK) << "failed to set property " << powerReport; std::vector events = getChangedProperties(); // Even though the state is already ON, we should receive another ON event. - ASSERT_EQ(events.size(), 1u); + ASSERT_EQ(events.size(), 1u) << "failed to receive on-change events AP_POWER_STATE_REQ ON"; // Erase the timestamp for comparison. events[0].timestamp = 0; auto expectedValue = VehiclePropValue{ - .prop = toInt(VehicleProperty::AP_POWER_STATE_REQ), + .prop = powerReq, .status = VehiclePropertyStatus::AVAILABLE, .value.int32Values = {toInt(VehicleApPowerStateReq::ON), 0}, }; @@ -1650,23 +1863,35 @@ TEST_F(FakeVehicleHardwareTest, testSetVehicleMapService) { } TEST_F(FakeVehicleHardwareTest, testGetHvacPropNotAvailable) { - int seatAreaIds[5] = {SEAT_1_LEFT, SEAT_1_RIGHT, SEAT_2_LEFT, SEAT_2_CENTER, SEAT_2_RIGHT}; - for (int areaId : seatAreaIds) { + FakeVehicleHardwareTestHelper helper(getHardware()); + auto hvacPowerOnConfig = std::move(getVehiclePropConfig(toInt(VehicleProperty::HVAC_POWER_ON))); + EXPECT_NE(hvacPowerOnConfig, nullptr); + for (auto& hvacPowerOnAreaConfig : hvacPowerOnConfig->areaConfigs) { + int hvacPowerAreaId = hvacPowerOnAreaConfig.areaId; + // Turn off HVAC_POWER_ON for only 1 area ID StatusCode status = setValue(VehiclePropValue{.prop = toInt(VehicleProperty::HVAC_POWER_ON), - .areaId = areaId, + .areaId = hvacPowerAreaId, .value.int32Values = {0}}); + EXPECT_EQ(status, StatusCode::OK); - ASSERT_EQ(status, StatusCode::OK); - - for (size_t i = 0; i < sizeof(HVAC_POWER_PROPERTIES) / sizeof(int32_t); i++) { - int powerPropId = HVAC_POWER_PROPERTIES[i]; - for (int powerDependentAreaId : seatAreaIds) { + for (auto& powerPropId : helper.getHvacPowerDependentProps()) { + auto powerPropConfig = std::move(getVehiclePropConfig(powerPropId)); + EXPECT_NE(powerPropConfig, nullptr); + if (powerPropConfig->access == VehiclePropertyAccess::WRITE) { + continue; + } + // Try getting a value at each area ID supported by the power dependent property + for (auto& powerPropAreaConfig : powerPropConfig->areaConfigs) { + int powerDependentAreaId = powerPropAreaConfig.areaId; auto getValueResult = getValue(VehiclePropValue{ .prop = powerPropId, .areaId = powerDependentAreaId, }); - if (areaId == powerDependentAreaId) { + // If the current area ID is contained within the HVAC_POWER_ON area ID + // turned off, then getValue should fail and a StatusCode error should be + // returned. Otherwise, a value should be returned. + if ((hvacPowerAreaId & powerDependentAreaId) == powerDependentAreaId) { EXPECT_FALSE(getValueResult.ok()); EXPECT_EQ(getValueResult.error(), StatusCode::NOT_AVAILABLE_DISABLED); } else { @@ -1679,28 +1904,45 @@ TEST_F(FakeVehicleHardwareTest, testGetHvacPropNotAvailable) { // on this value from any power dependent property values other than those with the same // areaId. setValue(VehiclePropValue{.prop = toInt(VehicleProperty::HVAC_POWER_ON), - .areaId = areaId, + .areaId = hvacPowerAreaId, .value.int32Values = {1}}); } } TEST_F(FakeVehicleHardwareTest, testSetHvacPropNotAvailable) { - int seatAreaIds[5] = {SEAT_1_LEFT, SEAT_1_RIGHT, SEAT_2_LEFT, SEAT_2_CENTER, SEAT_2_RIGHT}; - for (int areaId : seatAreaIds) { + FakeVehicleHardwareTestHelper helper(getHardware()); + auto hvacPowerOnConfig = std::move(getVehiclePropConfig(toInt(VehicleProperty::HVAC_POWER_ON))); + EXPECT_NE(hvacPowerOnConfig, nullptr); + for (auto& hvacPowerOnAreaConfig : hvacPowerOnConfig->areaConfigs) { + int hvacPowerAreaId = hvacPowerOnAreaConfig.areaId; + // Turn off HVAC_POWER_ON for only 1 area ID StatusCode status = setValue(VehiclePropValue{.prop = toInt(VehicleProperty::HVAC_POWER_ON), - .areaId = areaId, + .areaId = hvacPowerAreaId, .value.int32Values = {0}}); + EXPECT_EQ(status, StatusCode::OK); - ASSERT_EQ(status, StatusCode::OK); - - for (size_t i = 0; i < sizeof(HVAC_POWER_PROPERTIES) / sizeof(int32_t); i++) { - int powerPropId = HVAC_POWER_PROPERTIES[i]; - for (int powerDependentAreaId : seatAreaIds) { - StatusCode status = setValue(VehiclePropValue{.prop = powerPropId, - .areaId = powerDependentAreaId, - .value.int32Values = {1}}); + for (auto& powerPropId : helper.getHvacPowerDependentProps()) { + auto powerPropConfig = std::move(getVehiclePropConfig(powerPropId)); + EXPECT_NE(powerPropConfig, nullptr); + if (powerPropConfig->access == VehiclePropertyAccess::READ) { + continue; + } + auto propType = getPropType(powerPropId); + // Try setting a value at each area ID supported by the power dependent property + for (auto& powerPropAreaConfig : powerPropConfig->areaConfigs) { + int powerDependentAreaId = powerPropAreaConfig.areaId; + auto val = VehiclePropValue{.prop = powerPropId, .areaId = powerDependentAreaId}; + if (propType == VehiclePropertyType::FLOAT) { + val.value.floatValues.emplace_back(20); + } else { + val.value.int32Values.emplace_back(1); + } + status = setValue(val); - if (areaId == powerDependentAreaId) { + // If the current area ID is contained within the HVAC_POWER_ON area ID + // turned off, then setValue should fail and a StatusCode error should be + // returned. Otherwise, an ok StatusCode should be returned. + if ((hvacPowerAreaId & powerDependentAreaId) == powerDependentAreaId) { EXPECT_EQ(status, StatusCode::NOT_AVAILABLE_DISABLED); } else { EXPECT_EQ(status, StatusCode::OK); @@ -1712,37 +1954,142 @@ TEST_F(FakeVehicleHardwareTest, testSetHvacPropNotAvailable) { // on this value from any power dependent property values other than those with the same // areaId. setValue(VehiclePropValue{.prop = toInt(VehicleProperty::HVAC_POWER_ON), - .areaId = areaId, + .areaId = hvacPowerAreaId, .value.int32Values = {1}}); } } TEST_F(FakeVehicleHardwareTest, testHvacPowerOnSendCurrentHvacPropValues) { - int seatAreaIds[5] = {SEAT_1_LEFT, SEAT_1_RIGHT, SEAT_2_LEFT, SEAT_2_CENTER, SEAT_2_RIGHT}; - for (int areaId : seatAreaIds) { + FakeVehicleHardwareTestHelper helper(getHardware()); + auto hvacPowerOnConfig = std::move(getVehiclePropConfig(toInt(VehicleProperty::HVAC_POWER_ON))); + EXPECT_NE(hvacPowerOnConfig, nullptr); + for (auto& hvacPowerOnAreaConfig : hvacPowerOnConfig->areaConfigs) { + int hvacPowerAreaId = hvacPowerOnAreaConfig.areaId; StatusCode status = setValue(VehiclePropValue{.prop = toInt(VehicleProperty::HVAC_POWER_ON), - .areaId = areaId, + .areaId = hvacPowerAreaId, .value.int32Values = {0}}); + EXPECT_EQ(status, StatusCode::OK); + auto events = getChangedProperties(); + for (const auto& event : events) { + // Ignore HVAC_POWER_ON event + if (event.prop == toInt(VehicleProperty::HVAC_POWER_ON)) { + continue; + } + EXPECT_THAT(event.prop, AnyOfArray(helper.getHvacPowerDependentProps())); + EXPECT_EQ((hvacPowerAreaId & event.areaId), hvacPowerAreaId); + EXPECT_EQ(event.status, VehiclePropertyStatus::UNAVAILABLE); + } + clearChangedProperties(); - ASSERT_EQ(status, StatusCode::OK); - + status = setValue(VehiclePropValue{.prop = toInt(VehicleProperty::HVAC_POWER_ON), + .areaId = hvacPowerAreaId, + .value.int32Values = {1}}); + EXPECT_EQ(status, StatusCode::OK); + events = getChangedProperties(); + for (const auto& event : events) { + // Ignore HVAC_POWER_ON event + if (event.prop == toInt(VehicleProperty::HVAC_POWER_ON)) { + continue; + } + EXPECT_THAT(event.prop, AnyOfArray(helper.getHvacPowerDependentProps())); + EXPECT_EQ((hvacPowerAreaId & event.areaId), hvacPowerAreaId); + EXPECT_EQ(event.status, VehiclePropertyStatus::AVAILABLE); + } clearChangedProperties(); - setValue(VehiclePropValue{.prop = toInt(VehicleProperty::HVAC_POWER_ON), - .areaId = areaId, - .value.int32Values = {1}}); + } +} + +TEST_F(FakeVehicleHardwareTest, testHvacDualOnSynchronizesTemp) { + auto hvacDualOnConfig = std::move(getVehiclePropConfig(toInt(VehicleProperty::HVAC_DUAL_ON))); + auto hvacTemperatureSetConfig = + std::move(getVehiclePropConfig(toInt(VehicleProperty::HVAC_TEMPERATURE_SET))); + EXPECT_NE(hvacDualOnConfig, nullptr); + EXPECT_NE(hvacTemperatureSetConfig, nullptr); + for (auto& hvacTemperatureSetConfig : hvacTemperatureSetConfig->areaConfigs) { + int32_t hvacTemperatureSetAreaId = hvacTemperatureSetConfig.areaId; + subscribe(toInt(VehicleProperty::HVAC_TEMPERATURE_SET), hvacTemperatureSetAreaId, + /*sampleRateHz*/ 0); + } + for (auto& hvacDualOnConfig : hvacDualOnConfig->areaConfigs) { + int32_t hvacDualOnAreaId = hvacDualOnConfig.areaId; + subscribe(toInt(VehicleProperty::HVAC_DUAL_ON), hvacDualOnAreaId, /*sampleRateHz*/ 0); + StatusCode status = setValue(VehiclePropValue{.prop = toInt(VehicleProperty::HVAC_DUAL_ON), + .areaId = hvacDualOnAreaId, + .value.int32Values = {1}}); + EXPECT_EQ(status, StatusCode::OK); + // Verify there's an event for all HVAC_TEMPERATURE_SET + // area IDs covered by the HVAC_DUAL_ON area ID auto events = getChangedProperties(); - // If we turn HVAC power on, we expect to receive one property event for every HVAC prop - // areas plus one event for HVAC_POWER_ON. - std::vector changedPropIds; - for (size_t i = 0; i < sizeof(HVAC_POWER_PROPERTIES) / sizeof(int32_t); i++) { - changedPropIds.push_back(HVAC_POWER_PROPERTIES[i]); + std::unordered_set temperatureValues; + for (const auto& event : events) { + // Ignore HVAC_DUAL_ON event + if (event.prop == toInt(VehicleProperty::HVAC_DUAL_ON)) { + continue; + } + EXPECT_EQ(event.prop, toInt(VehicleProperty::HVAC_TEMPERATURE_SET)); + EXPECT_EQ((hvacDualOnAreaId & event.areaId), event.areaId); + EXPECT_EQ(1u, event.value.floatValues.size()); + temperatureValues.insert(event.value.floatValues[0]); } - changedPropIds.push_back(toInt(VehicleProperty::HVAC_POWER_ON)); + // Verify that the temperature value is the same for all events + // Ie the temperature in all area IDs are synchronized + EXPECT_EQ(1u, temperatureValues.size()); + clearChangedProperties(); - for (const auto& event : events) { - EXPECT_EQ(event.areaId, areaId); - EXPECT_THAT(event.prop, AnyOfArray(changedPropIds)); + // Verify when any HVAC_TEMPERATURE_SET area ID is changed all + // area IDs covered by the HVAC_DUAL_ON area ID are also changed + for (auto& hvacTemperatureSetConfig : hvacTemperatureSetConfig->areaConfigs) { + int32_t hvacTemperatureSetAreaId = hvacTemperatureSetConfig.areaId; + if ((hvacDualOnAreaId & hvacTemperatureSetAreaId) != hvacTemperatureSetAreaId) { + continue; + } + float expectedValue = 25; + status = setValue(VehiclePropValue{.prop = toInt(VehicleProperty::HVAC_TEMPERATURE_SET), + .areaId = hvacTemperatureSetAreaId, + .value.floatValues = {expectedValue}}); + EXPECT_EQ(status, StatusCode::OK); + events = getChangedProperties(); + for (const auto& event : events) { + EXPECT_EQ(event.prop, toInt(VehicleProperty::HVAC_TEMPERATURE_SET)); + EXPECT_EQ(1u, event.value.floatValues.size()); + EXPECT_EQ(expectedValue, event.value.floatValues[0]); + } + clearChangedProperties(); + } + + status = setValue(VehiclePropValue{.prop = toInt(VehicleProperty::HVAC_DUAL_ON), + .areaId = hvacDualOnAreaId, + .value.int32Values = {0}}); + EXPECT_EQ(status, StatusCode::OK); + + // When HVAC_DUAL_ON is disabled, there should be no events created + // for HVAC_TEMPERATURE_SET ie no temperature synchronization. + events = getChangedProperties(); + EXPECT_EQ(1u, events.size()); + EXPECT_EQ(events[0].prop, toInt(VehicleProperty::HVAC_DUAL_ON)); + EXPECT_EQ(events[0].areaId, hvacDualOnAreaId); + clearChangedProperties(); + + // Verify when any HVAC_TEMPERATURE_SET area ID is + // changed other area IDs do not change. + for (auto& hvacTemperatureSetConfig : hvacTemperatureSetConfig->areaConfigs) { + int32_t hvacTemperatureSetAreaId = hvacTemperatureSetConfig.areaId; + if ((hvacDualOnAreaId & hvacTemperatureSetAreaId) != hvacTemperatureSetAreaId) { + continue; + } + float expectedValue = 24; + status = setValue(VehiclePropValue{.prop = toInt(VehicleProperty::HVAC_TEMPERATURE_SET), + .areaId = hvacTemperatureSetAreaId, + .value.floatValues = {expectedValue}}); + EXPECT_EQ(status, StatusCode::OK); + events = getChangedProperties(); + EXPECT_EQ(1u, events.size()); + EXPECT_EQ(events[0].prop, toInt(VehicleProperty::HVAC_TEMPERATURE_SET)); + EXPECT_EQ(events[0].areaId, hvacTemperatureSetAreaId); + EXPECT_EQ(1u, events[0].value.floatValues.size()); + EXPECT_EQ(expectedValue, events[0].value.floatValues[0]); + clearChangedProperties(); } } } @@ -1804,6 +2151,47 @@ TEST_F(FakeVehicleHardwareTest, testSetAdasPropNotAvailable) { } } +TEST_F(FakeVehicleHardwareTest, testGetAccPropertiesOnStandardCc) { + std::vector ccTypeDependentProperties = { + toInt(VehicleProperty::ADAPTIVE_CRUISE_CONTROL_TARGET_TIME_GAP), + toInt(VehicleProperty::ADAPTIVE_CRUISE_CONTROL_LEAD_VEHICLE_MEASURED_DISTANCE), + }; + + StatusCode status = + setValue(VehiclePropValue{.prop = toInt(VehicleProperty::CRUISE_CONTROL_TYPE), + .value.int32Values = {toInt(CruiseControlType::STANDARD)}}); + EXPECT_EQ(status, StatusCode::OK); + + for (int32_t dependentProp : ccTypeDependentProperties) { + auto getValueResult = getValue(VehiclePropValue{.prop = dependentProp}); + EXPECT_FALSE(getValueResult.ok()); + EXPECT_EQ(getValueResult.error(), StatusCode::NOT_AVAILABLE_DISABLED); + } +} + +TEST_F(FakeVehicleHardwareTest, testSetAccPropertiesOnStandardCc) { + std::vector testVehiclePropValues = { + VehiclePropValue{ + .prop = toInt(VehicleProperty::ADAPTIVE_CRUISE_CONTROL_TARGET_TIME_GAP), + .value.int32Values = {3}}, + VehiclePropValue{ + .prop = toInt(VehicleProperty::CRUISE_CONTROL_COMMAND), + .value.int32Values = {toInt(CruiseControlCommand::INCREASE_TARGET_TIME_GAP)}}, + VehiclePropValue{ + .prop = toInt(VehicleProperty::CRUISE_CONTROL_COMMAND), + .value.int32Values = {toInt(CruiseControlCommand::DECREASE_TARGET_TIME_GAP)}}}; + + StatusCode status = + setValue(VehiclePropValue{.prop = toInt(VehicleProperty::CRUISE_CONTROL_TYPE), + .value.int32Values = {toInt(CruiseControlType::STANDARD)}}); + EXPECT_EQ(status, StatusCode::OK); + + for (auto value : testVehiclePropValues) { + status = setValue(value); + EXPECT_EQ(status, StatusCode::NOT_AVAILABLE_DISABLED); + } +} + TEST_F(FakeVehicleHardwareTest, testSendAdasPropertiesState) { std::unordered_map> adasEnabledPropToAdasPropWithErrorState = { // AEB @@ -1871,7 +2259,37 @@ TEST_F(FakeVehicleHardwareTest, testSendAdasPropertiesState) { toInt(VehicleProperty::HANDS_ON_DETECTION_WARNING), }, }, + // LSCW + { + toInt(VehicleProperty::LOW_SPEED_COLLISION_WARNING_ENABLED), + { + toInt(VehicleProperty::LOW_SPEED_COLLISION_WARNING_STATE), + }, + }, + // ESC + { + toInt(VehicleProperty::ELECTRONIC_STABILITY_CONTROL_ENABLED), + { + toInt(VehicleProperty::ELECTRONIC_STABILITY_CONTROL_STATE), + }, + }, }; + + // First subscribe to all the properties that we will change. + for (auto& enabledToErrorStateProps : adasEnabledPropToAdasPropWithErrorState) { + std::unordered_set expectedChangedPropIds(enabledToErrorStateProps.second.begin(), + enabledToErrorStateProps.second.end()); + expectedChangedPropIds.insert(enabledToErrorStateProps.first); + + for (int32_t propId : expectedChangedPropIds) { + int32_t areaId = 0; + if (propId == toInt(VehicleProperty::BLIND_SPOT_WARNING_STATE)) { + areaId = toInt(VehicleAreaMirror::DRIVER_LEFT); + } + subscribe(propId, areaId, /*sampleRateHz*/ 0); + } + } + for (auto& enabledToErrorStateProps : adasEnabledPropToAdasPropWithErrorState) { int32_t adasEnabledPropertyId = enabledToErrorStateProps.first; StatusCode status = @@ -1952,9 +2370,16 @@ TEST_F(FakeVehicleHardwareTest, testGetUserIdAssoc) { } TEST_F(FakeVehicleHardwareTest, testSwitchUser) { + SubscribeOptions options; + int32_t propSwitchUser = toInt(VehicleProperty::SWITCH_USER); + options.propId = propSwitchUser; + options.areaIds = {0, 1}; + ASSERT_EQ(StatusCode::OK, getHardware()->subscribe(options)) + << "failed to subscribe to propId: " << propSwitchUser; + // This is the same example as used in User HAL Emulation doc. VehiclePropValue valueToSet = { - .prop = toInt(VehicleProperty::SWITCH_USER), + .prop = propSwitchUser, .areaId = 1, .value.int32Values = {666, 3, 2}, }; @@ -1965,7 +2390,7 @@ TEST_F(FakeVehicleHardwareTest, testSwitchUser) { // Simulate a request from Android side. VehiclePropValue switchUserRequest = { - .prop = toInt(VehicleProperty::SWITCH_USER), + .prop = propSwitchUser, .areaId = 0, .value.int32Values = {666, 3}, }; @@ -1995,7 +2420,7 @@ TEST_F(FakeVehicleHardwareTest, testSwitchUser) { events[0].timestamp = 0; auto expectedValue = VehiclePropValue{ .areaId = 0, - .prop = toInt(VehicleProperty::SWITCH_USER), + .prop = propSwitchUser, .value.int32Values = { // Request ID @@ -2010,6 +2435,13 @@ TEST_F(FakeVehicleHardwareTest, testSwitchUser) { } TEST_F(FakeVehicleHardwareTest, testCreateUser) { + SubscribeOptions options; + int32_t propCreateUser = toInt(VehicleProperty::CREATE_USER); + options.propId = propCreateUser; + options.areaIds = {0, 1}; + ASSERT_EQ(StatusCode::OK, getHardware()->subscribe(options)) + << "failed to subscribe to propId: " << propCreateUser; + // This is the same example as used in User HAL Emulation doc. VehiclePropValue valueToSet = { .prop = toInt(VehicleProperty::CREATE_USER), @@ -2023,7 +2455,7 @@ TEST_F(FakeVehicleHardwareTest, testCreateUser) { // Simulate a request from Android side. VehiclePropValue createUserRequest = { - .prop = toInt(VehicleProperty::CREATE_USER), + .prop = propCreateUser, .areaId = 0, .value.int32Values = {666}, }; @@ -2052,7 +2484,7 @@ TEST_F(FakeVehicleHardwareTest, testCreateUser) { events[0].timestamp = 0; auto expectedValue = VehiclePropValue{ .areaId = 0, - .prop = toInt(VehicleProperty::CREATE_USER), + .prop = propCreateUser, .value.int32Values = { // Request ID @@ -2065,9 +2497,16 @@ TEST_F(FakeVehicleHardwareTest, testCreateUser) { } TEST_F(FakeVehicleHardwareTest, testInitialUserInfo) { + SubscribeOptions options; + int32_t propInitialUserInfo = toInt(VehicleProperty::INITIAL_USER_INFO); + options.propId = propInitialUserInfo; + options.areaIds = {0, 1}; + ASSERT_EQ(StatusCode::OK, getHardware()->subscribe(options)) + << "failed to subscribe to propId: " << propInitialUserInfo; + // This is the same example as used in User HAL Emulation doc. VehiclePropValue valueToSet = { - .prop = toInt(VehicleProperty::INITIAL_USER_INFO), + .prop = propInitialUserInfo, .areaId = 1, .value.int32Values = {666, 1, 11}, }; @@ -2078,7 +2517,7 @@ TEST_F(FakeVehicleHardwareTest, testInitialUserInfo) { // Simulate a request from Android side. VehiclePropValue initialUserInfoRequest = { - .prop = toInt(VehicleProperty::INITIAL_USER_INFO), + .prop = propInitialUserInfo, .areaId = 0, .value.int32Values = {3}, }; @@ -2095,7 +2534,7 @@ TEST_F(FakeVehicleHardwareTest, testInitialUserInfo) { events[0].timestamp = 0; auto expectedValue = VehiclePropValue{ .areaId = 0, - .prop = toInt(VehicleProperty::INITIAL_USER_INFO), + .prop = propInitialUserInfo, .value.int32Values = {3, 1, 11}, }; EXPECT_EQ(events[0], expectedValue); @@ -2110,7 +2549,7 @@ TEST_F(FakeVehicleHardwareTest, testInitialUserInfo) { events[0].timestamp = 0; expectedValue = VehiclePropValue{ .areaId = 0, - .prop = toInt(VehicleProperty::INITIAL_USER_INFO), + .prop = propInitialUserInfo, .value.int32Values = { // Request ID @@ -2252,13 +2691,14 @@ TEST_F(FakeVehicleHardwareTest, testSaveRestoreProp) { } TEST_F(FakeVehicleHardwareTest, testDumpInjectEvent) { - int32_t prop = toInt(VehicleProperty::PERF_VEHICLE_SPEED); + int32_t prop = toInt(VehicleProperty::ENGINE_OIL_LEVEL); std::string propIdStr = std::to_string(prop); + subscribe(prop, /*areaId*/ 0, /*sampleRateHz*/ 0); + int64_t timestamp = elapsedRealtimeNano(); - // Inject an event with float value 123.4 and timestamp. DumpResult result = getHardware()->dump( - {"--inject-event", propIdStr, "-f", "123.4", "-t", std::to_string(timestamp)}); + {"--inject-event", propIdStr, "-i", "1234", "-t", std::to_string(timestamp)}); ASSERT_FALSE(result.callerShouldDumpState); ASSERT_THAT(result.buffer, @@ -2269,7 +2709,7 @@ TEST_F(FakeVehicleHardwareTest, testDumpInjectEvent) { ASSERT_EQ(events.size(), 1u); auto event = events[0]; ASSERT_EQ(event.timestamp, timestamp); - ASSERT_EQ(event.value.floatValues, std::vector({123.4})); + ASSERT_EQ(event.value.int32Values, std::vector({1234})); } TEST_F(FakeVehicleHardwareTest, testDumpInvalidOptions) { @@ -2612,9 +3052,13 @@ INSTANTIATE_TEST_SUITE_P( }); TEST_F(FakeVehicleHardwareTest, testDebugGenFakeDataLinear) { - // Start a fake linear data generator for vehicle speed at 0.1s interval. + // Start a fake linear data generator for engine oil level at 0.1s interval. // range: 0 - 100, current value: 30, step: 20. - std::string propIdString = StringPrintf("%d", toInt(VehicleProperty::PERF_VEHICLE_SPEED)); + int32_t prop = toInt(VehicleProperty::ENGINE_OIL_LEVEL); + + subscribe(prop, /*areaId*/ 0, /*sampleRateHz*/ 0); + + std::string propIdString = StringPrintf("%d", prop); std::vector options = {"--genfakedata", "--startlinear", propIdString, /*middleValue=*/"50", /*currentValue=*/"30", @@ -2627,15 +3071,14 @@ TEST_F(FakeVehicleHardwareTest, testDebugGenFakeDataLinear) { ASSERT_FALSE(result.callerShouldDumpState); ASSERT_THAT(result.buffer, HasSubstr("successfully")); - ASSERT_TRUE(waitForChangedProperties(toInt(VehicleProperty::PERF_VEHICLE_SPEED), 0, /*count=*/5, - milliseconds(1000))) + ASSERT_TRUE(waitForChangedProperties(prop, 0, /*count=*/5, milliseconds(1000))) << "not enough events generated for linear data generator"; int32_t value = 30; auto events = getChangedProperties(); for (size_t i = 0; i < 5; i++) { - ASSERT_EQ(1u, events[i].value.floatValues.size()); - EXPECT_EQ(static_cast(value), events[i].value.floatValues[0]); + ASSERT_EQ(1u, events[i].value.int32Values.size()); + EXPECT_EQ(value, events[i].value.int32Values[0]); value = (value + 20) % 100; } @@ -2651,7 +3094,7 @@ TEST_F(FakeVehicleHardwareTest, testDebugGenFakeDataLinear) { std::this_thread::sleep_for(std::chrono::milliseconds(200)); // There should be no new events generated. - EXPECT_EQ(0u, getEventCount(toInt(VehicleProperty::PERF_VEHICLE_SPEED), 0)); + EXPECT_EQ(0u, getEventCount(prop, 0)); } std::string getTestFilePath(const char* filename) { @@ -2660,6 +3103,8 @@ std::string getTestFilePath(const char* filename) { } TEST_F(FakeVehicleHardwareTest, testDebugGenFakeDataJson) { + subscribe(toInt(VehicleProperty::GEAR_SELECTION), /*areaId*/ 0, /*sampleRateHz*/ 0); + std::vector options = {"--genfakedata", "--startjson", "--path", getTestFilePath("prop.json"), "2"}; @@ -2686,6 +3131,8 @@ TEST_F(FakeVehicleHardwareTest, testDebugGenFakeDataJson) { } TEST_F(FakeVehicleHardwareTest, testDebugGenFakeDataJsonByContent) { + subscribe(toInt(VehicleProperty::GEAR_SELECTION), /*areaId*/ 0, /*sampleRateHz*/ 0); + std::vector options = { "--genfakedata", "--startjson", "--content", "[{\"timestamp\":1000000,\"areaId\":0,\"value\":8,\"prop\":289408000}]", "1"}; @@ -2760,8 +3207,11 @@ TEST_F(FakeVehicleHardwareTest, testDebugGenFakeDataJsonStopInvalidFile) { } TEST_F(FakeVehicleHardwareTest, testDebugGenFakeDataKeyPress) { + int32_t propHwKeyInput = toInt(VehicleProperty::HW_KEY_INPUT); std::vector options = {"--genfakedata", "--keypress", "1", "2"}; + subscribe(propHwKeyInput, /*areaId*/ 0, /*sampleRateHz*/ 0); + DumpResult result = getHardware()->dump(options); ASSERT_FALSE(result.callerShouldDumpState); @@ -2769,8 +3219,8 @@ TEST_F(FakeVehicleHardwareTest, testDebugGenFakeDataKeyPress) { auto events = getChangedProperties(); ASSERT_EQ(2u, events.size()); - EXPECT_EQ(toInt(VehicleProperty::HW_KEY_INPUT), events[0].prop); - EXPECT_EQ(toInt(VehicleProperty::HW_KEY_INPUT), events[1].prop); + EXPECT_EQ(propHwKeyInput, events[0].prop); + EXPECT_EQ(propHwKeyInput, events[1].prop); ASSERT_EQ(3u, events[0].value.int32Values.size()); ASSERT_EQ(3u, events[1].value.int32Values.size()); EXPECT_EQ(toInt(VehicleHwKeyInputAction::ACTION_DOWN), events[0].value.int32Values[0]); @@ -2782,8 +3232,11 @@ TEST_F(FakeVehicleHardwareTest, testDebugGenFakeDataKeyPress) { } TEST_F(FakeVehicleHardwareTest, testDebugGenFakeDataKeyInputV2) { + int32_t propHwKeyInputV2 = toInt(VehicleProperty::HW_KEY_INPUT_V2); std::vector options = {"--genfakedata", "--keyinputv2", "1", "2", "3", "4", "5"}; + subscribe(propHwKeyInputV2, /*areaId*/ 1, /*sampleRateHz*/ 0); + DumpResult result = getHardware()->dump(options); ASSERT_FALSE(result.callerShouldDumpState); @@ -2801,6 +3254,7 @@ TEST_F(FakeVehicleHardwareTest, testDebugGenFakeDataKeyInputV2) { } TEST_F(FakeVehicleHardwareTest, testDebugGenFakeDataMotionInput) { + int32_t propHwMotionInput = toInt(VehicleProperty::HW_MOTION_INPUT); std::vector options = {"--genfakedata", "--motioninput", "1", @@ -2823,6 +3277,8 @@ TEST_F(FakeVehicleHardwareTest, testDebugGenFakeDataMotionInput) { "65.5", "76.6"}; + subscribe(propHwMotionInput, /*areaId*/ 1, /*sampleRateHz*/ 0); + DumpResult result = getHardware()->dump(options); ASSERT_FALSE(result.callerShouldDumpState); @@ -2830,7 +3286,7 @@ TEST_F(FakeVehicleHardwareTest, testDebugGenFakeDataMotionInput) { auto events = getChangedProperties(); ASSERT_EQ(1u, events.size()); - EXPECT_EQ(toInt(VehicleProperty::HW_MOTION_INPUT), events[0].prop); + EXPECT_EQ(propHwMotionInput, events[0].prop); ASSERT_EQ(9u, events[0].value.int32Values.size()); EXPECT_EQ(2, events[0].value.int32Values[0]); EXPECT_EQ(3, events[0].value.int32Values[1]); @@ -2855,7 +3311,7 @@ TEST_F(FakeVehicleHardwareTest, testDebugGenFakeDataMotionInput) { TEST_F(FakeVehicleHardwareTest, testGetEchoReverseBytes) { ASSERT_EQ(setValue(VehiclePropValue{ - .prop = ECHO_REVERSE_BYTES, + .prop = toInt(TestVendorProperty::ECHO_REVERSE_BYTES), .value = { .byteValues = {0x01, 0x02, 0x03, 0x04}, @@ -2864,30 +3320,34 @@ TEST_F(FakeVehicleHardwareTest, testGetEchoReverseBytes) { StatusCode::OK); auto result = getValue(VehiclePropValue{ - .prop = ECHO_REVERSE_BYTES, + .prop = toInt(TestVendorProperty::ECHO_REVERSE_BYTES), }); ASSERT_TRUE(result.ok()) << "failed to get ECHO_REVERSE_BYTES value: " << getStatus(result); ASSERT_EQ(result.value().value.byteValues, std::vector({0x04, 0x03, 0x02, 0x01})); } -TEST_F(FakeVehicleHardwareTest, testUpdateSampleRate) { +TEST_F(FakeVehicleHardwareTest, testSubscribeUnsubscribe_continuous) { int32_t propSpeed = toInt(VehicleProperty::PERF_VEHICLE_SPEED); int32_t propSteering = toInt(VehicleProperty::PERF_STEERING_ANGLE); int32_t areaId = 0; - getHardware()->updateSampleRate(propSpeed, areaId, 5); + + auto status = getHardware()->subscribe(newSubscribeOptions(propSpeed, areaId, 5)); + ASSERT_EQ(status, StatusCode::OK) << "failed to subscribe"; ASSERT_TRUE(waitForChangedProperties(propSpeed, areaId, /*count=*/5, milliseconds(1500))) << "not enough events generated for speed"; - getHardware()->updateSampleRate(propSteering, areaId, 10); + status = getHardware()->subscribe(newSubscribeOptions(propSteering, areaId, 10)); + ASSERT_EQ(status, StatusCode::OK) << "failed to subscribe"; ASSERT_TRUE(waitForChangedProperties(propSteering, areaId, /*count=*/10, milliseconds(1500))) << "not enough events generated for steering"; int64_t timestamp = elapsedRealtimeNano(); // Disable refreshing for propSpeed. - getHardware()->updateSampleRate(propSpeed, areaId, 0); + status = getHardware()->unsubscribe(propSpeed, areaId); + ASSERT_EQ(status, StatusCode::OK) << "failed to unsubscribe"; clearChangedProperties(); ASSERT_TRUE(waitForChangedProperties(propSteering, areaId, /*count=*/5, milliseconds(1500))) @@ -2900,12 +3360,99 @@ TEST_F(FakeVehicleHardwareTest, testUpdateSampleRate) { } } +TEST_F(FakeVehicleHardwareTest, testSubscribe_enableVUR) { + int32_t propSpeed = toInt(VehicleProperty::PERF_VEHICLE_SPEED); + int32_t areaId = 0; + SubscribeOptions options; + options.propId = propSpeed; + options.areaIds = {areaId}; + options.enableVariableUpdateRate = true; + options.sampleRate = 5; + int64_t timestamp = elapsedRealtimeNano(); + + auto status = getHardware()->subscribe(options); + ASSERT_EQ(status, StatusCode::OK) << "failed to subscribe"; + + status = setValue({ + .prop = propSpeed, + .areaId = 0, + .value.floatValues = {1.1f}, + }); + ASSERT_EQ(status, StatusCode::OK) << "failed to set speed"; + + status = setValue({ + .prop = propSpeed, + .areaId = 0, + .value.floatValues = {1.2f}, + }); + ASSERT_EQ(status, StatusCode::OK) << "failed to set speed"; + + ASSERT_TRUE(waitForChangedProperties(propSpeed, areaId, /*count=*/2, milliseconds(100))) + << "not enough events generated for speed"; + auto updatedValues = getChangedProperties(); + std::unordered_set gotValues; + for (auto& value : updatedValues) { + EXPECT_GE(value.timestamp, timestamp) << "timestamp must be updated"; + EXPECT_EQ(value.prop, propSpeed) << "propId must be correct"; + EXPECT_EQ(value.areaId, areaId) << "areaId must be correct"; + gotValues.insert(value.value.floatValues[0]); + } + EXPECT_THAT(gotValues, UnorderedElementsAre(1.1f, 1.2f)) + << "must only receive property event for changed value"; +} + +TEST_F(FakeVehicleHardwareTest, testSubscribeUnusubscribe_onChange) { + int32_t propHvac = toInt(VehicleProperty::HVAC_TEMPERATURE_SET); + int32_t areaId = SEAT_1_LEFT; + + auto status = getHardware()->subscribe(newSubscribeOptions(propHvac, areaId, 0)); + ASSERT_EQ(status, StatusCode::OK) << "failed to subscribe"; + + status = setValue({ + .prop = propHvac, + .areaId = areaId, + .value.floatValues = {20.0f}, + }); + ASSERT_EQ(status, StatusCode::OK) << "failed to set hvac value"; + + ASSERT_TRUE(waitForChangedProperties(propHvac, areaId, /*count=*/1, milliseconds(100))) + << "not enough on change events generated for hvac"; + clearChangedProperties(); + + status = setValue({ + .prop = propHvac, + .areaId = areaId, + .value.floatValues = {21.0f}, + }); + ASSERT_EQ(status, StatusCode::OK) << "failed to set hvac value"; + + ASSERT_TRUE(waitForChangedProperties(propHvac, areaId, /*count=*/1, milliseconds(100))) + << "not enough on change events generated for hvac"; + clearChangedProperties(); + + status = getHardware()->unsubscribe(propHvac, areaId); + ASSERT_EQ(status, StatusCode::OK); + + status = setValue({ + .prop = propHvac, + .areaId = areaId, + .value.floatValues = {22.0f}, + }); + ASSERT_EQ(status, StatusCode::OK) << "failed to set hvac value"; + + ASSERT_FALSE(waitForChangedProperties(propHvac, areaId, /*count=*/1, milliseconds(100))) + << "must not receive on change events if the propId, areaId is unsubscribed"; +} + TEST_F(FakeVehicleHardwareTest, testSetHvacTemperatureValueSuggestion) { float CELSIUS = static_cast(toInt(VehicleUnit::CELSIUS)); float FAHRENHEIT = static_cast(toInt(VehicleUnit::FAHRENHEIT)); + int32_t propHvacTempValueSuggest = toInt(VehicleProperty::HVAC_TEMPERATURE_VALUE_SUGGESTION); + + subscribe(propHvacTempValueSuggest, HVAC_ALL, /*sampleRateHz*/ 0); VehiclePropValue floatArraySizeFour = { - .prop = toInt(VehicleProperty::HVAC_TEMPERATURE_VALUE_SUGGESTION), + .prop = propHvacTempValueSuggest, .areaId = HVAC_ALL, .value.floatValues = {0, CELSIUS, 0, 0}, }; @@ -2913,14 +3460,14 @@ TEST_F(FakeVehicleHardwareTest, testSetHvacTemperatureValueSuggestion) { EXPECT_EQ(status, StatusCode::OK); VehiclePropValue floatArraySizeZero = { - .prop = toInt(VehicleProperty::HVAC_TEMPERATURE_VALUE_SUGGESTION), + .prop = propHvacTempValueSuggest, .areaId = HVAC_ALL, }; status = setValue(floatArraySizeZero); EXPECT_EQ(status, StatusCode::INVALID_ARG); VehiclePropValue floatArraySizeFive = { - .prop = toInt(VehicleProperty::HVAC_TEMPERATURE_VALUE_SUGGESTION), + .prop = propHvacTempValueSuggest, .areaId = HVAC_ALL, .value.floatValues = {0, CELSIUS, 0, 0, 0}, }; @@ -2928,7 +3475,7 @@ TEST_F(FakeVehicleHardwareTest, testSetHvacTemperatureValueSuggestion) { EXPECT_EQ(status, StatusCode::INVALID_ARG); VehiclePropValue invalidUnit = { - .prop = toInt(VehicleProperty::HVAC_TEMPERATURE_VALUE_SUGGESTION), + .prop = propHvacTempValueSuggest, .areaId = HVAC_ALL, .value.floatValues = {0, 0, 0, 0}, }; @@ -2938,13 +3485,8 @@ TEST_F(FakeVehicleHardwareTest, testSetHvacTemperatureValueSuggestion) { // Config array values from HVAC_TEMPERATURE_SET in DefaultProperties.json auto configs = getHardware()->getAllPropertyConfigs(); - VehiclePropConfig* hvacTemperatureSetConfig = nullptr; - for (auto& config : configs) { - if (config.prop == toInt(VehicleProperty::HVAC_TEMPERATURE_SET)) { - hvacTemperatureSetConfig = &config; - break; - } - } + auto hvacTemperatureSetConfig = + std::move(getVehiclePropConfig(toInt(VehicleProperty::HVAC_TEMPERATURE_SET))); EXPECT_NE(hvacTemperatureSetConfig, nullptr); auto& hvacTemperatureSetConfigArray = hvacTemperatureSetConfig->configArray; @@ -2964,9 +3506,7 @@ TEST_F(FakeVehicleHardwareTest, testSetHvacTemperatureValueSuggestion) { .valuesToSet = { VehiclePropValue{ - .prop = toInt( - VehicleProperty:: - HVAC_TEMPERATURE_VALUE_SUGGESTION), + .prop = propHvacTempValueSuggest, .areaId = HVAC_ALL, .value.floatValues = {minTempInCelsius, CELSIUS, 0, 0}, }, @@ -2974,9 +3514,7 @@ TEST_F(FakeVehicleHardwareTest, testSetHvacTemperatureValueSuggestion) { .expectedValuesToGet = { VehiclePropValue{ - .prop = toInt( - VehicleProperty:: - HVAC_TEMPERATURE_VALUE_SUGGESTION), + .prop = propHvacTempValueSuggest, .areaId = HVAC_ALL, .value.floatValues = {minTempInCelsius, CELSIUS, minTempInCelsius, @@ -2989,9 +3527,7 @@ TEST_F(FakeVehicleHardwareTest, testSetHvacTemperatureValueSuggestion) { .valuesToSet = { VehiclePropValue{ - .prop = toInt( - VehicleProperty:: - HVAC_TEMPERATURE_VALUE_SUGGESTION), + .prop = propHvacTempValueSuggest, .areaId = HVAC_ALL, .value.floatValues = {minTempInFahrenheit, FAHRENHEIT, 0, 0}, @@ -3000,9 +3536,7 @@ TEST_F(FakeVehicleHardwareTest, testSetHvacTemperatureValueSuggestion) { .expectedValuesToGet = { VehiclePropValue{ - .prop = toInt( - VehicleProperty:: - HVAC_TEMPERATURE_VALUE_SUGGESTION), + .prop = propHvacTempValueSuggest, .areaId = HVAC_ALL, .value.floatValues = {minTempInFahrenheit, FAHRENHEIT, minTempInCelsius, @@ -3015,9 +3549,7 @@ TEST_F(FakeVehicleHardwareTest, testSetHvacTemperatureValueSuggestion) { .valuesToSet = { VehiclePropValue{ - .prop = toInt( - VehicleProperty:: - HVAC_TEMPERATURE_VALUE_SUGGESTION), + .prop = propHvacTempValueSuggest, .areaId = HVAC_ALL, .value.floatValues = {maxTempInCelsius, CELSIUS, 0, 0}, }, @@ -3025,9 +3557,7 @@ TEST_F(FakeVehicleHardwareTest, testSetHvacTemperatureValueSuggestion) { .expectedValuesToGet = { VehiclePropValue{ - .prop = toInt( - VehicleProperty:: - HVAC_TEMPERATURE_VALUE_SUGGESTION), + .prop = propHvacTempValueSuggest, .areaId = HVAC_ALL, .value.floatValues = {maxTempInCelsius, CELSIUS, maxTempInCelsius, @@ -3040,9 +3570,7 @@ TEST_F(FakeVehicleHardwareTest, testSetHvacTemperatureValueSuggestion) { .valuesToSet = { VehiclePropValue{ - .prop = toInt( - VehicleProperty:: - HVAC_TEMPERATURE_VALUE_SUGGESTION), + .prop = propHvacTempValueSuggest, .areaId = HVAC_ALL, .value.floatValues = {maxTempInFahrenheit, FAHRENHEIT, 0, 0}, @@ -3051,9 +3579,7 @@ TEST_F(FakeVehicleHardwareTest, testSetHvacTemperatureValueSuggestion) { .expectedValuesToGet = { VehiclePropValue{ - .prop = toInt( - VehicleProperty:: - HVAC_TEMPERATURE_VALUE_SUGGESTION), + .prop = propHvacTempValueSuggest, .areaId = HVAC_ALL, .value.floatValues = {maxTempInFahrenheit, FAHRENHEIT, maxTempInCelsius, @@ -3066,9 +3592,7 @@ TEST_F(FakeVehicleHardwareTest, testSetHvacTemperatureValueSuggestion) { .valuesToSet = { VehiclePropValue{ - .prop = toInt( - VehicleProperty:: - HVAC_TEMPERATURE_VALUE_SUGGESTION), + .prop = propHvacTempValueSuggest, .areaId = HVAC_ALL, .value.floatValues = {minTempInCelsius - 1, CELSIUS, 0, 0}, @@ -3077,9 +3601,7 @@ TEST_F(FakeVehicleHardwareTest, testSetHvacTemperatureValueSuggestion) { .expectedValuesToGet = { VehiclePropValue{ - .prop = toInt( - VehicleProperty:: - HVAC_TEMPERATURE_VALUE_SUGGESTION), + .prop = propHvacTempValueSuggest, .areaId = HVAC_ALL, .value.floatValues = {minTempInCelsius - 1, CELSIUS, minTempInCelsius, @@ -3092,9 +3614,7 @@ TEST_F(FakeVehicleHardwareTest, testSetHvacTemperatureValueSuggestion) { .valuesToSet = { VehiclePropValue{ - .prop = toInt( - VehicleProperty:: - HVAC_TEMPERATURE_VALUE_SUGGESTION), + .prop = propHvacTempValueSuggest, .areaId = HVAC_ALL, .value.floatValues = {minTempInFahrenheit - 1, FAHRENHEIT, 0, 0}, @@ -3103,9 +3623,7 @@ TEST_F(FakeVehicleHardwareTest, testSetHvacTemperatureValueSuggestion) { .expectedValuesToGet = { VehiclePropValue{ - .prop = toInt( - VehicleProperty:: - HVAC_TEMPERATURE_VALUE_SUGGESTION), + .prop = propHvacTempValueSuggest, .areaId = HVAC_ALL, .value.floatValues = {minTempInFahrenheit - 1, FAHRENHEIT, minTempInCelsius, @@ -3118,9 +3636,7 @@ TEST_F(FakeVehicleHardwareTest, testSetHvacTemperatureValueSuggestion) { .valuesToSet = { VehiclePropValue{ - .prop = toInt( - VehicleProperty:: - HVAC_TEMPERATURE_VALUE_SUGGESTION), + .prop = propHvacTempValueSuggest, .areaId = HVAC_ALL, .value.floatValues = {maxTempInCelsius + 1, CELSIUS, 0, 0}, @@ -3129,9 +3645,7 @@ TEST_F(FakeVehicleHardwareTest, testSetHvacTemperatureValueSuggestion) { .expectedValuesToGet = { VehiclePropValue{ - .prop = toInt( - VehicleProperty:: - HVAC_TEMPERATURE_VALUE_SUGGESTION), + .prop = propHvacTempValueSuggest, .areaId = HVAC_ALL, .value.floatValues = {maxTempInCelsius + 1, CELSIUS, maxTempInCelsius, @@ -3144,9 +3658,7 @@ TEST_F(FakeVehicleHardwareTest, testSetHvacTemperatureValueSuggestion) { .valuesToSet = { VehiclePropValue{ - .prop = toInt( - VehicleProperty:: - HVAC_TEMPERATURE_VALUE_SUGGESTION), + .prop = propHvacTempValueSuggest, .areaId = HVAC_ALL, .value.floatValues = {maxTempInFahrenheit + 1, FAHRENHEIT, 0, 0}, @@ -3155,9 +3667,7 @@ TEST_F(FakeVehicleHardwareTest, testSetHvacTemperatureValueSuggestion) { .expectedValuesToGet = { VehiclePropValue{ - .prop = toInt( - VehicleProperty:: - HVAC_TEMPERATURE_VALUE_SUGGESTION), + .prop = propHvacTempValueSuggest, .areaId = HVAC_ALL, .value.floatValues = {maxTempInFahrenheit + 1, FAHRENHEIT, maxTempInCelsius, @@ -3170,9 +3680,7 @@ TEST_F(FakeVehicleHardwareTest, testSetHvacTemperatureValueSuggestion) { .valuesToSet = { VehiclePropValue{ - .prop = toInt( - VehicleProperty:: - HVAC_TEMPERATURE_VALUE_SUGGESTION), + .prop = propHvacTempValueSuggest, .areaId = HVAC_ALL, .value.floatValues = {minTempInCelsius + incrementInCelsius * 2.5f, @@ -3182,9 +3690,7 @@ TEST_F(FakeVehicleHardwareTest, testSetHvacTemperatureValueSuggestion) { .expectedValuesToGet = { VehiclePropValue{ - .prop = toInt( - VehicleProperty:: - HVAC_TEMPERATURE_VALUE_SUGGESTION), + .prop = propHvacTempValueSuggest, .areaId = HVAC_ALL, .value.floatValues = {minTempInCelsius + incrementInCelsius * 2.5f, @@ -3200,9 +3706,7 @@ TEST_F(FakeVehicleHardwareTest, testSetHvacTemperatureValueSuggestion) { .valuesToSet = { VehiclePropValue{ - .prop = toInt( - VehicleProperty:: - HVAC_TEMPERATURE_VALUE_SUGGESTION), + .prop = propHvacTempValueSuggest, .areaId = HVAC_ALL, .value.floatValues = {minTempInFahrenheit + incrementInFahrenheit * @@ -3213,9 +3717,7 @@ TEST_F(FakeVehicleHardwareTest, testSetHvacTemperatureValueSuggestion) { .expectedValuesToGet = { VehiclePropValue{ - .prop = toInt( - VehicleProperty:: - HVAC_TEMPERATURE_VALUE_SUGGESTION), + .prop = propHvacTempValueSuggest, .areaId = HVAC_ALL, .value.floatValues = {minTempInFahrenheit + diff --git a/automotive/vehicle/aidl/impl/grpc/utils/proto_message_converter/src/ProtoMessageConverter.cpp b/automotive/vehicle/aidl/impl/grpc/utils/proto_message_converter/src/ProtoMessageConverter.cpp index 6cbc7e523e22f25cbbd0a8d4ef7d4f85bff2e3b0..1ea0df4716bbb74e6db579e12ce8050ad01538fb 100644 --- a/automotive/vehicle/aidl/impl/grpc/utils/proto_message_converter/src/ProtoMessageConverter.cpp +++ b/automotive/vehicle/aidl/impl/grpc/utils/proto_message_converter/src/ProtoMessageConverter.cpp @@ -67,12 +67,19 @@ void aidlToProto(const aidl_vehicle::VehiclePropConfig& in, proto::VehiclePropCo for (auto& areaConfig : in.areaConfigs) { auto* protoACfg = out->add_area_configs(); protoACfg->set_area_id(areaConfig.areaId); + protoACfg->set_access(static_cast(toInt(areaConfig.access))); protoACfg->set_min_int64_value(areaConfig.minInt64Value); protoACfg->set_max_int64_value(areaConfig.maxInt64Value); protoACfg->set_min_float_value(areaConfig.minFloatValue); protoACfg->set_max_float_value(areaConfig.maxFloatValue); protoACfg->set_min_int32_value(areaConfig.minInt32Value); protoACfg->set_max_int32_value(areaConfig.maxInt32Value); + if (areaConfig.supportedEnumValues.has_value()) { + for (auto& supportedEnumValue : areaConfig.supportedEnumValues.value()) { + protoACfg->add_supported_enum_values(supportedEnumValue); + } + } + protoACfg->set_support_variable_update_rate(areaConfig.supportVariableUpdateRate); } } @@ -87,15 +94,24 @@ void protoToAidl(const proto::VehiclePropConfig& in, aidl_vehicle::VehiclePropCo COPY_PROTOBUF_VEC_TO_VHAL_TYPE(in, config_array, out, configArray); auto cast_to_acfg = [](const proto::VehicleAreaConfig& protoAcfg) { - return aidl_vehicle::VehicleAreaConfig{ + auto vehicleAreaConfig = aidl_vehicle::VehicleAreaConfig{ .areaId = protoAcfg.area_id(), + .access = static_cast(protoAcfg.access()), .minInt32Value = protoAcfg.min_int32_value(), .maxInt32Value = protoAcfg.max_int32_value(), .minInt64Value = protoAcfg.min_int64_value(), .maxInt64Value = protoAcfg.max_int64_value(), .minFloatValue = protoAcfg.min_float_value(), .maxFloatValue = protoAcfg.max_float_value(), + .supportVariableUpdateRate = protoAcfg.support_variable_update_rate(), }; + if (protoAcfg.supported_enum_values().size() != 0) { + vehicleAreaConfig.supportedEnumValues = std::vector(); + COPY_PROTOBUF_VEC_TO_VHAL_TYPE(protoAcfg, supported_enum_values, (&vehicleAreaConfig), + supportedEnumValues.value()); + } + + return vehicleAreaConfig; }; CAST_COPY_PROTOBUF_VEC_TO_VHAL_TYPE(in, area_configs, out, areaConfigs, cast_to_acfg); } diff --git a/automotive/vehicle/aidl/impl/hardware/include/IVehicleHardware.h b/automotive/vehicle/aidl/impl/hardware/include/IVehicleHardware.h index e53947ee331b5f7f79b1964f0bf5b9f7eb7ef5b0..f49d91b30c8c4e82d061ba5af229cb08cb082c95 100644 --- a/automotive/vehicle/aidl/impl/hardware/include/IVehicleHardware.h +++ b/automotive/vehicle/aidl/impl/hardware/include/IVehicleHardware.h @@ -82,6 +82,117 @@ class IVehicleHardware { const std::vector& requests) const = 0; + // Dump debug information in the server. + virtual DumpResult dump(const std::vector& options) = 0; + + // Check whether the system is healthy, return {@code StatusCode::OK} for healthy. + virtual aidl::android::hardware::automotive::vehicle::StatusCode checkHealth() = 0; + + // Register a callback that would be called when there is a property change event from vehicle. + // This function must only be called once during initialization. + virtual void registerOnPropertyChangeEvent( + std::unique_ptr callback) = 0; + + // Register a callback that would be called when there is a property set error event from + // vehicle. Must only be called once during initialization. + virtual void registerOnPropertySetErrorEvent( + std::unique_ptr callback) = 0; + + // Gets the batching window used by DefaultVehicleHal for property change events. + // + // In DefaultVehicleHal, all the property change events generated within the batching window + // will be delivered through one callback to the VHAL client. This affects the maximum supported + // subscription rate. For example, if this returns 10ms, then only one callback for property + // change events will be called per 10ms, meaining that the max subscription rate for all + // continuous properties would be 100hz. + // + // A higher batching window means less callbacks to the VHAL client, causing a better + // performance. However, it also means a longer average latency for every property change + // events. + // + // 0 means no batching should be enabled in DefaultVehicleHal. In this case, batching can + // be optionally implemented in IVehicleHardware layer. + virtual std::chrono::nanoseconds getPropertyOnChangeEventBatchingWindow() { + // By default batching is disabled. + return std::chrono::nanoseconds(0); + } + + // A [propId, areaId] is newly subscribed or the subscribe options are changed. + // + // The subscribe options contain sample rate in Hz or enable/disable variable update rate. + // + // For continuous properties: + // + // The sample rate is never 0 and indicates the desired polling rate for this property. The + // sample rate is guaranteed to be within supported {@code minSampleRate} and + // {@code maxSampleRate} as specified in {@code VehiclePropConfig}. + // + // If the specified sample rate is not supported, e.g. vehicle bus only supports 5hz and 10hz + // polling rate but the sample rate is 8hz, impl must choose the higher polling rate (10hz). + // + // Whether variable update rate is enabled is specified by {@code enableVariableUpdateRate} in + // {@code SubscribeOptions}. If variable update rate is not supported for the + // [propId, areaId], impl must ignore this option and always treat it as disabled. + // + // If variable update rate is disabled/not supported, impl must report all the property events + // for this [propId, areaId] through {@code propertyChangeCallback} according to the sample + // rate. E.g. a sample rate of 10hz must generate at least 10 property change events per second. + // + // If variable update rate is enabled AND supported, impl must only report property events + // when the [propId, areaId]'s value or status changes (a.k.a same as on-change property). + // The sample rate still guides the polling rate, but duplicate property events must be dropped + // and not reported via {@code propertyChangeCallback}. + // + // Async property set error events are not affected by variable update rate and must always + // be reported. + // + // If the impl is always polling at {@code maxSampleRate} for all continuous [propId, areaId]s, + // and do not support variable update rate for any [propId, areaId], then this function can be a + // no-op. + // + // For on-change properties: + // + // The sample rate is always 0 and must be ignored. If the impl is always subscribing to all + // on-change properties, then this function can be no-op. + // + // For all properties: + // + // It is recommended to only deliver the subscribed property events to DefaultVehicleHal to + // improve performance. However, even if unsubscribed property events are delivered, they + // will be filtered out by DefaultVehicleHal. + // + // A subscription from VHAL client might not necessarily trigger this function. + // DefaultVehicleHal will aggregate all the subscriptions from all the clients and notify + // IVehicleHardware if new subscriptions are required or subscribe options are updated. + // + // For example: + // 1. VHAL initially have no subscriber for speed. + // 2. A new subscriber is subscribing speed for 10 times/s, 'subscribe' is called + // with sampleRate as 10. The impl is now polling vehicle speed from bus 10 times/s. + // 3. A new subscriber is subscribing speed for 5 times/s, because it is less than 10 + // times/sec, 'subscribe' is not called. + // 4. The initial subscriber is removed, 'subscribe' is called with sampleRate as + // 5, because now it only needs to report event 5times/sec. The impl can now poll vehicle + // speed 5 times/s. If the impl is still polling at 10 times/s, that is okay as long as + // the polling rate is larger than 5times/s. DefaultVehicleHal would ignore the additional + // events. + // 5. The second subscriber is removed, 'unsubscribe' is called. + // The impl can optionally disable the polling for vehicle speed. + // + virtual aidl::android::hardware::automotive::vehicle::StatusCode subscribe( + [[maybe_unused]] aidl::android::hardware::automotive::vehicle::SubscribeOptions + options) { + return aidl::android::hardware::automotive::vehicle::StatusCode::OK; + } + + // A [propId, areaId] is unsubscribed. This applies for both continuous or on-change property. + virtual aidl::android::hardware::automotive::vehicle::StatusCode unsubscribe( + [[maybe_unused]] int32_t propId, [[maybe_unused]] int32_t areaId) { + return aidl::android::hardware::automotive::vehicle::StatusCode::OK; + } + + // This function is deprecated, subscribe/unsubscribe should be used instead. + // // Update the sampling rate for the specified property and the specified areaId (0 for global // property) if server supports it. The property must be a continuous property. // {@code sampleRate} means that for this specific property, the server must generate at least @@ -91,7 +202,7 @@ class IVehicleHardware { // This would be called if sample rate is updated for a subscriber, a new subscriber is added // or an existing subscriber is removed. For example: // 1. We have no subscriber for speed. - // 2. A new subscriber is subscribing speed for 10 times/s, updsateSampleRate would be called + // 2. A new subscriber is subscribing speed for 10 times/s, updateSampleRate would be called // with sampleRate as 10. The impl is now polling vehicle speed from bus 10 times/s. // 3. A new subscriber is subscribing speed for 5 times/s, because it is less than 10 // times/sec, updateSampleRate would not be called. @@ -110,22 +221,6 @@ class IVehicleHardware { [[maybe_unused]] float sampleRate) { return aidl::android::hardware::automotive::vehicle::StatusCode::OK; } - - // Dump debug information in the server. - virtual DumpResult dump(const std::vector& options) = 0; - - // Check whether the system is healthy, return {@code StatusCode::OK} for healthy. - virtual aidl::android::hardware::automotive::vehicle::StatusCode checkHealth() = 0; - - // Register a callback that would be called when there is a property change event from vehicle. - // Must only be called once during initialization. - virtual void registerOnPropertyChangeEvent( - std::unique_ptr callback) = 0; - - // Register a callback that would be called when there is a property set error event from - // vehicle. Must only be called once during initialization. - virtual void registerOnPropertySetErrorEvent( - std::unique_ptr callback) = 0; }; } // namespace vehicle diff --git a/automotive/vehicle/aidl/impl/proto/android/hardware/automotive/vehicle/StatusCode.proto b/automotive/vehicle/aidl/impl/proto/android/hardware/automotive/vehicle/StatusCode.proto index 63d7933e7dfc3b321fc0cdb0b074c16debfeace9..95e766a2ea03ed4d08aebc159a01a395c13657f0 100644 --- a/automotive/vehicle/aidl/impl/proto/android/hardware/automotive/vehicle/StatusCode.proto +++ b/automotive/vehicle/aidl/impl/proto/android/hardware/automotive/vehicle/StatusCode.proto @@ -38,6 +38,37 @@ enum StatusCode { /* Something unexpected has happened in Vehicle HAL */ INTERNAL_ERROR = 5; + + /** + * For features that are not available because the underlying feature is + * disabled. + */ + NOT_AVAILABLE_DISABLED = 6; + + /** + * For features that are not available because the vehicle speed is too low. + */ + NOT_AVAILABLE_SPEED_LOW = 7; + + /** + * For features that are not available because the vehicle speed is too + * high. + */ + NOT_AVAILABLE_SPEED_HIGH = 8; + + /** + * For features that are not available because of bad camera or sensor + * visibility. Examples might be bird poop blocking the camera or a bumper + * cover blocking an ultrasonic sensor. + */ + NOT_AVAILABLE_POOR_VISIBILITY = 9; + + /** + * The feature cannot be accessed due to safety reasons. Eg. System could be + * in a faulty state, an object or person could be blocking the requested + * operation such as closing a trunk door, etc. + */ + NOT_AVAILABLE_SAFETY = 10; }; message VehicleHalCallStatus { diff --git a/automotive/vehicle/aidl/impl/proto/android/hardware/automotive/vehicle/VehicleAreaConfig.proto b/automotive/vehicle/aidl/impl/proto/android/hardware/automotive/vehicle/VehicleAreaConfig.proto index b5b7e8070a8e43d98d9b6540130bdb24b438f73a..7ea8540cc3a71c10ca8be87b05feaba6b328ccb5 100644 --- a/automotive/vehicle/aidl/impl/proto/android/hardware/automotive/vehicle/VehicleAreaConfig.proto +++ b/automotive/vehicle/aidl/impl/proto/android/hardware/automotive/vehicle/VehicleAreaConfig.proto @@ -18,6 +18,8 @@ syntax = "proto3"; package android.hardware.automotive.vehicle.proto; +import "android/hardware/automotive/vehicle/VehiclePropertyAccess.proto"; + /* Must be in sync with VehicleAreaConfig.aidl. */ message VehicleAreaConfig { /* Area id is ignored for VehiclePropertyGroup:GLOBAL properties. */ @@ -36,4 +38,13 @@ message VehicleAreaConfig { float min_float_value = 6; float max_float_value = 7; + + /** + * If the property has a @data_enum, then it is possible to specify a supported subset of the + * @data_enum. If the property has a @data_enum and supported_enum_values is null, then it is + * assumed all @data_enum values are supported unless specified through another mechanism. + */ + repeated int64 supported_enum_values = 8; + VehiclePropertyAccess access = 9; + bool support_variable_update_rate = 10; }; diff --git a/automotive/vehicle/aidl/impl/utils/README.md b/automotive/vehicle/aidl/impl/utils/README.md index 87bb7e30346d75074e5580677ef4a0c3e157c158..255131ddc16e3888506f5d2e8058aae6f14fabcb 100644 --- a/automotive/vehicle/aidl/impl/utils/README.md +++ b/automotive/vehicle/aidl/impl/utils/README.md @@ -57,6 +57,6 @@ delete and lookup. Defines many useful utility functions. -## test +## test_vendor_properties -Defines utility libraries for test only. +Contains vendor properties used for testing purpose in reference VHAL. diff --git a/automotive/vehicle/aidl/impl/utils/common/include/ConcurrentQueue.h b/automotive/vehicle/aidl/impl/utils/common/include/ConcurrentQueue.h index 327c0dc35d06894f25c48b19e5878fb28bfc2676..b636aa344c3048e0db81a550973de8a531dd8d95 100644 --- a/automotive/vehicle/aidl/impl/utils/common/include/ConcurrentQueue.h +++ b/automotive/vehicle/aidl/impl/utils/common/include/ConcurrentQueue.h @@ -69,6 +69,19 @@ class ConcurrentQueue { mCond.notify_one(); } + void push(std::vector&& items) { + { + std::scoped_lock lockGuard(mLock); + if (!mIsActive) { + return; + } + for (T& item : items) { + mQueue.push(std::move(item)); + } + } + mCond.notify_one(); + } + // Deactivates the queue, thus no one can push items to it, also notifies all waiting thread. // The items already in the queue could still be flushed even after the queue is deactivated. void deactivate() { @@ -92,6 +105,69 @@ class ConcurrentQueue { std::queue mQueue GUARDED_BY(mLock); }; +template +class BatchingConsumer { + private: + enum class State { + INIT = 0, + RUNNING = 1, + STOP_REQUESTED = 2, + STOPPED = 3, + }; + + public: + BatchingConsumer() : mState(State::INIT) {} + + BatchingConsumer(const BatchingConsumer&) = delete; + BatchingConsumer& operator=(const BatchingConsumer&) = delete; + + using OnBatchReceivedFunc = std::function vec)>; + + void run(ConcurrentQueue* queue, std::chrono::nanoseconds batchInterval, + const OnBatchReceivedFunc& func) { + mQueue = queue; + mBatchInterval = batchInterval; + + mWorkerThread = std::thread(&BatchingConsumer::runInternal, this, func); + } + + void requestStop() { mState = State::STOP_REQUESTED; } + + void waitStopped() { + if (mWorkerThread.joinable()) { + mWorkerThread.join(); + } + } + + private: + void runInternal(const OnBatchReceivedFunc& onBatchReceived) { + if (mState.exchange(State::RUNNING) == State::INIT) { + while (State::RUNNING == mState) { + mQueue->waitForItems(); + if (State::STOP_REQUESTED == mState) break; + + std::this_thread::sleep_for(mBatchInterval); + if (State::STOP_REQUESTED == mState) break; + + std::vector items = mQueue->flush(); + + if (items.size() > 0) { + onBatchReceived(std::move(items)); + } + } + } + + mState = State::STOPPED; + } + + private: + std::thread mWorkerThread; + + std::atomic mState; + std::chrono::nanoseconds mBatchInterval; + ConcurrentQueue* mQueue; +}; + } // namespace vehicle } // namespace automotive } // namespace hardware diff --git a/automotive/vehicle/aidl/impl/utils/common/include/PropertyUtils.h b/automotive/vehicle/aidl/impl/utils/common/include/PropertyUtils.h index 7275ba30f97ae3ca123e1b51244d44157a23611f..78b61f714e9f966747fae75ecdb32751695745e8 100644 --- a/automotive/vehicle/aidl/impl/utils/common/include/PropertyUtils.h +++ b/automotive/vehicle/aidl/impl/utils/common/include/PropertyUtils.h @@ -77,22 +77,6 @@ constexpr int SEAT_1_RIGHT = toInt(propertyutils_impl::VehicleAreaSeat::ROW_1_RI constexpr int SEAT_2_LEFT = toInt(propertyutils_impl::VehicleAreaSeat::ROW_2_LEFT); constexpr int SEAT_2_RIGHT = toInt(propertyutils_impl::VehicleAreaSeat::ROW_2_RIGHT); constexpr int SEAT_2_CENTER = toInt(propertyutils_impl::VehicleAreaSeat::ROW_2_CENTER); -constexpr int VENDOR_EXTENSION_BOOLEAN_PROPERTY = - 0x101 | toInt(propertyutils_impl::VehiclePropertyGroup::VENDOR) | - toInt(propertyutils_impl::VehiclePropertyType::BOOLEAN) | - toInt(propertyutils_impl::VehicleArea::DOOR); -constexpr int VENDOR_EXTENSION_FLOAT_PROPERTY = - 0x102 | toInt(propertyutils_impl::VehiclePropertyGroup::VENDOR) | - toInt(propertyutils_impl::VehiclePropertyType::FLOAT) | - toInt(propertyutils_impl::VehicleArea::SEAT); -constexpr int VENDOR_EXTENSION_INT_PROPERTY = - 0x103 | toInt(propertyutils_impl::VehiclePropertyGroup::VENDOR) | - toInt(propertyutils_impl::VehiclePropertyType::INT32) | - toInt(propertyutils_impl::VehicleArea::WINDOW); -constexpr int VENDOR_EXTENSION_STRING_PROPERTY = - 0x104 | toInt(propertyutils_impl::VehiclePropertyGroup::VENDOR) | - toInt(propertyutils_impl::VehiclePropertyType::STRING) | - toInt(propertyutils_impl::VehicleArea::GLOBAL); constexpr int FUEL_DOOR_REAR_LEFT = toInt(propertyutils_impl::PortLocationType::REAR_LEFT); constexpr int CHARGE_PORT_FRONT_LEFT = toInt(propertyutils_impl::PortLocationType::FRONT_LEFT); constexpr int CHARGE_PORT_REAR_LEFT = toInt(propertyutils_impl::PortLocationType::REAR_LEFT); @@ -114,11 +98,6 @@ constexpr int HVAC_LEFT = SEAT_1_LEFT | SEAT_2_LEFT | SEAT_2_CENTER; constexpr int HVAC_RIGHT = SEAT_1_RIGHT | SEAT_2_RIGHT; constexpr int HVAC_ALL = HVAC_LEFT | HVAC_RIGHT; -const int32_t HVAC_POWER_PROPERTIES[] = { - toInt(propertyutils_impl::VehicleProperty::HVAC_FAN_SPEED), - toInt(propertyutils_impl::VehicleProperty::HVAC_FAN_DIRECTION), -}; - } // namespace vehicle } // namespace automotive } // namespace hardware diff --git a/automotive/vehicle/aidl/impl/utils/common/include/RecurrentTimer.h b/automotive/vehicle/aidl/impl/utils/common/include/RecurrentTimer.h index cd2b72713c7e1763a93d50d754a1386e92130d4b..712359a885b42501ddf6ded01e882e281c3499d2 100644 --- a/automotive/vehicle/aidl/impl/utils/common/include/RecurrentTimer.h +++ b/automotive/vehicle/aidl/impl/utils/common/include/RecurrentTimer.h @@ -19,6 +19,8 @@ #include +#include +#include #include #include #include @@ -31,6 +33,9 @@ namespace hardware { namespace automotive { namespace vehicle { +// Forward declaration +class RecurrentMessageHandler; + // A thread-safe recurrent timer. class RecurrentTimer final { public: @@ -43,49 +48,44 @@ class RecurrentTimer final { // Registers a recurrent callback for a given interval. // Registering the same callback twice will override the interval provided before. - void registerTimerCallback(int64_t intervalInNano, std::shared_ptr callback); + void registerTimerCallback(int64_t intervalInNanos, std::shared_ptr callback); // Unregisters a previously registered recurrent callback. void unregisterTimerCallback(std::shared_ptr callback); private: - // friend class for unit testing. + friend class RecurrentMessageHandler; + + // For unit test friend class RecurrentTimerTest; struct CallbackInfo { std::shared_ptr callback; - int64_t interval; - int64_t nextTime; - // A flag to indicate whether this CallbackInfo is already outdated and should be ignored. - // The reason we need this flag is because we cannot easily remove an element from a heap. - bool outdated = false; - - static bool cmp(const std::unique_ptr& lhs, - const std::unique_ptr& rhs); + int64_t intervalInNanos; + int64_t nextTimeInNanos; }; + android::sp mLooper; + android::sp mHandler; + + std::atomic mStopRequested = false; + std::atomic mCallbackId = 0; std::mutex mLock; std::thread mThread; - std::condition_variable mCond; - bool mStopRequested GUARDED_BY(mLock) = false; - // A map to map each callback to its current active CallbackInfo in the mCallbackQueue. - std::unordered_map, CallbackInfo*> mCallbacks GUARDED_BY(mLock); - // A min-heap sorted by nextTime. Note that because we cannot remove arbitrary element from the - // heap, a single Callback can have multiple entries in this queue, all but one should be valid. - // The rest should be mark as outdated. The valid one is one stored in mCallbacks. - std::vector> mCallbackQueue GUARDED_BY(mLock); - - void loop(); - - // Mark the callbackInfo as outdated and should be ignored when popped from the heap. - void markOutdatedLocked(CallbackInfo* callback) REQUIRES(mLock); - // Remove all outdated callbackInfos from the top of the heap. This function must be called - // each time we might introduce outdated elements to the top. We must make sure the heap is - // always valid from the top. - void removeInvalidCallbackLocked() REQUIRES(mLock); - // Gets the next calblack to run (must be valid) from the heap, update its nextTime and put - // it back to the heap. - std::shared_ptr getNextCallbackLocked(int64_t now) REQUIRES(mLock); + std::unordered_map, int> mIdByCallback GUARDED_BY(mLock); + std::unordered_map> mCallbackInfoById GUARDED_BY(mLock); + + void handleMessage(const android::Message& message) EXCLUDES(mLock); + int getCallbackIdLocked(std::shared_ptr callback) REQUIRES(mLock); +}; + +class RecurrentMessageHandler final : public android::MessageHandler { + public: + RecurrentMessageHandler(RecurrentTimer* timer) { mTimer = timer; } + void handleMessage(const android::Message& message) override; + + private: + RecurrentTimer* mTimer; }; } // namespace vehicle diff --git a/automotive/vehicle/aidl/impl/utils/common/include/VehicleHalTypes.h b/automotive/vehicle/aidl/impl/utils/common/include/VehicleHalTypes.h index e6d657d6754085b757d1f4b992c3bd548ec66ac9..bbd88dab484828a46bfa90e9bf3e6e2a30dddd50 100644 --- a/automotive/vehicle/aidl/impl/utils/common/include/VehicleHalTypes.h +++ b/automotive/vehicle/aidl/impl/utils/common/include/VehicleHalTypes.h @@ -19,11 +19,17 @@ #include #include +#include #include #include #include #include #include +#include +#include +#include +#include +#include #include #include #include @@ -38,11 +44,13 @@ #include #include #include +#include #include #include #include #include #include +#include #include #include #include @@ -55,6 +63,7 @@ #include #include #include +#include #include #include #include @@ -63,6 +72,7 @@ #include #include #include +#include #include #include #include diff --git a/automotive/vehicle/aidl/impl/utils/common/include/VehiclePropertyStore.h b/automotive/vehicle/aidl/impl/utils/common/include/VehiclePropertyStore.h index 3d25cd3a414489a838b72489146055c7373ea42c..d9599ed72c76c05bd014637840c42e748ca6df04 100644 --- a/automotive/vehicle/aidl/impl/utils/common/include/VehiclePropertyStore.h +++ b/automotive/vehicle/aidl/impl/utils/common/include/VehiclePropertyStore.h @@ -48,21 +48,21 @@ class VehiclePropertyStore final { enum class EventMode : uint8_t { /** - * Only invoke OnValueChangeCallback if the new property value (ignoring timestamp) is - * different than the existing value. + * Only invoke OnValueChangeCallback or OnValuesChangeCallback if the new property value + * (ignoring timestamp) is different than the existing value. * * This should be used for regular cases. */ ON_VALUE_CHANGE, /** - * Always invoke OnValueChangeCallback. + * Always invoke OnValueChangeCallback or OnValuesChangeCallback. * * This should be used for the special properties that are used for delivering event, e.g. * HW_KEY_INPUT. */ ALWAYS, /** - * Never invoke OnValueChangeCallback. + * Never invoke OnValueChangeCallback or OnValuesChangeCalblack. * * This should be used for continuous property subscription when the sample rate for the * subscription is smaller than the refresh rate for the property. E.g., the vehicle speed @@ -82,6 +82,10 @@ class VehiclePropertyStore final { using OnValueChangeCallback = std::function; + // Callback when one or more property values have been updated or new values added. + using OnValuesChangeCallback = std::function)>; + // Function that used to calculate unique token for given VehiclePropValue. using TokenFunction = std::function; @@ -92,54 +96,83 @@ class VehiclePropertyStore final { // used as the key. void registerProperty( const aidl::android::hardware::automotive::vehicle::VehiclePropConfig& config, - TokenFunction tokenFunc = nullptr); + TokenFunction tokenFunc = nullptr) EXCLUDES(mLock); // Stores provided value. Returns error if config wasn't registered. If 'updateStatus' is // true, the 'status' in 'propValue' would be stored. Otherwise, if this is a new value, // 'status' would be initialized to {@code VehiclePropertyStatus::AVAILABLE}, if this is to // override an existing value, the status for the existing value would be used for the // overridden value. - // 'EventMode' controls whether the 'OnValueChangeCallback' will be called for this operation. + // 'EventMode' controls whether the 'OnValueChangeCallback' or 'OnValuesChangeCallback' will be + // called for this operation. + // If 'useCurrentTimestamp' is true, the property value will be set to the current timestamp. VhalResult writeValue(VehiclePropValuePool::RecyclableType propValue, bool updateStatus = false, - EventMode mode = EventMode::ON_VALUE_CHANGE); + EventMode mode = EventMode::ON_VALUE_CHANGE, + bool useCurrentTimestamp = false) EXCLUDES(mLock); + + // Refresh the timestamp for the stored property value for [propId, areaId]. If eventMode is + // always, generates the property update event, otherwise, only update the stored timestamp + // without generating event. This operation is atomic with other writeValue operations. + void refreshTimestamp(int32_t propId, int32_t areaId, EventMode eventMode) EXCLUDES(mLock); + + // Refresh the timestamp for multiple [propId, areaId]s. + void refreshTimestamps( + std::unordered_map eventModeByPropIdAreaId) + EXCLUDES(mLock); // Remove a given property value from the property store. The 'propValue' would be used to // generate the key for the value to remove. void removeValue( - const aidl::android::hardware::automotive::vehicle::VehiclePropValue& propValue); + const aidl::android::hardware::automotive::vehicle::VehiclePropValue& propValue) + EXCLUDES(mLock); // Remove all the values for the property. - void removeValuesForProperty(int32_t propId); + void removeValuesForProperty(int32_t propId) EXCLUDES(mLock); // Read all the stored values. - std::vector readAllValues() const; + std::vector readAllValues() const EXCLUDES(mLock); // Read all the values for the property. - ValuesResultType readValuesForProperty(int32_t propId) const; + ValuesResultType readValuesForProperty(int32_t propId) const EXCLUDES(mLock); // Read the value for the requested property. Returns {@code StatusCode::NOT_AVAILABLE} if the // value has not been set yet. Returns {@code StatusCode::INVALID_ARG} if the property is // not configured. ValueResultType readValue( - const aidl::android::hardware::automotive::vehicle::VehiclePropValue& request) const; + const aidl::android::hardware::automotive::vehicle::VehiclePropValue& request) const + EXCLUDES(mLock); // Read the value for the requested property. Returns {@code StatusCode::NOT_AVAILABLE} if the // value has not been set yet. Returns {@code StatusCode::INVALID_ARG} if the property is // not configured. - ValueResultType readValue(int32_t prop, int32_t area = 0, int64_t token = 0) const; + ValueResultType readValue(int32_t prop, int32_t area = 0, int64_t token = 0) const + EXCLUDES(mLock); // Get all property configs. std::vector getAllConfigs() - const; + const EXCLUDES(mLock); - // Get the property config for the requested property. + // Deprecated, use getPropConfig instead. This is unsafe to use if registerProperty overwrites + // an existing config. android::base::Result - getConfig(int32_t propId) const; + getConfig(int32_t propId) const EXCLUDES(mLock); + + // Get the property config for the requested property. + android::base::Result + getPropConfig(int32_t propId) const EXCLUDES(mLock); // Set a callback that would be called when a property value has been updated. - void setOnValueChangeCallback(const OnValueChangeCallback& callback); + void setOnValueChangeCallback(const OnValueChangeCallback& callback) EXCLUDES(mLock); + + // Set a callback that would be called when one or more property values have been updated. + // For backward compatibility, this is optional. If this is not set, then multiple property + // updates will be delivered through multiple OnValueChangeCallback instead. + // It is recommended to set this and batch the property update events for better performance. + // If this is set, then OnValueChangeCallback will not be used. + void setOnValuesChangeCallback(const OnValuesChangeCallback& callback) EXCLUDES(mLock); inline std::shared_ptr getValuePool() { return mValuePool; } @@ -168,6 +201,7 @@ class VehiclePropertyStore final { mutable std::mutex mLock; std::unordered_map mRecordsByPropId GUARDED_BY(mLock); OnValueChangeCallback mOnValueChangeCallback GUARDED_BY(mLock); + OnValuesChangeCallback mOnValuesChangeCallback GUARDED_BY(mLock); const Record* getRecordLocked(int32_t propId) const; diff --git a/automotive/vehicle/aidl/impl/utils/common/include/VehicleUtils.h b/automotive/vehicle/aidl/impl/utils/common/include/VehicleUtils.h index c94bad6ca6f9b13bb574773bb23bd8d0df438fd1..546421e109e3f300cb37aa8310d548462090f2ce 100644 --- a/automotive/vehicle/aidl/impl/utils/common/include/VehicleUtils.h +++ b/automotive/vehicle/aidl/impl/utils/common/include/VehicleUtils.h @@ -329,6 +329,11 @@ struct PropIdAreaIdHash { } }; +inline std::string propIdToString(int32_t propId) { + return toString( + static_cast(propId)); +} + } // namespace vehicle } // namespace automotive } // namespace hardware diff --git a/automotive/vehicle/aidl/impl/utils/common/src/RecurrentTimer.cpp b/automotive/vehicle/aidl/impl/utils/common/src/RecurrentTimer.cpp index c6d3687553b91fecacdc901529f5e73ac881b33d..8dec695df149957c517d8a09e096842721149780 100644 --- a/automotive/vehicle/aidl/impl/utils/common/src/RecurrentTimer.cpp +++ b/automotive/vehicle/aidl/impl/utils/common/src/RecurrentTimer.cpp @@ -17,6 +17,7 @@ #include "RecurrentTimer.h" #include +#include #include #include @@ -27,153 +28,119 @@ namespace hardware { namespace automotive { namespace vehicle { +namespace { + using ::android::base::ScopedLockAssertion; +constexpr int INVALID_ID = -1; + +} // namespace + RecurrentTimer::RecurrentTimer() { - mThread = std::thread(&RecurrentTimer::loop, this); + mHandler = sp::make(this); + mLooper = sp::make(/*allowNonCallbacks=*/false); + mThread = std::thread([this] { + Looper::setForThread(mLooper); + + while (!mStopRequested) { + mLooper->pollOnce(/*timeoutMillis=*/-1); + } + }); } RecurrentTimer::~RecurrentTimer() { - { - std::scoped_lock lockGuard(mLock); - mStopRequested = true; - } - mCond.notify_one(); + mStopRequested = true; + mLooper->removeMessages(mHandler); + mLooper->wake(); if (mThread.joinable()) { mThread.join(); } } -void RecurrentTimer::registerTimerCallback(int64_t intervalInNano, +int RecurrentTimer::getCallbackIdLocked(std::shared_ptr callback) { + const auto& it = mIdByCallback.find(callback); + if (it != mIdByCallback.end()) { + return it->second; + } + return INVALID_ID; +} + +void RecurrentTimer::registerTimerCallback(int64_t intervalInNanos, std::shared_ptr callback) { { std::scoped_lock lockGuard(mLock); + int callbackId = getCallbackIdLocked(callback); + + if (callbackId == INVALID_ID) { + callbackId = mCallbackId++; + mIdByCallback.insert({callback, callbackId}); + } else { + ALOGI("Replacing an existing timer callback with a new interval, current: %" PRId64 + " ns, new: %" PRId64 " ns", + mCallbackInfoById[callbackId]->intervalInNanos, intervalInNanos); + mLooper->removeMessages(mHandler, callbackId); + } + // Aligns the nextTime to multiply of interval. - int64_t nextTime = ceil(uptimeNanos() / intervalInNano) * intervalInNano; + int64_t nextTimeInNanos = ceil(uptimeNanos() / intervalInNanos) * intervalInNanos; std::unique_ptr info = std::make_unique(); info->callback = callback; - info->interval = intervalInNano; - info->nextTime = nextTime; + info->intervalInNanos = intervalInNanos; + info->nextTimeInNanos = nextTimeInNanos; + mCallbackInfoById.insert({callbackId, std::move(info)}); - auto it = mCallbacks.find(callback); - if (it != mCallbacks.end()) { - ALOGI("Replacing an existing timer callback with a new interval, current: %" PRId64 - " ns, new: %" PRId64 " ns", - it->second->interval, intervalInNano); - markOutdatedLocked(it->second); - } - mCallbacks[callback] = info.get(); - mCallbackQueue.push_back(std::move(info)); - // Insert the last element into the heap. - std::push_heap(mCallbackQueue.begin(), mCallbackQueue.end(), CallbackInfo::cmp); + mLooper->sendMessageAtTime(nextTimeInNanos, mHandler, Message(callbackId)); } - mCond.notify_one(); } void RecurrentTimer::unregisterTimerCallback(std::shared_ptr callback) { { std::scoped_lock lockGuard(mLock); - auto it = mCallbacks.find(callback); - if (it == mCallbacks.end()) { + int callbackId = getCallbackIdLocked(callback); + + if (callbackId == INVALID_ID) { ALOGE("No event found to unregister"); return; } - markOutdatedLocked(it->second); - mCallbacks.erase(it); - } - - mCond.notify_one(); -} - -void RecurrentTimer::markOutdatedLocked(RecurrentTimer::CallbackInfo* info) { - info->outdated = true; - info->callback = nullptr; - // Make sure the first element is always valid. - removeInvalidCallbackLocked(); -} - -void RecurrentTimer::removeInvalidCallbackLocked() { - while (mCallbackQueue.size() != 0 && mCallbackQueue[0]->outdated) { - std::pop_heap(mCallbackQueue.begin(), mCallbackQueue.end(), CallbackInfo::cmp); - mCallbackQueue.pop_back(); + mLooper->removeMessages(mHandler, callbackId); + mCallbackInfoById.erase(callbackId); + mIdByCallback.erase(callback); } } -std::shared_ptr RecurrentTimer::getNextCallbackLocked(int64_t now) { - std::pop_heap(mCallbackQueue.begin(), mCallbackQueue.end(), CallbackInfo::cmp); - auto& callbackInfo = mCallbackQueue[mCallbackQueue.size() - 1]; - auto nextCallback = callbackInfo->callback; - // intervalCount is the number of interval we have to advance until we pass now. - size_t intervalCount = (now - callbackInfo->nextTime) / callbackInfo->interval + 1; - callbackInfo->nextTime += intervalCount * callbackInfo->interval; - std::push_heap(mCallbackQueue.begin(), mCallbackQueue.end(), CallbackInfo::cmp); - - // Make sure the first element is always valid. - removeInvalidCallbackLocked(); +void RecurrentTimer::handleMessage(const Message& message) { + std::shared_ptr callback; + { + std::scoped_lock lockGuard(mLock); - return nextCallback; -} + int callbackId = message.what; -void RecurrentTimer::loop() { - std::vector> callbacksToRun; - while (true) { - { - std::unique_lock uniqueLock(mLock); - ScopedLockAssertion lockAssertion(mLock); - // Wait until the timer exits or we have at least one recurrent callback. - mCond.wait(uniqueLock, [this] { - ScopedLockAssertion lockAssertion(mLock); - return mStopRequested || mCallbackQueue.size() != 0; - }); - - int64_t interval; - if (mStopRequested) { - return; - } - // The first element is the nearest next event. - int64_t nextTime = mCallbackQueue[0]->nextTime; - int64_t now = uptimeNanos(); - - if (nextTime > now) { - interval = nextTime - now; - } else { - interval = 0; - } - - // Wait for the next event or the timer exits. - if (mCond.wait_for(uniqueLock, std::chrono::nanoseconds(interval), [this] { - ScopedLockAssertion lockAssertion(mLock); - return mStopRequested; - })) { - return; - } - - now = uptimeNanos(); - callbacksToRun.clear(); - while (mCallbackQueue.size() > 0) { - int64_t nextTime = mCallbackQueue[0]->nextTime; - if (nextTime > now) { - break; - } - - callbacksToRun.push_back(getNextCallbackLocked(now)); - } + auto it = mCallbackInfoById.find(callbackId); + if (it == mCallbackInfoById.end()) { + ALOGW("The event for callback ID: %d is outdated, ignore", callbackId); + return; } - // Do not execute the callback while holding the lock. - for (size_t i = 0; i < callbacksToRun.size(); i++) { - (*callbacksToRun[i])(); - } + CallbackInfo* callbackInfo = it->second.get(); + callback = callbackInfo->callback; + int64_t nowNanos = uptimeNanos(); + // intervalCount is the number of interval we have to advance until we pass now. + size_t intervalCount = + (nowNanos - callbackInfo->nextTimeInNanos) / callbackInfo->intervalInNanos + 1; + callbackInfo->nextTimeInNanos += intervalCount * callbackInfo->intervalInNanos; + + mLooper->sendMessageAtTime(callbackInfo->nextTimeInNanos, mHandler, Message(callbackId)); } + + (*callback)(); } -bool RecurrentTimer::CallbackInfo::cmp(const std::unique_ptr& lhs, - const std::unique_ptr& rhs) { - return lhs->nextTime > rhs->nextTime; +void RecurrentMessageHandler::handleMessage(const Message& message) { + mTimer->handleMessage(message); } } // namespace vehicle diff --git a/automotive/vehicle/aidl/impl/utils/common/src/VehiclePropertyStore.cpp b/automotive/vehicle/aidl/impl/utils/common/src/VehiclePropertyStore.cpp index 646dc0e61831946ca85d1f5a1fe322a2e289f987..6a2a695254aef32d2078c78a76fb2f2fdb3d6fa8 100644 --- a/automotive/vehicle/aidl/impl/utils/common/src/VehiclePropertyStore.cpp +++ b/automotive/vehicle/aidl/impl/utils/common/src/VehiclePropertyStore.cpp @@ -16,6 +16,7 @@ #define LOG_TAG "VehiclePropertyStore" #include +#include #include "VehiclePropertyStore.h" @@ -107,56 +108,158 @@ void VehiclePropertyStore::registerProperty(const VehiclePropConfig& config, VhalResult VehiclePropertyStore::writeValue(VehiclePropValuePool::RecyclableType propValue, bool updateStatus, - VehiclePropertyStore::EventMode eventMode) { - std::scoped_lock g(mLock); - - int32_t propId = propValue->prop; + VehiclePropertyStore::EventMode eventMode, + bool useCurrentTimestamp) { + bool valueUpdated = true; + VehiclePropValue updatedValue; + OnValueChangeCallback onValueChangeCallback = nullptr; + OnValuesChangeCallback onValuesChangeCallback = nullptr; + int32_t propId; + int32_t areaId; + { + std::scoped_lock g(mLock); + + // Must set timestamp inside the lock to make sure no other writeValue will update the + // the timestamp to a newer one while we are writing this value. + if (useCurrentTimestamp) { + propValue->timestamp = elapsedRealtimeNano(); + } - VehiclePropertyStore::Record* record = getRecordLocked(propId); - if (record == nullptr) { - return StatusError(StatusCode::INVALID_ARG) << "property: " << propId << " not registered"; - } + propId = propValue->prop; + areaId = propValue->areaId; - if (!isGlobalProp(propId) && getAreaConfig(*propValue, record->propConfig) == nullptr) { - return StatusError(StatusCode::INVALID_ARG) - << "no config for property: " << propId << " area: " << propValue->areaId; - } + VehiclePropertyStore::Record* record = getRecordLocked(propId); + if (record == nullptr) { + return StatusError(StatusCode::INVALID_ARG) + << "property: " << propId << " not registered"; + } - VehiclePropertyStore::RecordId recId = getRecordIdLocked(*propValue, *record); - bool valueUpdated = true; - if (auto it = record->values.find(recId); it != record->values.end()) { - const VehiclePropValue* valueToUpdate = it->second.get(); - int64_t oldTimestamp = valueToUpdate->timestamp; - VehiclePropertyStatus oldStatus = valueToUpdate->status; - // propValue is outdated and drops it. - if (oldTimestamp > propValue->timestamp) { + if (!isGlobalProp(propId) && getAreaConfig(*propValue, record->propConfig) == nullptr) { return StatusError(StatusCode::INVALID_ARG) - << "outdated timestamp: " << propValue->timestamp; + << "no config for property: " << propId << " area ID: " << propValue->areaId; } - if (!updateStatus) { - propValue->status = oldStatus; + + VehiclePropertyStore::RecordId recId = getRecordIdLocked(*propValue, *record); + if (auto it = record->values.find(recId); it != record->values.end()) { + const VehiclePropValue* valueToUpdate = it->second.get(); + int64_t oldTimestampNanos = valueToUpdate->timestamp; + VehiclePropertyStatus oldStatus = valueToUpdate->status; + // propValue is outdated and drops it. + if (oldTimestampNanos > propValue->timestamp) { + return StatusError(StatusCode::INVALID_ARG) + << "outdated timestampNanos: " << propValue->timestamp; + } + if (!updateStatus) { + propValue->status = oldStatus; + } + + valueUpdated = (valueToUpdate->value != propValue->value || + valueToUpdate->status != propValue->status || + valueToUpdate->prop != propValue->prop || + valueToUpdate->areaId != propValue->areaId); + } else if (!updateStatus) { + propValue->status = VehiclePropertyStatus::AVAILABLE; } - valueUpdated = (valueToUpdate->value != propValue->value || - valueToUpdate->status != propValue->status || - valueToUpdate->prop != propValue->prop || - valueToUpdate->areaId != propValue->areaId); - } else if (!updateStatus) { - propValue->status = VehiclePropertyStatus::AVAILABLE; - } + record->values[recId] = std::move(propValue); - record->values[recId] = std::move(propValue); + if (eventMode == EventMode::NEVER) { + return {}; + } + updatedValue = *(record->values[recId]); + + onValuesChangeCallback = mOnValuesChangeCallback; + onValueChangeCallback = mOnValueChangeCallback; + } - if (eventMode == EventMode::NEVER) { + if (onValuesChangeCallback == nullptr && onValueChangeCallback == nullptr) { + ALOGW("No callback registered, ignoring property update for propId: %" PRId32 + ", area ID: %" PRId32, + propId, areaId); return {}; } - if ((eventMode == EventMode::ALWAYS || valueUpdated) && mOnValueChangeCallback != nullptr) { - mOnValueChangeCallback(*(record->values[recId])); + // Invoke the callback outside the lock to prevent dead-lock. + if (eventMode == EventMode::ALWAYS || valueUpdated) { + if (onValuesChangeCallback != nullptr) { + onValuesChangeCallback({updatedValue}); + } else { + onValueChangeCallback(updatedValue); + } } return {}; } +void VehiclePropertyStore::refreshTimestamp(int32_t propId, int32_t areaId, EventMode eventMode) { + std::unordered_map eventModeByPropIdAreaId; + PropIdAreaId propIdAreaId = { + .propId = propId, + .areaId = areaId, + }; + eventModeByPropIdAreaId[propIdAreaId] = eventMode; + refreshTimestamps(eventModeByPropIdAreaId); +} + +void VehiclePropertyStore::refreshTimestamps( + std::unordered_map eventModeByPropIdAreaId) { + std::vector updatedValues; + OnValuesChangeCallback onValuesChangeCallback = nullptr; + OnValueChangeCallback onValueChangeCallback = nullptr; + { + std::scoped_lock g(mLock); + + onValuesChangeCallback = mOnValuesChangeCallback; + onValueChangeCallback = mOnValueChangeCallback; + + for (const auto& [propIdAreaId, eventMode] : eventModeByPropIdAreaId) { + int32_t propId = propIdAreaId.propId; + int32_t areaId = propIdAreaId.areaId; + VehiclePropertyStore::Record* record = getRecordLocked(propId); + if (record == nullptr) { + continue; + } + + VehiclePropValue propValue = { + .areaId = areaId, + .prop = propId, + .value = {}, + }; + + VehiclePropertyStore::RecordId recId = getRecordIdLocked(propValue, *record); + if (auto it = record->values.find(recId); it != record->values.end()) { + it->second->timestamp = elapsedRealtimeNano(); + if (eventMode == EventMode::ALWAYS) { + updatedValues.push_back(*(it->second)); + } + } else { + continue; + } + } + } + + // Invoke the callback outside the lock to prevent dead-lock. + if (updatedValues.empty()) { + return; + } + if (!onValuesChangeCallback && !onValueChangeCallback) { + // If no callback is set, then we don't have to do anything. + for (const auto& updateValue : updatedValues) { + ALOGW("No callback registered, ignoring property update for propId: %" PRId32 + ", area ID: %" PRId32, + updateValue.prop, updateValue.areaId); + } + return; + } + if (onValuesChangeCallback != nullptr) { + onValuesChangeCallback(updatedValues); + } else { + // Fallback to use multiple onValueChangeCallback + for (const auto& updateValue : updatedValues) { + onValueChangeCallback(updateValue); + } + } +} + void VehiclePropertyStore::removeValue(const VehiclePropValue& propValue) { std::scoped_lock g(mLock); @@ -263,6 +366,17 @@ VhalResult VehiclePropertyStore::getConfig(int32_t pro return &record->propConfig; } +VhalResult VehiclePropertyStore::getPropConfig(int32_t propId) const { + std::scoped_lock g(mLock); + + const VehiclePropertyStore::Record* record = getRecordLocked(propId); + if (record == nullptr) { + return StatusError(StatusCode::INVALID_ARG) << "property: " << propId << " not registered"; + } + + return record->propConfig; +} + void VehiclePropertyStore::setOnValueChangeCallback( const VehiclePropertyStore::OnValueChangeCallback& callback) { std::scoped_lock g(mLock); @@ -270,6 +384,13 @@ void VehiclePropertyStore::setOnValueChangeCallback( mOnValueChangeCallback = callback; } +void VehiclePropertyStore::setOnValuesChangeCallback( + const VehiclePropertyStore::OnValuesChangeCallback& callback) { + std::scoped_lock g(mLock); + + mOnValuesChangeCallback = callback; +} + } // namespace vehicle } // namespace automotive } // namespace hardware diff --git a/automotive/vehicle/aidl/impl/utils/common/test/Android.bp b/automotive/vehicle/aidl/impl/utils/common/test/Android.bp index 250b33135b137b84fa431f31baf5bf01a881535e..dd4371255814b7d8a290dbe8c94dd378607a7bc5 100644 --- a/automotive/vehicle/aidl/impl/utils/common/test/Android.bp +++ b/automotive/vehicle/aidl/impl/utils/common/test/Android.bp @@ -27,7 +27,6 @@ cc_test { "libgtest", "libgmock", ], - header_libs: ["VehicleHalTestUtilHeaders"], defaults: ["VehicleHalDefaults"], test_suites: ["device-tests"], } diff --git a/automotive/vehicle/aidl/impl/utils/common/test/RecurrentTimerTest.cpp b/automotive/vehicle/aidl/impl/utils/common/test/RecurrentTimerTest.cpp index 62046f38dc6a2628a4f6d5809b255049abae0ad8..e8ac2a5b3800747346be9c37f2b021299d6cb99a 100644 --- a/automotive/vehicle/aidl/impl/utils/common/test/RecurrentTimerTest.cpp +++ b/automotive/vehicle/aidl/impl/utils/common/test/RecurrentTimerTest.cpp @@ -60,9 +60,14 @@ class RecurrentTimerTest : public testing::Test { mCallbacks.clear(); } - size_t countTimerCallbackQueue(RecurrentTimer* timer) { + size_t countCallbackInfoById(RecurrentTimer* timer) { std::scoped_lock lockGuard(timer->mLock); - return timer->mCallbackQueue.size(); + return timer->mCallbackInfoById.size(); + } + + size_t countIdByCallback(RecurrentTimer* timer) { + std::scoped_lock lockGuard(timer->mLock); + return timer->mIdByCallback.size(); } private: @@ -109,6 +114,9 @@ TEST_F(RecurrentTimerTest, testRegisterUnregisterRegister) { << "Not enough callbacks called before timeout"; timer.unregisterTimerCallback(action); + + ASSERT_EQ(countCallbackInfoById(&timer), 0u); + ASSERT_EQ(countIdByCallback(&timer), 0u); } TEST_F(RecurrentTimerTest, testDestroyTimerWithCallback) { @@ -198,8 +206,8 @@ TEST_F(RecurrentTimerTest, testRegisterSameCallbackMultipleTimes) { timer.unregisterTimerCallback(action); - // Make sure there is no item in the callback queue. - ASSERT_EQ(countTimerCallbackQueue(&timer), static_cast(0)); + ASSERT_EQ(countCallbackInfoById(&timer), 0u); + ASSERT_EQ(countIdByCallback(&timer), 0u); } TEST_F(RecurrentTimerTest, testRegisterCallbackMultipleTimesNoDeadLock) { diff --git a/automotive/vehicle/aidl/impl/utils/common/test/VehiclePropertyStoreTest.cpp b/automotive/vehicle/aidl/impl/utils/common/test/VehiclePropertyStoreTest.cpp index fea5034db916ea1dc904c1f93d2630f13976cf25..6646b7e752361fcafc3fde58e6562edec31850be 100644 --- a/automotive/vehicle/aidl/impl/utils/common/test/VehiclePropertyStoreTest.cpp +++ b/automotive/vehicle/aidl/impl/utils/common/test/VehiclePropertyStoreTest.cpp @@ -20,6 +20,7 @@ #include #include #include +#include namespace android { namespace hardware { @@ -101,16 +102,16 @@ TEST_F(VehiclePropertyStoreTest, testGetAllConfigs) { ASSERT_EQ(configs.size(), static_cast(2)); } -TEST_F(VehiclePropertyStoreTest, testGetConfig) { - VhalResult result = - mStore->getConfig(toInt(VehicleProperty::INFO_FUEL_CAPACITY)); +TEST_F(VehiclePropertyStoreTest, testGetPropConfig) { + VhalResult result = + mStore->getPropConfig(toInt(VehicleProperty::INFO_FUEL_CAPACITY)); ASSERT_RESULT_OK(result); - ASSERT_EQ(*(result.value()), mConfigFuelCapacity); + ASSERT_EQ(result.value(), mConfigFuelCapacity); } -TEST_F(VehiclePropertyStoreTest, testGetConfigWithInvalidPropId) { - VhalResult result = mStore->getConfig(INVALID_PROP_ID); +TEST_F(VehiclePropertyStoreTest, testGetPropConfigWithInvalidPropId) { + VhalResult result = mStore->getPropConfig(INVALID_PROP_ID); EXPECT_FALSE(result.ok()) << "expect error when getting a config for an invalid property ID"; EXPECT_EQ(result.error().code(), StatusCode::INVALID_ARG); @@ -509,6 +510,151 @@ TEST_F(VehiclePropertyStoreTest, testPropertyChangeCallbackForceNoUpdate) { ASSERT_EQ(updatedValue.prop, INVALID_PROP_ID); } +TEST_F(VehiclePropertyStoreTest, testPropertyChangeCallbackUseVehiclePropertyStore_noDeadLock) { + VehiclePropValue fuelCapacity = { + .prop = toInt(VehicleProperty::INFO_FUEL_CAPACITY), + .value = {.floatValues = {1.0}}, + }; + + std::vector configs; + + mStore->setOnValueChangeCallback( + [this, &configs]([[maybe_unused]] const VehiclePropValue& value) { + configs = mStore->getAllConfigs(); + }); + + ASSERT_RESULT_OK(mStore->writeValue(mValuePool->obtain(fuelCapacity), /*updateStatus=*/true, + VehiclePropertyStore::EventMode::ALWAYS)); + ASSERT_EQ(configs.size(), static_cast(2)); +} + +TEST_F(VehiclePropertyStoreTest, testOnValuesChangeCallback) { + std::vector updatedValues; + VehiclePropValue fuelCapacity = { + .prop = toInt(VehicleProperty::INFO_FUEL_CAPACITY), + .value = {.floatValues = {1.0}}, + }; + ASSERT_RESULT_OK(mStore->writeValue(mValuePool->obtain(fuelCapacity))); + + mStore->setOnValuesChangeCallback( + [&updatedValues](std::vector values) { updatedValues = values; }); + + fuelCapacity.value.floatValues[0] = 2.0; + fuelCapacity.timestamp = 1; + + ASSERT_RESULT_OK(mStore->writeValue(mValuePool->obtain(fuelCapacity))); + + ASSERT_THAT(updatedValues, ElementsAre(fuelCapacity)); +} + +TEST_F(VehiclePropertyStoreTest, testRefreshTimestamp) { + std::vector updatedValues; + mStore->setOnValuesChangeCallback( + [&updatedValues](std::vector values) { updatedValues = values; }); + + int64_t now = elapsedRealtimeNano(); + int propId = toInt(VehicleProperty::TIRE_PRESSURE); + int areaId = WHEEL_FRONT_LEFT; + VehiclePropValue tirePressure = { + .prop = propId, + .areaId = areaId, + .value = {.floatValues = {1.0}}, + }; + ASSERT_RESULT_OK(mStore->writeValue(mValuePool->obtain(tirePressure))); + updatedValues.clear(); + + mStore->refreshTimestamp(propId, areaId, VehiclePropertyStore::EventMode::ALWAYS); + + ASSERT_EQ(updatedValues.size(), 1u); + ASSERT_EQ(updatedValues[0].prop, propId); + ASSERT_EQ(updatedValues[0].areaId, areaId); + ASSERT_EQ(updatedValues[0].value.floatValues[0], 1.0); + int64_t timestamp = updatedValues[0].timestamp; + ASSERT_GE(timestamp, now); + + auto result = mStore->readValue(tirePressure); + + ASSERT_RESULT_OK(result); + ASSERT_EQ((result.value())->timestamp, timestamp); +} + +TEST_F(VehiclePropertyStoreTest, testRefreshTimestamp_eventModeOnValueChange) { + std::vector updatedValues; + mStore->setOnValuesChangeCallback( + [&updatedValues](std::vector values) { updatedValues = values; }); + + int64_t now = elapsedRealtimeNano(); + int propId = toInt(VehicleProperty::TIRE_PRESSURE); + int areaId = WHEEL_FRONT_LEFT; + VehiclePropValue tirePressure = { + .prop = propId, + .areaId = areaId, + .value = {.floatValues = {1.0}}, + }; + ASSERT_RESULT_OK(mStore->writeValue(mValuePool->obtain(tirePressure))); + updatedValues.clear(); + + mStore->refreshTimestamp(propId, areaId, VehiclePropertyStore::EventMode::ON_VALUE_CHANGE); + + ASSERT_EQ(updatedValues.size(), 0u) + << "Must generate no property update events if only the timestamp is refreshed"; + + auto result = mStore->readValue(tirePressure); + + ASSERT_RESULT_OK(result); + ASSERT_GE((result.value())->timestamp, now) + << "Even though event mode is on value change, the store timestamp must be updated"; +} + +TEST_F(VehiclePropertyStoreTest, testRefreshTimestamps) { + std::vector updatedValues; + mStore->setOnValuesChangeCallback( + [&updatedValues](std::vector values) { updatedValues = values; }); + + int64_t now = elapsedRealtimeNano(); + int propId1 = toInt(VehicleProperty::INFO_FUEL_CAPACITY); + int areaId1 = 0; + VehiclePropValue fuelCapacity = { + .prop = propId1, + .areaId = areaId1, + .value = {.floatValues = {1.0}}, + }; + ASSERT_RESULT_OK(mStore->writeValue(mValuePool->obtain(fuelCapacity))); + + int propId2 = toInt(VehicleProperty::TIRE_PRESSURE); + int areaId2 = WHEEL_FRONT_LEFT; + VehiclePropValue tirePressure = { + .prop = propId2, + .areaId = areaId2, + .value = {.floatValues = {2.0}}, + }; + ASSERT_RESULT_OK(mStore->writeValue(mValuePool->obtain(tirePressure))); + updatedValues.clear(); + + std::unordered_map + eventModeByPropIdAreaId; + eventModeByPropIdAreaId[PropIdAreaId{ + .propId = propId1, + .areaId = areaId1, + }] = VehiclePropertyStore::EventMode::ALWAYS; + eventModeByPropIdAreaId[PropIdAreaId{ + .propId = propId2, + .areaId = areaId2, + }] = VehiclePropertyStore::EventMode::ALWAYS; + + mStore->refreshTimestamps(eventModeByPropIdAreaId); + + ASSERT_EQ(updatedValues.size(), 2u); + ASSERT_EQ(updatedValues[0].prop, propId1); + ASSERT_EQ(updatedValues[0].areaId, areaId1); + ASSERT_EQ(updatedValues[0].value.floatValues[0], 1.0); + ASSERT_GE(updatedValues[0].timestamp, now); + ASSERT_EQ(updatedValues[1].prop, propId2); + ASSERT_EQ(updatedValues[1].areaId, areaId2); + ASSERT_EQ(updatedValues[1].value.floatValues[0], 2.0); + ASSERT_GE(updatedValues[1].timestamp, now); +} + } // namespace vehicle } // namespace automotive } // namespace hardware diff --git a/automotive/vehicle/aidl/impl/utils/common/test/VehicleUtilsTest.cpp b/automotive/vehicle/aidl/impl/utils/common/test/VehicleUtilsTest.cpp index 411539b38f1ed6a4236820356172fe5cf1e3f79a..9abb2a2fe6bda9912541aefe84fd7f50a6db4a4b 100644 --- a/automotive/vehicle/aidl/impl/utils/common/test/VehicleUtilsTest.cpp +++ b/automotive/vehicle/aidl/impl/utils/common/test/VehicleUtilsTest.cpp @@ -16,7 +16,6 @@ #include #include -#include #include #include @@ -56,6 +55,9 @@ constexpr int32_t int64Prop = toInt(VehicleProperty::ANDROID_EPOCH_TIME); constexpr int32_t int64VecProp = toInt(VehicleProperty::WHEEL_TICK); constexpr int32_t floatProp = toInt(VehicleProperty::ENV_OUTSIDE_TEMPERATURE); constexpr int32_t floatVecProp = toInt(VehicleProperty::HVAC_TEMPERATURE_VALUE_SUGGESTION); +constexpr int32_t kMixedTypePropertyForTest = 0x1111 | toInt(VehiclePropertyGroup::VENDOR) | + toInt(VehicleArea::GLOBAL) | + toInt(VehiclePropertyType::MIXED); std::vector getInvalidPropValuesTestCases() { return std::vector( diff --git a/automotive/vehicle/aidl/impl/utils/test/include/TestPropertyUtils.h b/automotive/vehicle/aidl/impl/utils/test/include/TestPropertyUtils.h deleted file mode 100644 index 14002884f5586f91bf9a145507953167f361bbb7..0000000000000000000000000000000000000000 --- a/automotive/vehicle/aidl/impl/utils/test/include/TestPropertyUtils.h +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright (C) 2021 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef android_hardware_automotive_vehicle_utils_test_include_TestPropertyUtils_H_ -#define android_hardware_automotive_vehicle_utils_test_include_TestPropertyUtils_H_ - -#include -#include - -namespace android { -namespace hardware { -namespace automotive { -namespace vehicle { - -namespace testpropertyutils_impl { - -// These names are not part of the API since we only expose ints. -using ::aidl::android::hardware::automotive::vehicle::VehicleArea; -using ::aidl::android::hardware::automotive::vehicle::VehicleProperty; -using ::aidl::android::hardware::automotive::vehicle::VehiclePropertyGroup; -using ::aidl::android::hardware::automotive::vehicle::VehiclePropertyType; - -} // namespace testpropertyutils_impl - -// Converts the system property to the vendor property. -// WARNING: This is only for the end-to-end testing, Should NOT include in the user build. -inline constexpr int32_t toVendor( - const aidl::android::hardware::automotive::vehicle::VehicleProperty& prop) { - return (toInt(prop) & ~toInt(testpropertyutils_impl::VehiclePropertyGroup::MASK)) | - toInt(testpropertyutils_impl::VehiclePropertyGroup::VENDOR); -} - -// These properties are used for the end-to-end testing of ClusterHomeService. -constexpr int32_t VENDOR_CLUSTER_SWITCH_UI = - toVendor(testpropertyutils_impl::VehicleProperty::CLUSTER_SWITCH_UI); -constexpr int32_t VENDOR_CLUSTER_DISPLAY_STATE = - toVendor(testpropertyutils_impl::VehicleProperty::CLUSTER_DISPLAY_STATE); -constexpr int32_t VENDOR_CLUSTER_REPORT_STATE = - toVendor(testpropertyutils_impl::VehicleProperty::CLUSTER_REPORT_STATE); -constexpr int32_t VENDOR_CLUSTER_REQUEST_DISPLAY = - toVendor(testpropertyutils_impl::VehicleProperty::CLUSTER_REQUEST_DISPLAY); -constexpr int32_t VENDOR_CLUSTER_NAVIGATION_STATE = - toVendor(testpropertyutils_impl::VehicleProperty::CLUSTER_NAVIGATION_STATE); - -// These properties are placeholder properties for developers to test new features without -// implementing a real property. -constexpr int32_t PLACEHOLDER_PROPERTY_INT = - 0x2a11 | toInt(testpropertyutils_impl::VehiclePropertyGroup::VENDOR) | - toInt(testpropertyutils_impl::VehicleArea::GLOBAL) | - toInt(testpropertyutils_impl::VehiclePropertyType::INT32); -constexpr int32_t PLACEHOLDER_PROPERTY_FLOAT = - 0x2a11 | toInt(testpropertyutils_impl::VehiclePropertyGroup::VENDOR) | - toInt(testpropertyutils_impl::VehicleArea::GLOBAL) | - toInt(testpropertyutils_impl::VehiclePropertyType::FLOAT); -constexpr int32_t PLACEHOLDER_PROPERTY_BOOLEAN = - 0x2a11 | toInt(testpropertyutils_impl::VehiclePropertyGroup::VENDOR) | - toInt(testpropertyutils_impl::VehicleArea::GLOBAL) | - toInt(testpropertyutils_impl::VehiclePropertyType::BOOLEAN); -constexpr int32_t PLACEHOLDER_PROPERTY_STRING = - 0x2a11 | toInt(testpropertyutils_impl::VehiclePropertyGroup::VENDOR) | - toInt(testpropertyutils_impl::VehicleArea::GLOBAL) | - toInt(testpropertyutils_impl::VehiclePropertyType::STRING); - -// This property is used for testing LargeParcelable marshalling/unmarhsalling end to end. -// It acts as an regular property that stores the property value when setting and return the value -// when getting, except that all the byteValues used in the setValue response would be filled in -// the reverse order. -// 0x21702a12 -constexpr int32_t ECHO_REVERSE_BYTES = 0x2a12 | - toInt(testpropertyutils_impl::VehiclePropertyGroup::VENDOR) | - toInt(testpropertyutils_impl::VehicleArea::GLOBAL) | - toInt(testpropertyutils_impl::VehiclePropertyType::BYTES); - -// This property is used for testing vendor error codes end to end. -// 0x21402a13 -constexpr int32_t VENDOR_PROPERTY_ID = 0x2a13 | - toInt(testpropertyutils_impl::VehiclePropertyGroup::VENDOR) | - toInt(testpropertyutils_impl::VehicleArea::GLOBAL) | - toInt(testpropertyutils_impl::VehiclePropertyType::INT32); - -// This property is used for test purpose. End to end tests use this property to test set and get -// method for MIXED type properties. -constexpr int32_t kMixedTypePropertyForTest = - 0x1111 | toInt(testpropertyutils_impl::VehiclePropertyGroup::VENDOR) | - toInt(testpropertyutils_impl::VehicleArea::GLOBAL) | - toInt(testpropertyutils_impl::VehiclePropertyType::MIXED); -} // namespace vehicle -} // namespace automotive -} // namespace hardware -} // namespace android - -#endif // android_hardware_automotive_vehicle_utils_test_include_TestPropertyUtils_H_ diff --git a/automotive/vehicle/aidl/impl/utils/test_vendor_properties/Android.bp b/automotive/vehicle/aidl/impl/utils/test_vendor_properties/Android.bp new file mode 100644 index 0000000000000000000000000000000000000000..f7da7e078b253744420cb5872f1235014c6f868a --- /dev/null +++ b/automotive/vehicle/aidl/impl/utils/test_vendor_properties/Android.bp @@ -0,0 +1,31 @@ +/* + * Copyright (C) 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package { + default_applicable_licenses: ["Android-Apache-2.0"], +} + +filegroup { + name: "VhalTestVendorProperties", + srcs: [ + "**/*.aidl", + ], + visibility: [ + "//hardware/interfaces/automotive/vehicle/aidl:__subpackages__", + "//packages/services/Car:__subpackages__", + "//cts/tests/tests/car_permission_tests", + ], +} diff --git a/automotive/vehicle/aidl/impl/utils/test_vendor_properties/android/hardware/automotive/vehicle/TestVendorProperty.aidl b/automotive/vehicle/aidl/impl/utils/test_vendor_properties/android/hardware/automotive/vehicle/TestVendorProperty.aidl new file mode 100644 index 0000000000000000000000000000000000000000..3c877fa1ce30380448f49c62f1b00f41b388c419 --- /dev/null +++ b/automotive/vehicle/aidl/impl/utils/test_vendor_properties/android/hardware/automotive/vehicle/TestVendorProperty.aidl @@ -0,0 +1,145 @@ +/* + * Copyright (C) 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.hardware.automotive.vehicle; + +/** + * Test vendor properties used in reference VHAL implementation. + */ +@Backing(type="int") +enum TestVendorProperty { + + /** + * Vendor version of CLUSTER_SWITCH_UI, used for the end-to-end testing of ClusterHomeService. + * + * VehiclePropertyGroup.VENDOR | VehicleArea.GLOBAL | VehiclePropertyType.INT32, + */ + VENDOR_CLUSTER_SWITCH_UI = 0x0F34 + 0x20000000 + 0x01000000 + 0x00400000, + + /** + * Vendor version of CLUSTER_DISPLAY_STATE, used for the end-to-end testing of + * ClusterHomeService. + * + * VehiclePropertyGroup.VENDOR | VehicleArea.GLOBAL | VehiclePropertyType.INT32_VEC + */ + VENDOR_CLUSTER_DISPLAY_STATE = 0x0F35 + 0x20000000 + 0x01000000 + 0x00410000, + + /** + * Vendor version of CLUSTER_REPORT_STATE, used for the end-to-end testing of + * ClusterHomeService. + * + * VehiclePropertyGroup.VENDOR | VehicleArea.GLOBAL | VehiclePropertyGroup.MIXED + */ + VENDOR_CLUSTER_REPORT_STATE = 0x0F36 + 0x20000000 + 0x01000000 + 0x00E00000, + + /** + * Vendor version of CLUSTER_REQUEST_DISPLAY, used for the end-to-end testing of + * ClusterHomeService. + * + * VehiclePropertyGroup.VENDOR | VehicleArea.GLOBAL | VehiclePropertyType.INT32 + */ + VENDOR_CLUSTER_REQUEST_DISPLAY = 0x0F37 + 0x20000000 + 0x01000000 + 0x00400000, + + /** + * Vendor version of CLUSTER_NAVIGATION_STATE, used for the end-to-end testing of + * ClusterHomeService. + * + * VehiclePropertyGroup.VENDOR | VehicleArea.GLOBAL | VehiclePropertyType.BYTES + */ + VENDOR_CLUSTER_NAVIGATION_STATE = 0x0F38 + 0x20000000 + 0x01000000 + 0x00700000, + + // These properties are placeholder properties for developers to test new features without + // implementing a real property. + + /** + * VehiclePropertyGroup.VENDOR | VehicleArea.GLOBAL | VehiclePropertyType.INT32 + */ + PLACEHOLDER_PROPERTY_INT = 0x2A11 + 0x20000000 + 0x01000000 + 0x00400000, + + /** + * VehiclePropertyGroup.VENDOR | VehicleArea.GLOBAL | VehiclePropertyType.FLOAT + */ + PLACEHOLDER_PROPERTY_FLOAT = 0x2A11 + 0x20000000 + 0x01000000 + 0x00600000, + + /** + * VehiclePropertyGroup.VENDOR | VehicleArea.GLOBAL | VehiclePropertyType.BOOLEAN + */ + PLACEHOLDER_PROPERTY_BOOLEAN = 0x2A11 + 0x20000000 + 0x01000000 + 0x00200000, + + /** + * VehiclePropertyGroup.VENDOR | VehicleArea.GLOBAL | VehiclePropertyType.STRING + */ + PLACEHOLDER_PROPERTY_STRING = 0x2A11 + 0x20000000 + 0x01000000 + 0x00100000, + + /** + * This property is used for testing LargeParcelable marshalling/unmarhsalling end to end. + * It acts as an regular property that stores the property value when setting and return the + * value when getting, except that all the byteValues used in the setValue response would be + * filled in the reverse order. + * + * This is used in {@code VehicleHalLargeParcelableTest}. + * + * VehiclePropertyGroup.VENDOR | VehicleArea.GLOBAL | VehiclePropertyType.BYTES + * + * 0x21702a12 + */ + ECHO_REVERSE_BYTES = 0x2A12 + 0x20000000 + 0x01000000 + 0x00700000, + + /** + * This property is used for testing vendor error codes end to end. + * + * VehiclePropertyGroup.VENDOR | VehicleArea.GLOBAL | VehiclePropertyType.INT32 + * + * 0x21402a13 + */ + VENDOR_PROPERTY_FOR_ERROR_CODE_TESTING = 0x2A13 + 0x20000000 + 0x01000000 + 0x00400000, + + /** + * This property is used for test purpose. End to end tests use this property to test set and + * get method for MIXED type properties. + * + * VehiclePropertyGroup.VENDOR | VehicleArea.GLOBAL | VehiclePropertyGroup.MIXED + */ + MIXED_TYPE_PROPERTY_FOR_TEST = 0x1111 + 0x20000000 + 0x01000000 + 0x00E00000, + + /** + * Property used for {@code CarVendorPropertyCustomPermissionTest}. + * + * VehiclePropertyGroup.VENDOR | VehicleArea.DOOR | VehiclePropertyGroup.BOOLEAN + */ + VENDOR_EXTENSION_BOOLEAN_PROPERTY = 0x0101 + 0x20000000 + 0x06000000 + 0x00200000, + + /** + * Property used for {@code CarVendorPropertyCustomPermissionTest}. + * + * VehiclePropertyGroup.VENDOR | VehicleArea.SEAT | VehiclePropertyGroup.FLOAT + */ + VENDOR_EXTENSION_FLOAT_PROPERTY = 0x102 + 0x20000000 + 0x05000000 + 0x00600000, + + /** + * Property used for {@code CarVendorPropertyCustomPermissionTest}. + * + * VehiclePropertyGroup.VENDOR | VehicleArea.WINDOW | VehiclePropertyGroup.INT32 + */ + VENDOR_EXTENSION_INT_PROPERTY = 0x103 + 0x20000000 + 0x03000000 + 0x00400000, + + /** + * Property used for {@code CarVendorPropertyCustomPermissionTest}. + * + * VehiclePropertyGroup.VENDOR | VehicleArea.GLOBAL | VehiclePropertyGroup.STRING + */ + VENDOR_EXTENSION_STRING_PROPERTY = 0x103 + 0x20000000 + 0x01000000 + 0x00100000, +} diff --git a/automotive/vehicle/aidl/impl/vhal/Android.bp b/automotive/vehicle/aidl/impl/vhal/Android.bp index 4feea79490925cb9f1057dbe706fca4017b2cd03..c29345f6224044bcd2f77f519126b48bdc8cb55a 100644 --- a/automotive/vehicle/aidl/impl/vhal/Android.bp +++ b/automotive/vehicle/aidl/impl/vhal/Android.bp @@ -19,7 +19,7 @@ package { } cc_binary { - name: "android.hardware.automotive.vehicle@V1-default-service", + name: "android.hardware.automotive.vehicle@V3-default-service", vendor: true, defaults: [ "FakeVehicleHardwareDefaults", @@ -68,7 +68,7 @@ cc_library { } cc_fuzz { - name: "android.hardware.automotive.vehicle@V1-default-service_fuzzer", + name: "android.hardware.automotive.vehicle-default-service_fuzzer", vendor: true, defaults: [ "FakeVehicleHardwareDefaults", diff --git a/automotive/vehicle/aidl/impl/vhal/include/ConnectedClient.h b/automotive/vehicle/aidl/impl/vhal/include/ConnectedClient.h index b3f4a0f722e85b69f96ce9b976be2f387bbcd26d..addc9014fce3026ae9615c3cba9a75b8c0c57b3b 100644 --- a/automotive/vehicle/aidl/impl/vhal/include/ConnectedClient.h +++ b/automotive/vehicle/aidl/impl/vhal/include/ConnectedClient.h @@ -99,13 +99,10 @@ class GetSetValuesClient final : public ConnectedClient { std::shared_ptr)>> mResultCallback; }; -// A class to represent a client that calls {@code IVehicle.subscribe}. -class SubscriptionClient final : public ConnectedClient { +class SubscriptionClient { public: - SubscriptionClient(std::shared_ptr requestPool, CallbackType callback); - - // Gets the callback to be called when the request for this client has finished. - std::shared_ptr getResultCallback(); + using CallbackType = + std::shared_ptr; // Marshals the updated values into largeParcelable and sends it through {@code onPropertyEvent} // callback. @@ -119,21 +116,6 @@ class SubscriptionClient final : public ConnectedClient { CallbackType callback, std::vector&& vehiclePropErrors); - - protected: - // Gets the callback to be called when the request for this client has timeout. - std::shared_ptr getTimeoutCallback() override; - - private: - // The following members are only initialized during construction. - std::shared_ptr mTimeoutCallback; - std::shared_ptr mResultCallback; - std::shared_ptr mPropertyChangeCallback; - - static void onGetValueResults( - const void* clientId, CallbackType callback, - std::shared_ptr requestPool, - std::vector results); }; } // namespace vehicle diff --git a/automotive/vehicle/aidl/impl/vhal/include/DefaultVehicleHal.h b/automotive/vehicle/aidl/impl/vhal/include/DefaultVehicleHal.h index 74ad7eaf3e871e1745d3328fbf144a5f562c6e94..f7a71b4587cbca471702b53f498463759fe9eb9f 100644 --- a/automotive/vehicle/aidl/impl/vhal/include/DefaultVehicleHal.h +++ b/automotive/vehicle/aidl/impl/vhal/include/DefaultVehicleHal.h @@ -90,39 +90,6 @@ class DefaultVehicleHal final : public aidl::android::hardware::automotive::vehi GetSetValuesClient; - // A thread safe class to maintain an increasing request ID for each subscribe client. This - // class is safe to pass to async callbacks. - class SubscribeIdByClient { - public: - int64_t getId(const CallbackType& callback); - - private: - std::mutex mLock; - std::unordered_map mIds GUARDED_BY(mLock); - }; - - // A thread safe class to store all subscribe clients. This class is safe to pass to async - // callbacks. - class SubscriptionClients { - public: - SubscriptionClients(std::shared_ptr pool) : mPendingRequestPool(pool) {} - - std::shared_ptr maybeAddClient(const CallbackType& callback); - - std::shared_ptr getClient(const CallbackType& callback); - - void removeClient(const AIBinder* clientId); - - size_t countClients(); - - private: - std::mutex mLock; - std::unordered_map> mClients - GUARDED_BY(mLock); - // PendingRequestPool is thread-safe. - std::shared_ptr mPendingRequestPool; - }; - // A wrapper for binder lifecycle operations to enable stubbing for test. class BinderLifecycleInterface { public: @@ -177,6 +144,15 @@ class DefaultVehicleHal final : public aidl::android::hardware::automotive::vehi std::shared_ptr mPendingRequestPool; // SubscriptionManager is thread-safe. std::shared_ptr mSubscriptionManager; + // ConcurrentQueue is thread-safe. + std::shared_ptr> + mBatchedEventQueue; + // BatchingConsumer is thread-safe. + std::shared_ptr< + BatchingConsumer> + mPropertyChangeEventsBatchingConsumer; + // Only set once during initialization. + std::chrono::nanoseconds mEventBatchingWindow; std::mutex mLock; std::unordered_map> mOnBinderDiedContexts @@ -185,8 +161,6 @@ class DefaultVehicleHal final : public aidl::android::hardware::automotive::vehi GUARDED_BY(mLock); std::unordered_map> mSetValuesClients GUARDED_BY(mLock); - // SubscriptionClients is thread-safe. - std::shared_ptr mSubscriptionClients; // mBinderLifecycleHandler is only going to be changed in test. std::unique_ptr mBinderLifecycleHandler; @@ -217,6 +191,10 @@ class DefaultVehicleHal final : public aidl::android::hardware::automotive::vehi const std::vector& options); + VhalResult checkPermissionHelper( + const aidl::android::hardware::automotive::vehicle::VehiclePropValue& value, + aidl::android::hardware::automotive::vehicle::VehiclePropertyAccess accessToTest) const; + VhalResult checkReadPermission( const aidl::android::hardware::automotive::vehicle::VehiclePropValue& value) const; @@ -242,6 +220,21 @@ class DefaultVehicleHal final : public aidl::android::hardware::automotive::vehi // mBinderEvents. void onBinderDiedUnlinkedHandler(); + size_t countSubscribeClients(); + + // Handles the property change events in batch. + void handleBatchedPropertyEvents( + std::vector&& + batchedEvents); + + // Puts the property change events into a queue so that they can handled in batch. + static void batchPropertyChangeEvent( + const std::weak_ptr>& + batchedEventQueue, + std::vector&& + updatedValues); + // Gets or creates a {@code T} object for the client to or from {@code clients}. template static std::shared_ptr getOrCreateClient( @@ -250,7 +243,7 @@ class DefaultVehicleHal final : public aidl::android::hardware::automotive::vehi static void onPropertyChangeEvent( const std::weak_ptr& subscriptionManager, - const std::vector& + std::vector&& updatedValues); static void onPropertySetErrorEvent( diff --git a/automotive/vehicle/aidl/impl/vhal/include/SubscriptionManager.h b/automotive/vehicle/aidl/impl/vhal/include/SubscriptionManager.h index 301d56c270749bc1f062ee41df5ac3f5c1b62beb..5053c96efedd6a5cf419b5121b369b6fdec85b36 100644 --- a/automotive/vehicle/aidl/impl/vhal/include/SubscriptionManager.h +++ b/automotive/vehicle/aidl/impl/vhal/include/SubscriptionManager.h @@ -36,20 +36,29 @@ namespace hardware { namespace automotive { namespace vehicle { +// A structure to represent subscription config for one subscription client. +struct SubConfig { + float sampleRateHz; + bool enableVur; +}; + // A class to represent all the subscription configs for a continuous [propId, areaId]. class ContSubConfigs final { public: using ClientIdType = const AIBinder*; - void addClient(const ClientIdType& clientId, float sampleRateHz); + void addClient(const ClientIdType& clientId, float sampleRateHz, bool enableVur); void removeClient(const ClientIdType& clientId); float getMaxSampleRateHz() const; + bool isVurEnabled() const; + bool isVurEnabledForClient(const ClientIdType& clientId); private: float mMaxSampleRateHz = 0.; - std::unordered_map mSampleRateHzByClient; + bool mEnableVur; + std::unordered_map mConfigByClient; - void refreshMaxSampleRateHz(); + void refreshCombinedConfig(); }; // A thread-safe subscription manager that manages all VHAL subscriptions. @@ -58,6 +67,7 @@ class SubscriptionManager final { using ClientIdType = const AIBinder*; using CallbackType = std::shared_ptr; + using VehiclePropValue = aidl::android::hardware::automotive::vehicle::VehiclePropValue; explicit SubscriptionManager(IVehicleHardware* vehicleHardware); ~SubscriptionManager(); @@ -92,12 +102,8 @@ class SubscriptionManager final { // For a list of updated properties, returns a map that maps clients subscribing to // the updated properties to a list of updated values. This would only return on-change property // clients that should be informed for the given updated values. - std::unordered_map< - CallbackType, - std::vector> - getSubscribedClients( - const std::vector& - updatedValues); + std::unordered_map> getSubscribedClients( + std::vector&& updatedValues); // For a list of set property error events, returns a map that maps clients subscribing to the // properties to a list of errors for each client. @@ -105,6 +111,9 @@ class SubscriptionManager final { std::vector> getSubscribedClientsForErrorEvents(const std::vector& errorEvents); + // Returns the number of subscribed clients. + size_t countClients(); + // Checks whether the sample rate is valid. static bool checkSampleRateHz(float sampleRateHz); @@ -114,28 +123,60 @@ class SubscriptionManager final { IVehicleHardware* mVehicleHardware; + struct VehiclePropValueHashPropIdAreaId { + inline size_t operator()(const VehiclePropValue& vehiclePropValue) const { + size_t res = 0; + hashCombine(res, vehiclePropValue.prop); + hashCombine(res, vehiclePropValue.areaId); + return res; + } + }; + + struct VehiclePropValueEqualPropIdAreaId { + inline bool operator()(const VehiclePropValue& left, const VehiclePropValue& right) const { + return left.prop == right.prop && left.areaId == right.areaId; + } + }; + mutable std::mutex mLock; std::unordered_map, PropIdAreaIdHash> - mClientsByPropIdArea GUARDED_BY(mLock); + mClientsByPropIdAreaId GUARDED_BY(mLock); std::unordered_map> mSubscribedPropsByClient GUARDED_BY(mLock); std::unordered_map mContSubConfigsByPropIdArea GUARDED_BY(mLock); + std::unordered_map> + mContSubValuesByCallback GUARDED_BY(mLock); VhalResult addContinuousSubscriberLocked(const ClientIdType& clientId, const PropIdAreaId& propIdAreaId, - float sampleRateHz) REQUIRES(mLock); + float sampleRateHz, bool enableVur) + REQUIRES(mLock); + VhalResult addOnChangeSubscriberLocked(const PropIdAreaId& propIdAreaId) REQUIRES(mLock); + // Removes the subscription client for the continuous [propId, areaId]. VhalResult removeContinuousSubscriberLocked(const ClientIdType& clientId, const PropIdAreaId& propIdAreaId) REQUIRES(mLock); + // Removes one subscription client for the on-change [propId, areaId]. + VhalResult removeOnChangeSubscriberLocked(const PropIdAreaId& propIdAreaId) + REQUIRES(mLock); + + VhalResult updateContSubConfigsLocked(const PropIdAreaId& PropIdAreaId, + const ContSubConfigs& newConfig) REQUIRES(mLock); - VhalResult updateContSubConfigs(const PropIdAreaId& PropIdAreaId, - const ContSubConfigs& newConfig) REQUIRES(mLock); + VhalResult unsubscribePropIdAreaIdLocked(SubscriptionManager::ClientIdType clientId, + const PropIdAreaId& propIdAreaId) + REQUIRES(mLock); // Checks whether the manager is empty. For testing purpose. bool isEmpty(); + bool isValueUpdatedLocked(const CallbackType& callback, const VehiclePropValue& value) + REQUIRES(mLock); + // Get the interval in nanoseconds accroding to sample rate. static android::base::Result getIntervalNanos(float sampleRateHz); }; diff --git a/automotive/vehicle/aidl/impl/vhal/src/ConnectedClient.cpp b/automotive/vehicle/aidl/impl/vhal/src/ConnectedClient.cpp index fb23a25047b8e2ddc22f775baeff3d0c620c6180..35b93d2128b3c9a649db60b8acc42dc5d0c5663e 100644 --- a/automotive/vehicle/aidl/impl/vhal/src/ConnectedClient.cpp +++ b/automotive/vehicle/aidl/impl/vhal/src/ConnectedClient.cpp @@ -250,36 +250,6 @@ void GetSetValuesClient::sendResultsSeparately( template class GetSetValuesClient; template class GetSetValuesClient; -SubscriptionClient::SubscriptionClient(std::shared_ptr requestPool, - std::shared_ptr callback) - : ConnectedClient(requestPool, callback) { - mTimeoutCallback = std::make_shared( - [](std::unordered_set timeoutIds) { - for (int64_t id : timeoutIds) { - ALOGW("subscribe: requests with IDs: %" PRId64 - " has timed-out, not client informed, " - "possibly one of recurrent requests for this subscription failed", - id); - } - }); - auto requestPoolCopy = mRequestPool; - const void* clientId = reinterpret_cast(this); - mResultCallback = std::make_shared( - [clientId, callback, requestPoolCopy](std::vector results) { - onGetValueResults(clientId, callback, requestPoolCopy, results); - }); -} - -std::shared_ptr)>> -SubscriptionClient::getResultCallback() { - return mResultCallback; -} - -std::shared_ptr -SubscriptionClient::getTimeoutCallback() { - return mTimeoutCallback; -} - void SubscriptionClient::sendUpdatedValues(std::shared_ptr callback, std::vector&& updatedValues) { if (updatedValues.empty()) { @@ -336,43 +306,6 @@ void SubscriptionClient::sendPropertySetErrors(std::shared_ptr } } -void SubscriptionClient::onGetValueResults(const void* clientId, - std::shared_ptr callback, - std::shared_ptr requestPool, - std::vector results) { - std::unordered_set requestIds; - for (const auto& result : results) { - requestIds.insert(result.requestId); - } - - auto finishedRequests = requestPool->tryFinishRequests(clientId, requestIds); - std::vector propValues; - for (auto& result : results) { - int64_t requestId = result.requestId; - if (finishedRequests.find(requestId) == finishedRequests.end()) { - ALOGE("subscribe[%" PRId64 - "]: no pending request for the result from hardware, " - "possibly already time-out", - requestId); - continue; - } - if (result.status != StatusCode::OK) { - ALOGE("subscribe[%" PRId64 - "]: hardware returns non-ok status for getValues, status: " - "%d", - requestId, toInt(result.status)); - continue; - } - if (!result.prop.has_value()) { - ALOGE("subscribe[%" PRId64 "]: no prop value in getValues result", requestId); - continue; - } - propValues.push_back(std::move(result.prop.value())); - } - - sendUpdatedValues(callback, std::move(propValues)); -} - } // namespace vehicle } // namespace automotive } // namespace hardware diff --git a/automotive/vehicle/aidl/impl/vhal/src/DefaultVehicleHal.cpp b/automotive/vehicle/aidl/impl/vhal/src/DefaultVehicleHal.cpp index 0d5c070c5406b29cf37f2c9f15c86a30b9a84db1..76d2f316ca0760c74ec34d66acdf532e0ae73a81 100644 --- a/automotive/vehicle/aidl/impl/vhal/src/DefaultVehicleHal.cpp +++ b/automotive/vehicle/aidl/impl/vhal/src/DefaultVehicleHal.cpp @@ -32,6 +32,7 @@ #include #include +#include #include #include @@ -92,39 +93,6 @@ float getDefaultSampleRateHz(float sampleRateHz, float minSampleRateHz, float ma } // namespace -std::shared_ptr DefaultVehicleHal::SubscriptionClients::maybeAddClient( - const CallbackType& callback) { - std::scoped_lock lockGuard(mLock); - return getOrCreateClient(&mClients, callback, mPendingRequestPool); -} - -std::shared_ptr DefaultVehicleHal::SubscriptionClients::getClient( - const CallbackType& callback) { - std::scoped_lock lockGuard(mLock); - const AIBinder* clientId = callback->asBinder().get(); - if (mClients.find(clientId) == mClients.end()) { - return nullptr; - } - return mClients[clientId]; -} - -int64_t DefaultVehicleHal::SubscribeIdByClient::getId(const CallbackType& callback) { - std::scoped_lock lockGuard(mLock); - // This would be initialized to 0 if callback does not exist in the map. - int64_t subscribeId = (mIds[callback->asBinder().get()])++; - return subscribeId; -} - -void DefaultVehicleHal::SubscriptionClients::removeClient(const AIBinder* clientId) { - std::scoped_lock lockGuard(mLock); - mClients.erase(clientId); -} - -size_t DefaultVehicleHal::SubscriptionClients::countClients() { - std::scoped_lock lockGuard(mLock); - return mClients.size(); -} - DefaultVehicleHal::DefaultVehicleHal(std::unique_ptr vehicleHardware) : mVehicleHardware(std::move(vehicleHardware)), mPendingRequestPool(std::make_shared(TIMEOUT_IN_NANO)) { @@ -132,17 +100,34 @@ DefaultVehicleHal::DefaultVehicleHal(std::unique_ptr vehicleHa return; } - mSubscriptionClients = std::make_shared(mPendingRequestPool); - - auto subscribeIdByClient = std::make_shared(); IVehicleHardware* vehicleHardwarePtr = mVehicleHardware.get(); mSubscriptionManager = std::make_shared(vehicleHardwarePtr); - + mEventBatchingWindow = mVehicleHardware->getPropertyOnChangeEventBatchingWindow(); + if (mEventBatchingWindow != std::chrono::nanoseconds(0)) { + mBatchedEventQueue = std::make_shared>(); + mPropertyChangeEventsBatchingConsumer = + std::make_shared>(); + mPropertyChangeEventsBatchingConsumer->run( + mBatchedEventQueue.get(), mEventBatchingWindow, + [this](std::vector batchedEvents) { + handleBatchedPropertyEvents(std::move(batchedEvents)); + }); + } + + std::weak_ptr> batchedEventQueueCopy = mBatchedEventQueue; + std::chrono::nanoseconds eventBatchingWindow = mEventBatchingWindow; std::weak_ptr subscriptionManagerCopy = mSubscriptionManager; mVehicleHardware->registerOnPropertyChangeEvent( std::make_unique( - [subscriptionManagerCopy](std::vector updatedValues) { - onPropertyChangeEvent(subscriptionManagerCopy, updatedValues); + [subscriptionManagerCopy, batchedEventQueueCopy, + eventBatchingWindow](std::vector updatedValues) { + if (eventBatchingWindow != std::chrono::nanoseconds(0)) { + batchPropertyChangeEvent(batchedEventQueueCopy, + std::move(updatedValues)); + } else { + onPropertyChangeEvent(subscriptionManagerCopy, + std::move(updatedValues)); + } })); mVehicleHardware->registerOnPropertySetErrorEvent( std::make_unique( @@ -175,26 +160,48 @@ DefaultVehicleHal::~DefaultVehicleHal() { // mRecurrentAction uses pointer to mVehicleHardware, so it has to be unregistered before // mVehicleHardware. mRecurrentTimer.unregisterTimerCallback(mRecurrentAction); + + if (mBatchedEventQueue) { + // mPropertyChangeEventsBatchingConsumer uses mSubscriptionManager and mBatchedEventQueue. + mBatchedEventQueue->deactivate(); + mPropertyChangeEventsBatchingConsumer->requestStop(); + mPropertyChangeEventsBatchingConsumer->waitStopped(); + mPropertyChangeEventsBatchingConsumer.reset(); + mBatchedEventQueue.reset(); + } + // mSubscriptionManager uses pointer to mVehicleHardware, so it has to be destroyed before // mVehicleHardware. mSubscriptionManager.reset(); mVehicleHardware.reset(); } +void DefaultVehicleHal::batchPropertyChangeEvent( + const std::weak_ptr>& batchedEventQueue, + std::vector&& updatedValues) { + auto batchedEventQueueStrong = batchedEventQueue.lock(); + if (batchedEventQueueStrong == nullptr) { + ALOGW("the batched property events queue is destroyed, DefaultVehicleHal is ending"); + return; + } + batchedEventQueueStrong->push(std::move(updatedValues)); +} + +void DefaultVehicleHal::handleBatchedPropertyEvents(std::vector&& batchedEvents) { + onPropertyChangeEvent(mSubscriptionManager, std::move(batchedEvents)); +} + void DefaultVehicleHal::onPropertyChangeEvent( const std::weak_ptr& subscriptionManager, - const std::vector& updatedValues) { + std::vector&& updatedValues) { + ATRACE_CALL(); auto manager = subscriptionManager.lock(); if (manager == nullptr) { ALOGW("the SubscriptionManager is destroyed, DefaultVehicleHal is ending"); return; } - auto updatedValuesByClients = manager->getSubscribedClients(updatedValues); - for (const auto& [callback, valuePtrs] : updatedValuesByClients) { - std::vector values; - for (const VehiclePropValue* valuePtr : valuePtrs) { - values.push_back(*valuePtr); - } + auto updatedValuesByClients = manager->getSubscribedClients(std::move(updatedValues)); + for (auto& [callback, values] : updatedValuesByClients) { SubscriptionClient::sendUpdatedValues(callback, std::move(values)); } } @@ -262,7 +269,6 @@ void DefaultVehicleHal::onBinderDiedWithContext(const AIBinder* clientId) { ALOGD("binder died, client ID: %p", clientId); mSetValuesClients.erase(clientId); mGetValuesClients.erase(clientId); - mSubscriptionClients->removeClient(clientId); mSubscriptionManager->unsubscribe(clientId); } @@ -301,10 +307,6 @@ template std::shared_ptr DefaultVehicleHal::getOrCreateClient( std::unordered_map>* clients, const CallbackType& callback, std::shared_ptr pendingRequestPool); -template std::shared_ptr -DefaultVehicleHal::getOrCreateClient( - std::unordered_map>* clients, - const CallbackType& callback, std::shared_ptr pendingRequestPool); void DefaultVehicleHal::setTimeout(int64_t timeoutInNano) { mPendingRequestPool = std::make_unique(timeoutInNano); @@ -604,6 +606,23 @@ ScopedAStatus DefaultVehicleHal::getPropConfigs(const std::vector& prop return vectorToStableLargeParcelable(std::move(configs), output); } +bool hasRequiredAccess(VehiclePropertyAccess access, VehiclePropertyAccess requiredAccess) { + return access == requiredAccess || access == VehiclePropertyAccess::READ_WRITE; +} + +bool areaConfigsHaveRequiredAccess(const std::vector& areaConfigs, + VehiclePropertyAccess requiredAccess) { + if (areaConfigs.empty()) { + return false; + } + for (VehicleAreaConfig areaConfig : areaConfigs) { + if (!hasRequiredAccess(areaConfig.access, requiredAccess)) { + return false; + } + } + return true; +} + VhalResult DefaultVehicleHal::checkSubscribeOptions( const std::vector& options) { for (const auto& option : options) { @@ -613,6 +632,26 @@ VhalResult DefaultVehicleHal::checkSubscribeOptions( << StringPrintf("no config for property, ID: %" PRId32, propId); } const VehiclePropConfig& config = mConfigsByPropId[propId]; + std::vector areaConfigs; + if (option.areaIds.empty()) { + areaConfigs = config.areaConfigs; + } else { + std::unordered_map areaConfigByAreaId; + for (const VehicleAreaConfig& areaConfig : config.areaConfigs) { + areaConfigByAreaId.emplace(areaConfig.areaId, areaConfig); + } + for (int areaId : option.areaIds) { + auto it = areaConfigByAreaId.find(areaId); + if (it != areaConfigByAreaId.end()) { + areaConfigs.push_back(it->second); + } else if (areaId != 0 || !areaConfigByAreaId.empty()) { + return StatusError(StatusCode::INVALID_ARG) + << StringPrintf("invalid area ID: %" PRId32 " for prop ID: %" PRId32 + ", not listed in config", + areaId, propId); + } + } + } if (config.changeMode != VehiclePropertyChangeMode::ON_CHANGE && config.changeMode != VehiclePropertyChangeMode::CONTINUOUS) { @@ -620,8 +659,9 @@ VhalResult DefaultVehicleHal::checkSubscribeOptions( << "only support subscribing to ON_CHANGE or CONTINUOUS property"; } - if (config.access != VehiclePropertyAccess::READ && - config.access != VehiclePropertyAccess::READ_WRITE) { + // Either VehiclePropConfig.access or VehicleAreaConfig.access will be specified + if (!hasRequiredAccess(config.access, VehiclePropertyAccess::READ) && + !areaConfigsHaveRequiredAccess(areaConfigs, VehiclePropertyAccess::READ)) { return StatusError(StatusCode::ACCESS_DENIED) << StringPrintf("Property %" PRId32 " has no read access", propId); } @@ -643,20 +683,6 @@ VhalResult DefaultVehicleHal::checkSubscribeOptions( << "invalid sample rate: " << sampleRateHz << " HZ"; } } - - if (isGlobalProp(propId)) { - continue; - } - - // Non-global property. - for (int32_t areaId : option.areaIds) { - if (auto areaConfig = getAreaConfig(propId, areaId, config); areaConfig == nullptr) { - return StatusError(StatusCode::INVALID_ARG) - << StringPrintf("invalid area ID: %" PRId32 " for prop ID: %" PRId32 - ", not listed in config", - areaId, propId); - } - } } return {}; } @@ -694,7 +720,39 @@ ScopedAStatus DefaultVehicleHal::subscribe(const CallbackType& callback, if (config.changeMode == VehiclePropertyChangeMode::CONTINUOUS) { optionCopy.sampleRate = getDefaultSampleRateHz( optionCopy.sampleRate, config.minSampleRate, config.maxSampleRate); - continuousSubscriptions.push_back(std::move(optionCopy)); + if (!optionCopy.enableVariableUpdateRate) { + continuousSubscriptions.push_back(std::move(optionCopy)); + } else { + // If clients enables to VUR, we need to check whether VUR is supported for the + // specific [propId, areaId] and overwrite the option to disable if not supported. + std::vector areasVurEnabled; + std::vector areasVurDisabled; + for (int32_t areaId : optionCopy.areaIds) { + const VehicleAreaConfig* areaConfig = getAreaConfig(propId, areaId, config); + if (areaConfig == nullptr) { + areasVurDisabled.push_back(areaId); + continue; + } + if (!areaConfig->supportVariableUpdateRate) { + areasVurDisabled.push_back(areaId); + continue; + } + areasVurEnabled.push_back(areaId); + } + if (!areasVurEnabled.empty()) { + SubscribeOptions optionVurEnabled = optionCopy; + optionVurEnabled.areaIds = areasVurEnabled; + optionVurEnabled.enableVariableUpdateRate = true; + continuousSubscriptions.push_back(std::move(optionVurEnabled)); + } + + if (!areasVurDisabled.empty()) { + // We use optionCopy for areas with VUR disabled. + optionCopy.areaIds = areasVurDisabled; + optionCopy.enableVariableUpdateRate = false; + continuousSubscriptions.push_back(std::move(optionCopy)); + } + } } else { onChangeSubscriptions.push_back(std::move(optionCopy)); } @@ -708,9 +766,6 @@ ScopedAStatus DefaultVehicleHal::subscribe(const CallbackType& callback, "client died"); } - // Create a new SubscriptionClient if there isn't an existing one. - mSubscriptionClients->maybeAddClient(callback); - if (!onChangeSubscriptions.empty()) { auto result = mSubscriptionManager->subscribe(callback, onChangeSubscriptions, /*isContinuousProperty=*/false); @@ -746,36 +801,42 @@ IVehicleHardware* DefaultVehicleHal::getHardware() { return mVehicleHardware.get(); } -VhalResult DefaultVehicleHal::checkWritePermission(const VehiclePropValue& value) const { +VhalResult DefaultVehicleHal::checkPermissionHelper( + const VehiclePropValue& value, VehiclePropertyAccess accessToTest) const { + static const std::unordered_set validAccesses = { + VehiclePropertyAccess::WRITE, VehiclePropertyAccess::READ, + VehiclePropertyAccess::READ_WRITE}; + if (validAccesses.find(accessToTest) == validAccesses.end()) { + return StatusError(StatusCode::INVALID_ARG) + << "checkPermissionHelper parameter is an invalid access type"; + } + int32_t propId = value.prop; auto result = getConfig(propId); if (!result.ok()) { return StatusError(StatusCode::INVALID_ARG) << getErrorMsg(result); } const VehiclePropConfig* config = result.value(); + const VehicleAreaConfig* areaConfig = getAreaConfig(value, *config); - if (config->access != VehiclePropertyAccess::WRITE && - config->access != VehiclePropertyAccess::READ_WRITE) { + if (areaConfig == nullptr && !isGlobalProp(propId)) { + return StatusError(StatusCode::INVALID_ARG) << "no config for area ID: " << value.areaId; + } + if (!hasRequiredAccess(config->access, accessToTest) && + (areaConfig == nullptr || !hasRequiredAccess(areaConfig->access, accessToTest))) { return StatusError(StatusCode::ACCESS_DENIED) - << StringPrintf("Property %" PRId32 " has no write access", propId); + << StringPrintf("Property %" PRId32 " does not have the following access: %" PRId32, + propId, accessToTest); } return {}; } -VhalResult DefaultVehicleHal::checkReadPermission(const VehiclePropValue& value) const { - int32_t propId = value.prop; - auto result = getConfig(propId); - if (!result.ok()) { - return StatusError(StatusCode::INVALID_ARG) << getErrorMsg(result); - } - const VehiclePropConfig* config = result.value(); +VhalResult DefaultVehicleHal::checkWritePermission(const VehiclePropValue& value) const { + return checkPermissionHelper(value, VehiclePropertyAccess::WRITE); +} - if (config->access != VehiclePropertyAccess::READ && - config->access != VehiclePropertyAccess::READ_WRITE) { - return StatusError(StatusCode::ACCESS_DENIED) - << StringPrintf("Property %" PRId32 " has no read access", propId); - } - return {}; +VhalResult DefaultVehicleHal::checkReadPermission(const VehiclePropValue& value) const { + return checkPermissionHelper(value, VehiclePropertyAccess::READ); } void DefaultVehicleHal::checkHealth(IVehicleHardware* vehicleHardware, @@ -786,12 +847,12 @@ void DefaultVehicleHal::checkHealth(IVehicleHardware* vehicleHardware, return; } std::vector values = {{ - .prop = toInt(VehicleProperty::VHAL_HEARTBEAT), .areaId = 0, + .prop = toInt(VehicleProperty::VHAL_HEARTBEAT), .status = VehiclePropertyStatus::AVAILABLE, .value.int64Values = {uptimeMillis()}, }}; - onPropertyChangeEvent(subscriptionManager, values); + onPropertyChangeEvent(subscriptionManager, std::move(values)); return; } @@ -842,12 +903,15 @@ binder_status_t DefaultVehicleHal::dump(int fd, const char** args, uint32_t numA dprintf(fd, "Containing %zu property configs\n", mConfigsByPropId.size()); dprintf(fd, "Currently have %zu getValues clients\n", mGetValuesClients.size()); dprintf(fd, "Currently have %zu setValues clients\n", mSetValuesClients.size()); - dprintf(fd, "Currently have %zu subscription clients\n", - mSubscriptionClients->countClients()); + dprintf(fd, "Currently have %zu subscribe clients\n", countSubscribeClients()); } return STATUS_OK; } +size_t DefaultVehicleHal::countSubscribeClients() { + return mSubscriptionManager->countClients(); +} + } // namespace vehicle } // namespace automotive } // namespace hardware diff --git a/automotive/vehicle/aidl/impl/vhal/src/SubscriptionManager.cpp b/automotive/vehicle/aidl/impl/vhal/src/SubscriptionManager.cpp index 1f2690e340303f4a92eefc9f43c76371c595f92a..29d81a75e7ed14ad6aba118724c2e40de5488b15 100644 --- a/automotive/vehicle/aidl/impl/vhal/src/SubscriptionManager.cpp +++ b/automotive/vehicle/aidl/impl/vhal/src/SubscriptionManager.cpp @@ -16,6 +16,7 @@ #include "SubscriptionManager.h" +#include #include #include #include @@ -29,10 +30,6 @@ namespace vehicle { namespace { -constexpr float ONE_SECOND_IN_NANO = 1'000'000'000.; - -} // namespace - using ::aidl::android::hardware::automotive::vehicle::IVehicleCallback; using ::aidl::android::hardware::automotive::vehicle::StatusCode; using ::aidl::android::hardware::automotive::vehicle::SubscribeOptions; @@ -43,13 +40,28 @@ using ::android::base::Result; using ::android::base::StringPrintf; using ::ndk::ScopedAStatus; +constexpr float ONE_SECOND_IN_NANOS = 1'000'000'000.; + +SubscribeOptions newSubscribeOptions(int32_t propId, int32_t areaId, float sampleRateHz, + bool enableVur) { + SubscribeOptions subscribedOptions; + subscribedOptions.propId = propId; + subscribedOptions.areaIds = {areaId}; + subscribedOptions.sampleRate = sampleRateHz; + subscribedOptions.enableVariableUpdateRate = enableVur; + + return subscribedOptions; +} + +} // namespace + SubscriptionManager::SubscriptionManager(IVehicleHardware* vehicleHardware) : mVehicleHardware(vehicleHardware) {} SubscriptionManager::~SubscriptionManager() { std::scoped_lock lockGuard(mLock); - mClientsByPropIdArea.clear(); + mClientsByPropIdAreaId.clear(); mSubscribedPropsByClient.clear(); } @@ -62,45 +74,83 @@ Result SubscriptionManager::getIntervalNanos(float sampleRateHz) { if (sampleRateHz <= 0) { return Error() << "invalid sample rate, must be a positive number"; } - if (sampleRateHz <= (ONE_SECOND_IN_NANO / static_cast(INT64_MAX))) { + if (sampleRateHz <= (ONE_SECOND_IN_NANOS / static_cast(INT64_MAX))) { return Error() << "invalid sample rate: " << sampleRateHz << ", too small"; } - intervalNanos = static_cast(ONE_SECOND_IN_NANO / sampleRateHz); + intervalNanos = static_cast(ONE_SECOND_IN_NANOS / sampleRateHz); return intervalNanos; } -void ContSubConfigs::refreshMaxSampleRateHz() { +void ContSubConfigs::refreshCombinedConfig() { float maxSampleRateHz = 0.; + bool enableVur = true; // This is not called frequently so a brute-focre is okay. More efficient way exists but this // is simpler. - for (const auto& [_, sampleRateHz] : mSampleRateHzByClient) { - if (sampleRateHz > maxSampleRateHz) { - maxSampleRateHz = sampleRateHz; + for (const auto& [_, subConfig] : mConfigByClient) { + if (subConfig.sampleRateHz > maxSampleRateHz) { + maxSampleRateHz = subConfig.sampleRateHz; + } + if (!subConfig.enableVur) { + // If one client does not enable variable update rate, we cannot enable variable update + // rate in IVehicleHardware. + enableVur = false; } } mMaxSampleRateHz = maxSampleRateHz; + mEnableVur = enableVur; } -void ContSubConfigs::addClient(const ClientIdType& clientId, float sampleRateHz) { - mSampleRateHzByClient[clientId] = sampleRateHz; - refreshMaxSampleRateHz(); +void ContSubConfigs::addClient(const ClientIdType& clientId, float sampleRateHz, bool enableVur) { + mConfigByClient[clientId] = { + .sampleRateHz = sampleRateHz, + .enableVur = enableVur, + }; + refreshCombinedConfig(); } void ContSubConfigs::removeClient(const ClientIdType& clientId) { - mSampleRateHzByClient.erase(clientId); - refreshMaxSampleRateHz(); + mConfigByClient.erase(clientId); + refreshCombinedConfig(); } float ContSubConfigs::getMaxSampleRateHz() const { return mMaxSampleRateHz; } +bool ContSubConfigs::isVurEnabled() const { + return mEnableVur; +} + +bool ContSubConfigs::isVurEnabledForClient(const ClientIdType& clientId) { + return mConfigByClient[clientId].enableVur; +} + +VhalResult SubscriptionManager::addOnChangeSubscriberLocked( + const PropIdAreaId& propIdAreaId) { + if (mClientsByPropIdAreaId.find(propIdAreaId) != mClientsByPropIdAreaId.end()) { + // This propId, areaId is already subscribed, ignore the request. + return {}; + } + + int32_t propId = propIdAreaId.propId; + int32_t areaId = propIdAreaId.areaId; + if (auto status = mVehicleHardware->subscribe( + newSubscribeOptions(propId, areaId, /*updateRateHz=*/0, /*enableVur*/ false)); + status != StatusCode::OK) { + return StatusError(status) + << StringPrintf("failed subscribe for prop: %s, areaId: %" PRId32, + propIdToString(propId).c_str(), areaId); + } + return {}; +} + VhalResult SubscriptionManager::addContinuousSubscriberLocked( - const ClientIdType& clientId, const PropIdAreaId& propIdAreaId, float sampleRateHz) { + const ClientIdType& clientId, const PropIdAreaId& propIdAreaId, float sampleRateHz, + bool enableVur) { // Make a copy so that we don't modify 'mContSubConfigsByPropIdArea' on failure cases. ContSubConfigs newConfig = mContSubConfigsByPropIdArea[propIdAreaId]; - newConfig.addClient(clientId, sampleRateHz); - return updateContSubConfigs(propIdAreaId, newConfig); + newConfig.addClient(clientId, sampleRateHz, enableVur); + return updateContSubConfigsLocked(propIdAreaId, newConfig); } VhalResult SubscriptionManager::removeContinuousSubscriberLocked( @@ -108,25 +158,62 @@ VhalResult SubscriptionManager::removeContinuousSubscriberLocked( // Make a copy so that we don't modify 'mContSubConfigsByPropIdArea' on failure cases. ContSubConfigs newConfig = mContSubConfigsByPropIdArea[propIdAreaId]; newConfig.removeClient(clientId); - return updateContSubConfigs(propIdAreaId, newConfig); + return updateContSubConfigsLocked(propIdAreaId, newConfig); } -VhalResult SubscriptionManager::updateContSubConfigs(const PropIdAreaId& propIdAreaId, - const ContSubConfigs& newConfig) { - if (newConfig.getMaxSampleRateHz() == - mContSubConfigsByPropIdArea[propIdAreaId].getMaxSampleRateHz()) { - mContSubConfigsByPropIdArea[propIdAreaId] = newConfig; +VhalResult SubscriptionManager::removeOnChangeSubscriberLocked( + const PropIdAreaId& propIdAreaId) { + if (mClientsByPropIdAreaId[propIdAreaId].size() > 1) { + // After unsubscribing this client, there is still client subscribed, so do nothing. return {}; } + + int32_t propId = propIdAreaId.propId; + int32_t areaId = propIdAreaId.areaId; + if (auto status = mVehicleHardware->unsubscribe(propId, areaId); status != StatusCode::OK) { + return StatusError(status) + << StringPrintf("failed unsubscribe for prop: %s, areaId: %" PRId32, + propIdToString(propId).c_str(), areaId); + } + return {}; +} + +VhalResult SubscriptionManager::updateContSubConfigsLocked(const PropIdAreaId& propIdAreaId, + const ContSubConfigs& newConfig) { + const auto& oldConfig = mContSubConfigsByPropIdArea[propIdAreaId]; float newRateHz = newConfig.getMaxSampleRateHz(); + float oldRateHz = oldConfig.getMaxSampleRateHz(); + if (newRateHz == oldRateHz && newConfig.isVurEnabled() == oldConfig.isVurEnabled()) { + mContSubConfigsByPropIdArea[propIdAreaId] = newConfig; + return {}; + } int32_t propId = propIdAreaId.propId; int32_t areaId = propIdAreaId.areaId; - if (auto status = mVehicleHardware->updateSampleRate(propId, areaId, newRateHz); - status != StatusCode::OK) { - return StatusError(status) << StringPrintf("failed to update sample rate for prop: %" PRId32 - ", area" - ": %" PRId32 ", sample rate: %f HZ", - propId, areaId, newRateHz); + if (newRateHz != oldRateHz) { + if (auto status = mVehicleHardware->updateSampleRate(propId, areaId, newRateHz); + status != StatusCode::OK) { + return StatusError(status) + << StringPrintf("failed to update sample rate for prop: %s, areaId: %" PRId32 + ", sample rate: %f HZ", + propIdToString(propId).c_str(), areaId, newRateHz); + } + } + if (newRateHz != 0) { + if (auto status = mVehicleHardware->subscribe( + newSubscribeOptions(propId, areaId, newRateHz, newConfig.isVurEnabled())); + status != StatusCode::OK) { + return StatusError(status) << StringPrintf( + "failed subscribe for prop: %s, areaId" + ": %" PRId32 ", sample rate: %f HZ", + propIdToString(propId).c_str(), areaId, newRateHz); + } + } else { + if (auto status = mVehicleHardware->unsubscribe(propId, areaId); status != StatusCode::OK) { + return StatusError(status) << StringPrintf( + "failed unsubscribe for prop: %s, areaId" + ": %" PRId32, + propIdToString(propId).c_str(), areaId); + } } mContSubConfigsByPropIdArea[propIdAreaId] = newConfig; return {}; @@ -163,17 +250,50 @@ VhalResult SubscriptionManager::subscribe(const std::shared_ptr result; if (isContinuousProperty) { - if (auto result = addContinuousSubscriberLocked(clientId, propIdAreaId, - option.sampleRate); - !result.ok()) { - return result; - } + result = addContinuousSubscriberLocked(clientId, propIdAreaId, option.sampleRate, + option.enableVariableUpdateRate); + } else { + result = addOnChangeSubscriberLocked(propIdAreaId); + } + + if (!result.ok()) { + return result; } mSubscribedPropsByClient[clientId].insert(propIdAreaId); - mClientsByPropIdArea[propIdAreaId][clientId] = callback; + mClientsByPropIdAreaId[propIdAreaId][clientId] = callback; + } + } + return {}; +} + +VhalResult SubscriptionManager::unsubscribePropIdAreaIdLocked( + SubscriptionManager::ClientIdType clientId, const PropIdAreaId& propIdAreaId) { + if (mContSubConfigsByPropIdArea.find(propIdAreaId) != mContSubConfigsByPropIdArea.end()) { + // This is a subscribed continuous property. + if (auto result = removeContinuousSubscriberLocked(clientId, propIdAreaId); !result.ok()) { + return result; } + } else { + if (mClientsByPropIdAreaId.find(propIdAreaId) == mClientsByPropIdAreaId.end()) { + ALOGW("Unsubscribe: The property: %s, areaId: %" PRId32 + " was not previously subscribed, do nothing", + propIdToString(propIdAreaId.propId).c_str(), propIdAreaId.areaId); + return {}; + } + // This is an on-change property. + if (auto result = removeOnChangeSubscriberLocked(propIdAreaId); !result.ok()) { + return result; + } + } + + auto& clients = mClientsByPropIdAreaId[propIdAreaId]; + clients.erase(clientId); + if (clients.empty()) { + mClientsByPropIdAreaId.erase(propIdAreaId); + mContSubConfigsByPropIdArea.erase(propIdAreaId); } return {}; } @@ -186,39 +306,27 @@ VhalResult SubscriptionManager::unsubscribe(SubscriptionManager::ClientIdT return StatusError(StatusCode::INVALID_ARG) << "No property was subscribed for the callback"; } - std::unordered_set subscribedPropIds; - for (auto const& propIdAreaId : mSubscribedPropsByClient[clientId]) { - subscribedPropIds.insert(propIdAreaId.propId); - } + std::vector propIdAreaIdsToUnsubscribe; + std::unordered_set propIdSet; for (int32_t propId : propIds) { - if (subscribedPropIds.find(propId) == subscribedPropIds.end()) { - return StatusError(StatusCode::INVALID_ARG) - << "property ID: " << propId << " is not subscribed"; + propIdSet.insert(propId); + } + auto& subscribedPropIdsAreaIds = mSubscribedPropsByClient[clientId]; + for (const auto& propIdAreaId : subscribedPropIdsAreaIds) { + if (propIdSet.find(propIdAreaId.propId) != propIdSet.end()) { + propIdAreaIdsToUnsubscribe.push_back(propIdAreaId); } } - auto& propIdAreaIds = mSubscribedPropsByClient[clientId]; - auto it = propIdAreaIds.begin(); - while (it != propIdAreaIds.end()) { - int32_t propId = it->propId; - if (std::find(propIds.begin(), propIds.end(), propId) != propIds.end()) { - if (auto result = removeContinuousSubscriberLocked(clientId, *it); !result.ok()) { - return result; - } - - auto& clients = mClientsByPropIdArea[*it]; - clients.erase(clientId); - if (clients.empty()) { - mClientsByPropIdArea.erase(*it); - mContSubConfigsByPropIdArea.erase(*it); - } - it = propIdAreaIds.erase(it); - } else { - it++; + for (const auto& propIdAreaId : propIdAreaIdsToUnsubscribe) { + if (auto result = unsubscribePropIdAreaIdLocked(clientId, propIdAreaId); !result.ok()) { + return result; } + subscribedPropIdsAreaIds.erase(propIdAreaId); } - if (propIdAreaIds.empty()) { + + if (subscribedPropIdsAreaIds.empty()) { mSubscribedPropsByClient.erase(clientId); } return {}; @@ -233,38 +341,68 @@ VhalResult SubscriptionManager::unsubscribe(SubscriptionManager::ClientIdT auto& subscriptions = mSubscribedPropsByClient[clientId]; for (auto const& propIdAreaId : subscriptions) { - if (auto result = removeContinuousSubscriberLocked(clientId, propIdAreaId); !result.ok()) { + if (auto result = unsubscribePropIdAreaIdLocked(clientId, propIdAreaId); !result.ok()) { return result; } - - auto& clients = mClientsByPropIdArea[propIdAreaId]; - clients.erase(clientId); - if (clients.empty()) { - mClientsByPropIdArea.erase(propIdAreaId); - mContSubConfigsByPropIdArea.erase(propIdAreaId); - } } mSubscribedPropsByClient.erase(clientId); return {}; } -std::unordered_map, std::vector> -SubscriptionManager::getSubscribedClients(const std::vector& updatedValues) { +bool SubscriptionManager::isValueUpdatedLocked(const std::shared_ptr& callback, + const VehiclePropValue& value) { + const auto& it = mContSubValuesByCallback[callback].find(value); + if (it == mContSubValuesByCallback[callback].end()) { + mContSubValuesByCallback[callback].insert(value); + return true; + } + + if (it->timestamp > value.timestamp) { + ALOGE("The updated property value: %s is outdated, ignored", value.toString().c_str()); + return false; + } + + if (it->value == value.value && it->status == value.status) { + // Even though the property value is the same, we need to store the new property event to + // update the timestamp. + mContSubValuesByCallback[callback].insert(value); + ALOGD("The updated property value for propId: %" PRId32 ", areaId: %" PRId32 + " has the " + "same value and status, ignored if VUR is enabled", + it->prop, it->areaId); + return false; + } + + mContSubValuesByCallback[callback].insert(value); + return true; +} + +std::unordered_map, std::vector> +SubscriptionManager::getSubscribedClients(std::vector&& updatedValues) { std::scoped_lock lockGuard(mLock); - std::unordered_map, std::vector> - clients; + std::unordered_map, std::vector> clients; - for (const auto& value : updatedValues) { + for (auto& value : updatedValues) { PropIdAreaId propIdAreaId{ .propId = value.prop, .areaId = value.areaId, }; - if (mClientsByPropIdArea.find(propIdAreaId) == mClientsByPropIdArea.end()) { + if (mClientsByPropIdAreaId.find(propIdAreaId) == mClientsByPropIdAreaId.end()) { continue; } - for (const auto& [_, client] : mClientsByPropIdArea[propIdAreaId]) { - clients[client].push_back(&value); + for (const auto& [client, callback] : mClientsByPropIdAreaId[propIdAreaId]) { + auto& subConfigs = mContSubConfigsByPropIdArea[propIdAreaId]; + // If client wants VUR (and VUR is supported as checked in DefaultVehicleHal), it is + // possible that VUR is not enabled in IVehicleHardware because another client does not + // enable VUR. We will implement VUR filtering here for the client that enables it. + if (subConfigs.isVurEnabledForClient(client) && !subConfigs.isVurEnabled()) { + if (isValueUpdatedLocked(callback, value)) { + clients[callback].push_back(value); + } + } else { + clients[callback].push_back(value); + } } } return clients; @@ -281,11 +419,11 @@ SubscriptionManager::getSubscribedClientsForErrorEvents( .propId = errorEvent.propId, .areaId = errorEvent.areaId, }; - if (mClientsByPropIdArea.find(propIdAreaId) == mClientsByPropIdArea.end()) { + if (mClientsByPropIdAreaId.find(propIdAreaId) == mClientsByPropIdAreaId.end()) { continue; } - for (const auto& [_, client] : mClientsByPropIdArea[propIdAreaId]) { + for (const auto& [_, client] : mClientsByPropIdAreaId[propIdAreaId]) { clients[client].push_back({ .propId = errorEvent.propId, .areaId = errorEvent.areaId, @@ -298,7 +436,12 @@ SubscriptionManager::getSubscribedClientsForErrorEvents( bool SubscriptionManager::isEmpty() { std::scoped_lock lockGuard(mLock); - return mSubscribedPropsByClient.empty() && mClientsByPropIdArea.empty(); + return mSubscribedPropsByClient.empty() && mClientsByPropIdAreaId.empty(); +} + +size_t SubscriptionManager::countClients() { + std::scoped_lock lockGuard(mLock); + return mSubscribedPropsByClient.size(); } } // namespace vehicle diff --git a/automotive/vehicle/aidl/impl/vhal/test/DefaultVehicleHalTest.cpp b/automotive/vehicle/aidl/impl/vhal/test/DefaultVehicleHalTest.cpp index 96b71f0af04c0916c48d75ec8f8e05584bad2738..a63cb846eb71d53985cd332937cac6c1399be498 100644 --- a/automotive/vehicle/aidl/impl/vhal/test/DefaultVehicleHalTest.cpp +++ b/automotive/vehicle/aidl/impl/vhal/test/DefaultVehicleHalTest.cpp @@ -59,6 +59,7 @@ using ::aidl::android::hardware::automotive::vehicle::SetValueResult; using ::aidl::android::hardware::automotive::vehicle::SetValueResults; using ::aidl::android::hardware::automotive::vehicle::StatusCode; using ::aidl::android::hardware::automotive::vehicle::SubscribeOptions; +using ::aidl::android::hardware::automotive::vehicle::VehicleAreaConfig; using ::aidl::android::hardware::automotive::vehicle::VehicleAreaWindow; using ::aidl::android::hardware::automotive::vehicle::VehiclePropConfig; using ::aidl::android::hardware::automotive::vehicle::VehiclePropConfigs; @@ -98,12 +99,26 @@ constexpr int32_t AREA_CONTINUOUS_PROP = 10005 + 0x10000000 + 0x03000000 + 0x004 constexpr int32_t READ_ONLY_PROP = 10006 + 0x10000000 + 0x01000000 + 0x00400000; // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:INT32 constexpr int32_t WRITE_ONLY_PROP = 10007 + 0x10000000 + 0x01000000 + 0x00400000; +// VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:INT32 +constexpr int32_t GLOBAL_CONTINUOUS_PROP_NO_VUR = 10008 + 0x10000000 + 0x01000000 + 0x00400000; +// VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:INT32 +constexpr int32_t GLOBAL_NONE_ACCESS_PROP = 10009 + 0x10000000 + 0x01000000 + 0x00400000; +// VehiclePropertyGroup:SYSTEM,VehicleArea:WINDOW,VehiclePropertyType:INT32 +constexpr int32_t AREA_NONE_ACCESS_PROP = 10010 + 0x10000000 + 0x03000000 + 0x00400000; int32_t testInt32VecProp(size_t i) { // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:INT32_VEC return static_cast(i) + 0x10000000 + 0x01000000 + 0x00410000; } +std::string toString(const std::vector& options) { + std::string optionsStr; + for (const auto& option : options) { + optionsStr += option.toString() + "\n"; + } + return optionsStr; +} + struct PropConfigCmp { bool operator()(const VehiclePropConfig& a, const VehiclePropConfig& b) const { return (a.prop < b.prop); @@ -165,6 +180,26 @@ std::vector getSetValuesInvalidRequestTestCases .value.int32Values = {0}, }, .expectedStatus = StatusCode::ACCESS_DENIED, + }, + { + .name = "none_access", + .request = + { + .prop = GLOBAL_NONE_ACCESS_PROP, + .value.int32Values = {0}, + }, + .expectedStatus = StatusCode::ACCESS_DENIED, + }, + { + .name = "none_area_access", + .request = + { + .prop = AREA_NONE_ACCESS_PROP, + .value.int32Values = {0}, + // Only ROW_1_LEFT is allowed. + .areaId = toInt(VehicleAreaWindow::ROW_1_RIGHT), + }, + .expectedStatus = StatusCode::ACCESS_DENIED, }}; } @@ -211,17 +246,18 @@ std::vector getSubscribeInvalidOptionsTestCases class DefaultVehicleHalTest : public testing::Test { public: - void SetUp() override { - auto hardware = std::make_unique(); + void SetUp() override { init(std::make_unique()); } + + void init(std::unique_ptr hardware) { std::vector testConfigs; for (size_t i = 0; i < 10000; i++) { testConfigs.push_back(VehiclePropConfig{ .prop = testInt32VecProp(i), - .access = VehiclePropertyAccess::READ_WRITE, .areaConfigs = { { .areaId = 0, + .access = VehiclePropertyAccess::READ_WRITE, .minInt32Value = 0, .maxInt32Value = 100, }, @@ -231,9 +267,9 @@ class DefaultVehicleHalTest : public testing::Test { // A property with area config. testConfigs.push_back( VehiclePropConfig{.prop = INT32_WINDOW_PROP, - .access = VehiclePropertyAccess::READ_WRITE, .areaConfigs = {{ .areaId = toInt(VehicleAreaWindow::ROW_1_LEFT), + .access = VehiclePropertyAccess::READ_WRITE, .minInt32Value = 0, .maxInt32Value = 100, }}}); @@ -244,8 +280,18 @@ class DefaultVehicleHalTest : public testing::Test { .changeMode = VehiclePropertyChangeMode::ON_CHANGE, }); // A global continuous property. + testConfigs.push_back(VehiclePropConfig{.prop = GLOBAL_CONTINUOUS_PROP, + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::CONTINUOUS, + .minSampleRate = 0.0, + .maxSampleRate = 100.0, + .areaConfigs = {{ + .areaId = 0, + .supportVariableUpdateRate = true, + }}}); + // A global continuous property that does not support VUR. testConfigs.push_back(VehiclePropConfig{ - .prop = GLOBAL_CONTINUOUS_PROP, + .prop = GLOBAL_CONTINUOUS_PROP_NO_VUR, .access = VehiclePropertyAccess::READ_WRITE, .changeMode = VehiclePropertyChangeMode::CONTINUOUS, .minSampleRate = 0.0, @@ -254,18 +300,19 @@ class DefaultVehicleHalTest : public testing::Test { // A per-area on-change property. testConfigs.push_back(VehiclePropConfig{ .prop = AREA_ON_CHANGE_PROP, - .access = VehiclePropertyAccess::READ_WRITE, .changeMode = VehiclePropertyChangeMode::ON_CHANGE, .areaConfigs = { { .areaId = toInt(VehicleAreaWindow::ROW_1_LEFT), + .access = VehiclePropertyAccess::READ_WRITE, .minInt32Value = 0, .maxInt32Value = 100, }, { .areaId = toInt(VehicleAreaWindow::ROW_1_RIGHT), + .access = VehiclePropertyAccess::READ, .minInt32Value = 0, .maxInt32Value = 100, }, @@ -274,7 +321,6 @@ class DefaultVehicleHalTest : public testing::Test { // A per-area continuous property. testConfigs.push_back(VehiclePropConfig{ .prop = AREA_CONTINUOUS_PROP, - .access = VehiclePropertyAccess::READ_WRITE, .changeMode = VehiclePropertyChangeMode::CONTINUOUS, .minSampleRate = 0.0, .maxSampleRate = 1000.0, @@ -283,13 +329,17 @@ class DefaultVehicleHalTest : public testing::Test { { .areaId = toInt(VehicleAreaWindow::ROW_1_LEFT), + .access = VehiclePropertyAccess::READ_WRITE, .minInt32Value = 0, .maxInt32Value = 100, + .supportVariableUpdateRate = true, }, { .areaId = toInt(VehicleAreaWindow::ROW_1_RIGHT), + .access = VehiclePropertyAccess::READ_WRITE, .minInt32Value = 0, .maxInt32Value = 100, + .supportVariableUpdateRate = false, }, }, }); @@ -309,6 +359,37 @@ class DefaultVehicleHalTest : public testing::Test { .minSampleRate = 0.0, .maxSampleRate = 1000.0, }); + // Global access set to NONE + testConfigs.push_back(VehiclePropConfig{ + .prop = GLOBAL_NONE_ACCESS_PROP, + .access = VehiclePropertyAccess::NONE, + .changeMode = VehiclePropertyChangeMode::CONTINUOUS, + .minSampleRate = 0.0, + .maxSampleRate = 100.0, + }); + // Area access set to NONE + testConfigs.push_back(VehiclePropConfig{ + .prop = AREA_NONE_ACCESS_PROP, + .changeMode = VehiclePropertyChangeMode::CONTINUOUS, + .minSampleRate = 0.0, + .maxSampleRate = 1000.0, + .areaConfigs = + { + { + + .areaId = toInt(VehicleAreaWindow::ROW_1_LEFT), + .access = VehiclePropertyAccess::NONE, + .minInt32Value = 0, + .maxInt32Value = 100, + }, + { + .areaId = toInt(VehicleAreaWindow::ROW_1_RIGHT), + .access = VehiclePropertyAccess::NONE, + .minInt32Value = 0, + .maxInt32Value = 100, + }, + }, + }); // Register the heartbeat event property. testConfigs.push_back(VehiclePropConfig{ .prop = toInt(VehicleProperty::VHAL_HEARTBEAT), @@ -350,7 +431,7 @@ class DefaultVehicleHalTest : public testing::Test { size_t countClients() { std::scoped_lock lockGuard(mVhal->mLock); return mVhal->mGetValuesClients.size() + mVhal->mSetValuesClients.size() + - mVhal->mSubscriptionClients->countClients(); + mVhal->countSubscribeClients(); } std::shared_ptr getPool() { return mVhal->mPendingRequestPool; } @@ -650,6 +731,21 @@ TEST_F(DefaultVehicleHalTest, testGetValuesNoReadPermission) { .prop = WRITE_ONLY_PROP, }, }, + { + .requestId = 1, + .prop = + { + .prop = GLOBAL_NONE_ACCESS_PROP, + }, + }, + { + .requestId = 2, + .prop = + { + .prop = AREA_NONE_ACCESS_PROP, + .areaId = toInt(VehicleAreaWindow::ROW_1_LEFT), + }, + }, }, }; @@ -667,6 +763,14 @@ TEST_F(DefaultVehicleHalTest, testGetValuesNoReadPermission) { .requestId = 0, .status = StatusCode::ACCESS_DENIED, }, + { + .requestId = 1, + .status = StatusCode::ACCESS_DENIED, + }, + { + .requestId = 2, + .status = StatusCode::ACCESS_DENIED, + }, })) << "expect to get ACCESS_DENIED status if no read permission"; } @@ -1293,8 +1397,8 @@ TEST_F(DefaultVehicleHalTest, testSubscribeAreaOnChangeAllAreas) { auto maybeResults = getCallback()->nextOnPropertyEventResults(); ASSERT_TRUE(maybeResults.has_value()) << "no results in callback"; - ASSERT_THAT(maybeResults.value().payloads, UnorderedElementsAre(testValue1, testValue2)) - << "results mismatch, expect two on-change events for all updated areas"; + ASSERT_THAT(maybeResults.value().payloads, UnorderedElementsAre(testValue1)) + << "results mismatch, expect one on-change events for all updated areas"; ASSERT_FALSE(getCallback()->nextOnPropertyEventResults().has_value()) << "more results than expected"; } @@ -1351,6 +1455,62 @@ TEST_F(DefaultVehicleHalTest, testSubscribeGlobalContinuousRateOutOfRange) { EXPECT_EQ(countClients(), static_cast(1)); } +TEST_F(DefaultVehicleHalTest, testSubscribeContinuous_propNotSupportVur) { + std::vector options = { + { + .propId = GLOBAL_CONTINUOUS_PROP, + .sampleRate = 20.0, + .enableVariableUpdateRate = true, + }, + { + .propId = GLOBAL_CONTINUOUS_PROP_NO_VUR, + .sampleRate = 30.0, + .enableVariableUpdateRate = true, + }, + }; + + auto status = getClient()->subscribe(getCallbackClient(), options, 0); + + ASSERT_TRUE(status.isOk()) << "subscribe failed: " << status.getMessage(); + auto receivedSubscribeOptions = getHardware()->getSubscribeOptions(); + ASSERT_THAT(receivedSubscribeOptions, UnorderedElementsAre( + SubscribeOptions{ + .propId = GLOBAL_CONTINUOUS_PROP, + .areaIds = {0}, + .enableVariableUpdateRate = true, + .sampleRate = 20.0, + }, + SubscribeOptions{ + .propId = GLOBAL_CONTINUOUS_PROP_NO_VUR, + .areaIds = {0}, + .enableVariableUpdateRate = false, + .sampleRate = 30.0, + })) + << "received unexpected subscribe options: " << toString(receivedSubscribeOptions); +} + +TEST_F(DefaultVehicleHalTest, testSubscribeContinuous_propSupportVurNotEnabled) { + std::vector options = { + { + .propId = GLOBAL_CONTINUOUS_PROP, + .sampleRate = 20.0, + .enableVariableUpdateRate = false, + }, + }; + + auto status = getClient()->subscribe(getCallbackClient(), options, 0); + + ASSERT_TRUE(status.isOk()) << "subscribe failed: " << status.getMessage(); + auto receivedSubscribeOptions = getHardware()->getSubscribeOptions(); + ASSERT_THAT(receivedSubscribeOptions, UnorderedElementsAre(SubscribeOptions{ + .propId = GLOBAL_CONTINUOUS_PROP, + .areaIds = {0}, + .enableVariableUpdateRate = false, + .sampleRate = 20.0, + })) + << "received unexpected subscribe options: " << toString(receivedSubscribeOptions); +} + TEST_F(DefaultVehicleHalTest, testSubscribeAreaContinuous) { std::vector options = { { @@ -1403,6 +1563,44 @@ TEST_F(DefaultVehicleHalTest, testSubscribeAreaContinuous) { ASSERT_GE(rightCount, static_cast(5)); } +TEST_F(DefaultVehicleHalTest, testAreaContinuous_areaNotSupportVur) { + std::vector options = { + { + .propId = AREA_CONTINUOUS_PROP, + .sampleRate = 20.0, + .areaIds = {toInt(VehicleAreaWindow::ROW_1_LEFT)}, + .enableVariableUpdateRate = true, + }, + { + .propId = AREA_CONTINUOUS_PROP, + .sampleRate = 10.0, + .areaIds = {toInt(VehicleAreaWindow::ROW_1_RIGHT)}, + .enableVariableUpdateRate = true, + }, + }; + + auto status = getClient()->subscribe(getCallbackClient(), options, 0); + + ASSERT_TRUE(status.isOk()) << "subscribe failed: " << status.getMessage(); + auto receivedSubscribeOptions = getHardware()->getSubscribeOptions(); + ASSERT_THAT(receivedSubscribeOptions, + UnorderedElementsAre( + SubscribeOptions{ + .propId = AREA_CONTINUOUS_PROP, + .sampleRate = 20.0, + .areaIds = {toInt(VehicleAreaWindow::ROW_1_LEFT)}, + .enableVariableUpdateRate = true, + }, + SubscribeOptions{ + .propId = AREA_CONTINUOUS_PROP, + .sampleRate = 10.0, + .areaIds = {toInt(VehicleAreaWindow::ROW_1_RIGHT)}, + // Area2 actually does not support VUR. + .enableVariableUpdateRate = false, + })) + << "received unexpected subscribe options: " << toString(receivedSubscribeOptions); +} + TEST_F(DefaultVehicleHalTest, testUnsubscribeOnChange) { std::vector options = { { @@ -1510,6 +1708,27 @@ TEST_F(DefaultVehicleHalTest, testSubscribeNoReadPermission) { ASSERT_EQ(status.getServiceSpecificError(), toInt(StatusCode::ACCESS_DENIED)); } +TEST_F(DefaultVehicleHalTest, testSubscribeGlobalNoneAccess) { + std::vector options = {{ + .propId = GLOBAL_NONE_ACCESS_PROP, + }}; + + auto status = getClient()->subscribe(getCallbackClient(), options, 0); + + ASSERT_FALSE(status.isOk()) << "subscribe to a property with NONE global access must fail"; + ASSERT_EQ(status.getServiceSpecificError(), toInt(StatusCode::ACCESS_DENIED)); +} + +TEST_F(DefaultVehicleHalTest, testSubscribeAreaNoneAccess) { + std::vector options = { + {.propId = AREA_NONE_ACCESS_PROP, .areaIds = {toInt(VehicleAreaWindow::ROW_1_LEFT)}}}; + + auto status = getClient()->subscribe(getCallbackClient(), options, 0); + + ASSERT_FALSE(status.isOk()) << "subscribe to a property with NONE area access must fail"; + ASSERT_EQ(status.getServiceSpecificError(), toInt(StatusCode::ACCESS_DENIED)); +} + TEST_F(DefaultVehicleHalTest, testUnsubscribeFailure) { auto status = getClient()->unsubscribe(getCallbackClient(), std::vector({GLOBAL_ON_CHANGE_PROP})); @@ -1711,6 +1930,92 @@ TEST_F(DefaultVehicleHalTest, testOnPropertySetErrorEvent) { ASSERT_THAT(vehiclePropErrors.payloads, UnorderedElementsAreArray(expectedResults)); } +TEST_F(DefaultVehicleHalTest, testBatchOnPropertyChangeEvents) { + auto hardware = std::make_unique(); + hardware->setPropertyOnChangeEventBatchingWindow(std::chrono::milliseconds(10)); + init(std::move(hardware)); + + std::vector options = { + { + .propId = GLOBAL_ON_CHANGE_PROP, + }, + { + .propId = AREA_ON_CHANGE_PROP, + // No areaIds means subscribing to all area IDs. + .areaIds = {}, + }, + }; + + getClient()->subscribe(getCallbackClient(), options, 0); + VehiclePropValue testValue1 = { + .prop = GLOBAL_ON_CHANGE_PROP, + .value.int32Values = {0}, + }; + SetValueRequest request1 = { + .requestId = 1, + .value = testValue1, + }; + SetValueResult result1 = { + .requestId = 1, + .status = StatusCode::OK, + }; + VehiclePropValue testValue2 = { + .prop = AREA_ON_CHANGE_PROP, + .areaId = toInt(VehicleAreaWindow::ROW_1_LEFT), + .value.int32Values = {1}, + }; + SetValueRequest request2 = { + .requestId = 2, + .value = testValue2, + }; + SetValueResult result2 = { + .requestId = 2, + .status = StatusCode::OK, + }; + VehiclePropValue testValue3 = { + .prop = AREA_ON_CHANGE_PROP, + .areaId = toInt(VehicleAreaWindow::ROW_1_RIGHT), + .value.int32Values = {1}, + }; + SetValueRequest request3 = { + .requestId = 3, + .value = testValue3, + }; + SetValueResult result3 = { + .requestId = 3, + .status = StatusCode::ACCESS_DENIED, + }; + // Prepare the responses + for (int i = 0; i < 2; i++) { + getHardware()->addSetValueResponses({result1}); + getHardware()->addSetValueResponses({result2, result3}); + } + + // Try to cause two batches, each with three on property change events. + // Set GLOBAL_ON_CHANGE_PROP causing one event. + // Set AREA_ON_CHANGE_PROP with two areas causing two events. + for (int i = 0; i < 2; i++) { + auto status = getClient()->setValues(getCallbackClient(), + SetValueRequests{.payloads = {request1}}); + ASSERT_TRUE(status.isOk()) << "setValues failed: " << status.getMessage(); + + status = getClient()->setValues(getCallbackClient(), + SetValueRequests{.payloads = {request2, request3}}); + ASSERT_TRUE(status.isOk()) << "setValues failed: " << status.getMessage(); + + ASSERT_TRUE(getCallback()->waitForOnPropertyEventResults(/*size=*/1, + /*timeoutInNano=*/1'000'000'000)) + << "not received enough property change events before timeout"; + + auto maybeResults = getCallback()->nextOnPropertyEventResults(); + ASSERT_TRUE(maybeResults.has_value()) << "no results in callback"; + ASSERT_THAT(maybeResults.value().payloads, UnorderedElementsAre(testValue1, testValue2)) + << "results mismatch, expect 2 batched on change events"; + ASSERT_FALSE(getCallback()->nextOnPropertyEventResults().has_value()) + << "more results than expected"; + } +} + } // namespace vehicle } // namespace automotive } // namespace hardware diff --git a/automotive/vehicle/aidl/impl/vhal/test/MockVehicleCallback.cpp b/automotive/vehicle/aidl/impl/vhal/test/MockVehicleCallback.cpp index 54fede1f3d77aa22afd20ab65f440b7adbbfa6d0..c27212394daf1fda1154dfd14ea38af205a1fbf7 100644 --- a/automotive/vehicle/aidl/impl/vhal/test/MockVehicleCallback.cpp +++ b/automotive/vehicle/aidl/impl/vhal/test/MockVehicleCallback.cpp @@ -137,6 +137,14 @@ bool MockVehicleCallback::waitForGetValueResults(size_t size, size_t timeoutInNa }); } +bool MockVehicleCallback::waitForOnPropertyEventResults(size_t size, size_t timeoutInNano) { + std::unique_lock lk(mLock); + return mCond.wait_for(lk, std::chrono::nanoseconds(timeoutInNano), [this, size] { + ScopedLockAssertion lockAssertion(mLock); + return mOnPropertyEventResults.size() >= size; + }); +} + } // namespace vehicle } // namespace automotive } // namespace hardware diff --git a/automotive/vehicle/aidl/impl/vhal/test/MockVehicleCallback.h b/automotive/vehicle/aidl/impl/vhal/test/MockVehicleCallback.h index 1545eae08f66347471a242519fbd979027279939..672ff4fae511c66be1efdb2d1cf57371ccca9b46 100644 --- a/automotive/vehicle/aidl/impl/vhal/test/MockVehicleCallback.h +++ b/automotive/vehicle/aidl/impl/vhal/test/MockVehicleCallback.h @@ -69,6 +69,7 @@ class MockVehicleCallback final size_t countOnPropertyEventResults(); bool waitForSetValueResults(size_t size, size_t timeoutInNano); bool waitForGetValueResults(size_t size, size_t timeoutInNano); + bool waitForOnPropertyEventResults(size_t size, size_t timeoutInNano); private: std::mutex mLock; diff --git a/automotive/vehicle/aidl/impl/vhal/test/MockVehicleHardware.cpp b/automotive/vehicle/aidl/impl/vhal/test/MockVehicleHardware.cpp index ba0d33dfdebe4403124abbd2b62fcc8689fd958b..db15c8942ffadcdf23d351bd21b4c95068ea13a0 100644 --- a/automotive/vehicle/aidl/impl/vhal/test/MockVehicleHardware.cpp +++ b/automotive/vehicle/aidl/impl/vhal/test/MockVehicleHardware.cpp @@ -29,6 +29,7 @@ using ::aidl::android::hardware::automotive::vehicle::GetValueResult; using ::aidl::android::hardware::automotive::vehicle::SetValueRequest; using ::aidl::android::hardware::automotive::vehicle::SetValueResult; using ::aidl::android::hardware::automotive::vehicle::StatusCode; +using ::aidl::android::hardware::automotive::vehicle::SubscribeOptions; using ::aidl::android::hardware::automotive::vehicle::VehiclePropConfig; using ::aidl::android::hardware::automotive::vehicle::VehiclePropValue; @@ -88,7 +89,40 @@ StatusCode MockVehicleHardware::checkHealth() { return StatusCode::OK; } -StatusCode MockVehicleHardware::updateSampleRate(int32_t propId, int32_t areaId, float sampleRate) { +StatusCode MockVehicleHardware::subscribe(SubscribeOptions options) { + { + std::scoped_lock lockGuard(mLock); + mSubscribeOptions.push_back(options); + } + for (int32_t areaId : options.areaIds) { + if (auto status = subscribePropIdAreaId(options.propId, areaId, options.sampleRate); + status != StatusCode::OK) { + return status; + } + } + return StatusCode::OK; +} + +std::vector MockVehicleHardware::getSubscribeOptions() { + std::scoped_lock lockGuard(mLock); + return mSubscribeOptions; +} + +void MockVehicleHardware::clearSubscribeOptions() { + std::scoped_lock lockGuard(mLock); + mSubscribeOptions.clear(); +} + +StatusCode MockVehicleHardware::subscribePropIdAreaId(int32_t propId, int32_t areaId, + float sampleRateHz) { + if (sampleRateHz == 0) { + // on-change property. + std::scoped_lock lockGuard(mLock); + mSubOnChangePropIdAreaIds.insert(std::pair(propId, areaId)); + return StatusCode::OK; + } + + // continuous property. std::shared_ptr> action; { @@ -97,9 +131,6 @@ StatusCode MockVehicleHardware::updateSampleRate(int32_t propId, int32_t areaId, // Remove the previous action register for this [propId, areaId]. mRecurrentTimer->unregisterTimerCallback(mRecurrentActions[propId][areaId]); } - if (sampleRate == 0) { - return StatusCode::OK; - } // We are sure 'propertyChangeCallback' would be alive because we would unregister timer // before destroying 'this' which owns mPropertyChangeCallback. @@ -107,8 +138,8 @@ StatusCode MockVehicleHardware::updateSampleRate(int32_t propId, int32_t areaId, action = std::make_shared>([propertyChangeCallback, propId, areaId] { std::vector values = { { - .prop = propId, .areaId = areaId, + .prop = propId, }, }; (*propertyChangeCallback)(values); @@ -119,11 +150,45 @@ StatusCode MockVehicleHardware::updateSampleRate(int32_t propId, int32_t areaId, // In mock implementation, we generate a new property change event for this property at sample // rate. - int64_t interval = static_cast(1'000'000'000. / sampleRate); + int64_t interval = static_cast(1'000'000'000. / sampleRateHz); mRecurrentTimer->registerTimerCallback(interval, action); return StatusCode::OK; } +StatusCode MockVehicleHardware::unsubscribe(int32_t propId, int32_t areaId) { + std::scoped_lock lockGuard(mLock); + // For on-change property. + mSubOnChangePropIdAreaIds.erase(std::make_pair(propId, areaId)); + // for continuous property. + if (mRecurrentActions[propId][areaId] != nullptr) { + // Remove the previous action register for this [propId, areaId]. + mRecurrentTimer->unregisterTimerCallback(mRecurrentActions[propId][areaId]); + mRecurrentActions[propId].erase(areaId); + if (mRecurrentActions[propId].empty()) { + mRecurrentActions.erase(propId); + } + } + return StatusCode::OK; +} + +std::set> MockVehicleHardware::getSubscribedOnChangePropIdAreaIds() { + std::scoped_lock lockGuard(mLock); + std::set> propIdAreaIds; + propIdAreaIds = mSubOnChangePropIdAreaIds; + return propIdAreaIds; +} + +std::set> MockVehicleHardware::getSubscribedContinuousPropIdAreaIds() { + std::scoped_lock lockGuard(mLock); + std::set> propIdAreaIds; + for (const auto& [propId, actionByAreaId] : mRecurrentActions) { + for (const auto& [areaId, _] : actionByAreaId) { + propIdAreaIds.insert(std::make_pair(propId, areaId)); + } + } + return propIdAreaIds; +} + void MockVehicleHardware::registerOnPropertyChangeEvent( std::unique_ptr callback) { std::scoped_lock lockGuard(mLock); @@ -186,6 +251,16 @@ void MockVehicleHardware::setSleepTime(int64_t timeInNano) { mSleepTime = timeInNano; } +void MockVehicleHardware::setPropertyOnChangeEventBatchingWindow(std::chrono::nanoseconds window) { + std::scoped_lock lockGuard(mLock); + mEventBatchingWindow = window; +} + +std::chrono::nanoseconds MockVehicleHardware::getPropertyOnChangeEventBatchingWindow() { + std::scoped_lock lockGuard(mLock); + return mEventBatchingWindow; +} + template StatusCode MockVehicleHardware::returnResponse( std::shared_ptr)>> callback, diff --git a/automotive/vehicle/aidl/impl/vhal/test/MockVehicleHardware.h b/automotive/vehicle/aidl/impl/vhal/test/MockVehicleHardware.h index 46b30b94055db8bca49c61f2b8f59d7cfa60ea51..eeca582fa4adfe50e0b7cc5def156f3bf230870b 100644 --- a/automotive/vehicle/aidl/impl/vhal/test/MockVehicleHardware.h +++ b/automotive/vehicle/aidl/impl/vhal/test/MockVehicleHardware.h @@ -24,10 +24,12 @@ #include #include +#include #include #include #include #include +#include #include #include #include @@ -58,8 +60,11 @@ class MockVehicleHardware final : public IVehicleHardware { void registerOnPropertyChangeEvent( std::unique_ptr callback) override; void registerOnPropertySetErrorEvent(std::unique_ptr) override; - aidl::android::hardware::automotive::vehicle::StatusCode updateSampleRate( - int32_t propId, int32_t areaId, float sampleRate) override; + aidl::android::hardware::automotive::vehicle::StatusCode subscribe( + aidl::android::hardware::automotive::vehicle::SubscribeOptions options) override; + aidl::android::hardware::automotive::vehicle::StatusCode unsubscribe(int32_t propId, + int32_t areaId) override; + std::chrono::nanoseconds getPropertyOnChangeEventBatchingWindow() override; // Test functions. void setPropertyConfigs( @@ -86,6 +91,13 @@ class MockVehicleHardware final : public IVehicleHardware { void setSleepTime(int64_t timeInNano); void setDumpResult(DumpResult result); void sendOnPropertySetErrorEvent(const std::vector& errorEvents); + void setPropertyOnChangeEventBatchingWindow(std::chrono::nanoseconds window); + + std::set> getSubscribedOnChangePropIdAreaIds(); + std::set> getSubscribedContinuousPropIdAreaIds(); + std::vector + getSubscribeOptions(); + void clearSubscribeOptions(); private: mutable std::mutex mLock; @@ -110,6 +122,10 @@ class MockVehicleHardware final : public IVehicleHardware { std::shared_ptr, const std::vector&)> mGetValueResponder GUARDED_BY(mLock); + std::chrono::nanoseconds mEventBatchingWindow GUARDED_BY(mLock) = std::chrono::nanoseconds(0); + std::set> mSubOnChangePropIdAreaIds GUARDED_BY(mLock); + std::vector mSubscribeOptions + GUARDED_BY(mLock); template aidl::android::hardware::automotive::vehicle::StatusCode returnResponse( @@ -122,6 +138,8 @@ class MockVehicleHardware final : public IVehicleHardware { const std::vector& requests, std::list>* storedRequests, std::list>* storedResponses) const REQUIRES(mLock); + aidl::android::hardware::automotive::vehicle::StatusCode subscribePropIdAreaId( + int32_t propId, int32_t areaId, float sampleRateHz); DumpResult mDumpResult; diff --git a/automotive/vehicle/aidl/impl/vhal/test/SubscriptionManagerTest.cpp b/automotive/vehicle/aidl/impl/vhal/test/SubscriptionManagerTest.cpp index cb8c8d1514b8226b68f6826d5561ca7e7fc22d44..aa5f003dec1ad7d3d5a55ac80865134ab294936f 100644 --- a/automotive/vehicle/aidl/impl/vhal/test/SubscriptionManagerTest.cpp +++ b/automotive/vehicle/aidl/impl/vhal/test/SubscriptionManagerTest.cpp @@ -43,12 +43,14 @@ using ::aidl::android::hardware::automotive::vehicle::IVehicleCallback; using ::aidl::android::hardware::automotive::vehicle::SetValueResults; using ::aidl::android::hardware::automotive::vehicle::SubscribeOptions; using ::aidl::android::hardware::automotive::vehicle::VehiclePropErrors; +using ::aidl::android::hardware::automotive::vehicle::VehiclePropertyStatus; using ::aidl::android::hardware::automotive::vehicle::VehiclePropValue; using ::aidl::android::hardware::automotive::vehicle::VehiclePropValues; using ::ndk::ScopedAStatus; using ::ndk::SpAIBinder; +using ::testing::Contains; using ::testing::ElementsAre; -using ::testing::WhenSorted; +using ::testing::UnorderedElementsAre; class PropertyCallback final : public BnVehicleCallback { public: @@ -114,6 +116,8 @@ class SubscriptionManagerTest : public testing::Test { void clearEvents() { return getCallback()->clearEvents(); } + std::shared_ptr getHardware() { return mHardware; } + private: std::unique_ptr mManager; std::shared_ptr mCallback; @@ -132,6 +136,9 @@ TEST_F(SubscriptionManagerTest, testSubscribeGlobalContinuous) { auto result = getManager()->subscribe(getCallbackClient(), options, true); ASSERT_TRUE(result.ok()) << "failed to subscribe: " << result.error().message(); + ASSERT_THAT(getHardware()->getSubscribedContinuousPropIdAreaIds(), + UnorderedElementsAre(std::pair(0, 0))); + std::this_thread::sleep_for(std::chrono::seconds(1)); // Theoretically trigger 10 times, but check for at least 9 times to be stable. @@ -240,6 +247,8 @@ TEST_F(SubscriptionManagerTest, testUnsubscribeGlobalContinuous) { result = getManager()->unsubscribe(getCallbackClient()->asBinder().get()); ASSERT_TRUE(result.ok()) << "failed to unsubscribe: " << result.error().message(); + ASSERT_EQ(getHardware()->getSubscribedContinuousPropIdAreaIds().size(), 0u); + // Wait for the last events to come. std::this_thread::sleep_for(std::chrono::milliseconds(100)); @@ -316,7 +325,7 @@ TEST_F(SubscriptionManagerTest, testUnsubscribeByCallback) { EXPECT_TRUE(getEvents().empty()); } -TEST_F(SubscriptionManagerTest, testUnsubscribeFailure) { +TEST_F(SubscriptionManagerTest, testUnsubscribeUnsubscribedPropId) { std::vector options = { { .propId = 0, @@ -334,14 +343,21 @@ TEST_F(SubscriptionManagerTest, testUnsubscribeFailure) { // Property ID: 2 was not subscribed. result = getManager()->unsubscribe(getCallbackClient()->asBinder().get(), std::vector({0, 1, 2})); - ASSERT_FALSE(result.ok()) << "unsubscribe an unsubscribed property must fail"; + ASSERT_TRUE(result.ok()) << "unsubscribe an unsubscribed property must do nothing"; - // Since property 0 and property 1 was not unsubscribed successfully, we should be able to - // unsubscribe them again. - result = getManager()->unsubscribe(getCallbackClient()->asBinder().get(), - std::vector({0, 1})); - ASSERT_TRUE(result.ok()) << "a failed unsubscription must not unsubscribe any properties" - << result.error().message(); + std::vector updatedValues = { + { + .prop = 0, + .areaId = 0, + }, + { + .prop = 1, + .areaId = 0, + }, + }; + auto clients = getManager()->getSubscribedClients(std::vector(updatedValues)); + + ASSERT_EQ(clients.size(), 0u) << "all subscribed properties must be unsubscribed"; } TEST_F(SubscriptionManagerTest, testSubscribeOnchange) { @@ -370,6 +386,11 @@ TEST_F(SubscriptionManagerTest, testSubscribeOnchange) { ASSERT_TRUE(result.ok()) << "failed to subscribe: " << result.error().message(); result = getManager()->subscribe(client2, options2, false); ASSERT_TRUE(result.ok()) << "failed to subscribe: " << result.error().message(); + ASSERT_THAT(getHardware()->getSubscribedOnChangePropIdAreaIds(), + UnorderedElementsAre(std::pair(0, 0), + std::pair(0, 1), + std::pair(1, 0))); + ASSERT_EQ(getHardware()->getSubscribedContinuousPropIdAreaIds().size(), 0u); std::vector updatedValues = { { @@ -389,11 +410,11 @@ TEST_F(SubscriptionManagerTest, testSubscribeOnchange) { .areaId = 1, }, }; - auto clients = getManager()->getSubscribedClients(updatedValues); + auto clients = getManager()->getSubscribedClients(std::vector(updatedValues)); ASSERT_THAT(clients[client1], - WhenSorted(ElementsAre(&updatedValues[0], &updatedValues[1], &updatedValues[2]))); - ASSERT_THAT(clients[client2], ElementsAre(&updatedValues[0])); + UnorderedElementsAre(updatedValues[0], updatedValues[1], updatedValues[2])); + ASSERT_THAT(clients[client2], ElementsAre(updatedValues[0])); } TEST_F(SubscriptionManagerTest, testSubscribeInvalidOption) { @@ -480,9 +501,11 @@ TEST_F(SubscriptionManagerTest, testUnsubscribeOnchange) { .areaId = 0, }, }; - auto clients = getManager()->getSubscribedClients(updatedValues); + auto clients = getManager()->getSubscribedClients(std::vector(updatedValues)); - ASSERT_THAT(clients[getCallbackClient()], ElementsAre(&updatedValues[1])); + ASSERT_THAT(clients[getCallbackClient()], ElementsAre(updatedValues[1])); + ASSERT_THAT(getHardware()->getSubscribedOnChangePropIdAreaIds(), + UnorderedElementsAre(std::pair(1, 0))); } TEST_F(SubscriptionManagerTest, testCheckSampleRateHzValid) { @@ -497,6 +520,257 @@ TEST_F(SubscriptionManagerTest, testCheckSampleRateHzInvalidZero) { ASSERT_FALSE(SubscriptionManager::checkSampleRateHz(0)); } +TEST_F(SubscriptionManagerTest, testSubscribe_enableVur) { + std::vector options = {{ + .propId = 0, + .areaIds = {0}, + .sampleRate = 10.0, + .enableVariableUpdateRate = true, + }}; + + auto result = getManager()->subscribe(getCallbackClient(), options, true); + ASSERT_TRUE(result.ok()) << "failed to subscribe: " << result.error().message(); + + ASSERT_THAT(getHardware()->getSubscribeOptions(), ElementsAre(options[0])); +} + +TEST_F(SubscriptionManagerTest, testSubscribe_VurStateChange) { + std::vector options = {{ + .propId = 0, + .areaIds = {0}, + .sampleRate = 10.0, + .enableVariableUpdateRate = true, + }}; + + auto result = getManager()->subscribe(getCallbackClient(), options, true); + ASSERT_TRUE(result.ok()) << "failed to subscribe: " << result.error().message(); + + ASSERT_THAT(getHardware()->getSubscribeOptions(), ElementsAre(options[0])); + + getHardware()->clearSubscribeOptions(); + result = getManager()->subscribe(getCallbackClient(), options, true); + ASSERT_TRUE(result.ok()) << "failed to subscribe: " << result.error().message(); + + ASSERT_TRUE(getHardware()->getSubscribeOptions().empty()); + + std::vector newOptions = {{ + .propId = 0, + .areaIds = {0}, + .sampleRate = 10.0, + .enableVariableUpdateRate = false, + }}; + result = getManager()->subscribe(getCallbackClient(), newOptions, true); + ASSERT_TRUE(result.ok()) << "failed to subscribe: " << result.error().message(); + + ASSERT_THAT(getHardware()->getSubscribeOptions(), ElementsAre(newOptions[0])); +} + +TEST_F(SubscriptionManagerTest, testSubscribe_enableVur_filterUnchangedEvents) { + SpAIBinder binder1 = ndk::SharedRefBase::make()->asBinder(); + std::shared_ptr client1 = IVehicleCallback::fromBinder(binder1); + SpAIBinder binder2 = ndk::SharedRefBase::make()->asBinder(); + std::shared_ptr client2 = IVehicleCallback::fromBinder(binder2); + SubscribeOptions client1Option = { + .propId = 0, + .areaIds = {0}, + .sampleRate = 10.0, + .enableVariableUpdateRate = false, + }; + auto result = getManager()->subscribe(client1, {client1Option}, true); + ASSERT_TRUE(result.ok()) << "failed to subscribe: " << result.error().message(); + + ASSERT_THAT(getHardware()->getSubscribeOptions(), UnorderedElementsAre(client1Option)); + + getHardware()->clearSubscribeOptions(); + SubscribeOptions client2Option = { + .propId = 0, + .areaIds = {0, 1}, + .sampleRate = 20.0, + .enableVariableUpdateRate = true, + }; + + result = getManager()->subscribe(client2, {client2Option}, true); + ASSERT_TRUE(result.ok()) << "failed to subscribe: " << result.error().message(); + + ASSERT_THAT(getHardware()->getSubscribeOptions(), + UnorderedElementsAre( + SubscribeOptions{ + .propId = 0, + .areaIds = {0}, + .sampleRate = 20.0, + // This is enabled for client2, but disabled for client1. + .enableVariableUpdateRate = false, + }, + SubscribeOptions{ + .propId = 0, + .areaIds = {1}, + .sampleRate = 20.0, + .enableVariableUpdateRate = true, + })); + + std::vector propertyEvents = {{ + .prop = 0, + .areaId = 0, + .value = {.int32Values = {0}}, + .timestamp = 1, + }, + { + .prop = 0, + .areaId = 1, + .value = {.int32Values = {1}}, + .timestamp = 1, + }}; + auto clients = + getManager()->getSubscribedClients(std::vector(propertyEvents)); + + ASSERT_THAT(clients[client1], UnorderedElementsAre(propertyEvents[0])); + ASSERT_THAT(clients[client2], UnorderedElementsAre(propertyEvents[0], propertyEvents[1])); + + // If the same property events happen again with a new timestamp. + // VUR is disabled for client1, enabled for client2. + clients = getManager()->getSubscribedClients({{ + .prop = 0, + .areaId = 0, + .value = {.int32Values = {0}}, + .timestamp = 2, + }}); + + ASSERT_FALSE(clients.find(client1) == clients.end()) + << "Must not filter out property events if VUR is not enabled"; + ASSERT_TRUE(clients.find(client2) == clients.end()) + << "Must filter out property events if VUR is enabled"; +} + +TEST_F(SubscriptionManagerTest, testSubscribe_enableVur_mustNotFilterStatusChange) { + SpAIBinder binder1 = ndk::SharedRefBase::make()->asBinder(); + std::shared_ptr client1 = IVehicleCallback::fromBinder(binder1); + SpAIBinder binder2 = ndk::SharedRefBase::make()->asBinder(); + std::shared_ptr client2 = IVehicleCallback::fromBinder(binder2); + SubscribeOptions client1Option = { + .propId = 0, + .areaIds = {0}, + .sampleRate = 10.0, + .enableVariableUpdateRate = false, + }; + auto result = getManager()->subscribe(client1, {client1Option}, true); + ASSERT_TRUE(result.ok()) << "failed to subscribe: " << result.error().message(); + + ASSERT_THAT(getHardware()->getSubscribeOptions(), UnorderedElementsAre(client1Option)); + + getHardware()->clearSubscribeOptions(); + SubscribeOptions client2Option = { + .propId = 0, + .areaIds = {0, 1}, + .sampleRate = 20.0, + .enableVariableUpdateRate = true, + }; + + result = getManager()->subscribe(client2, {client2Option}, true); + ASSERT_TRUE(result.ok()) << "failed to subscribe: " << result.error().message(); + + ASSERT_THAT(getHardware()->getSubscribeOptions(), + UnorderedElementsAre( + SubscribeOptions{ + .propId = 0, + .areaIds = {0}, + .sampleRate = 20.0, + // This is enabled for client2, but disabled for client1. + .enableVariableUpdateRate = false, + }, + SubscribeOptions{ + .propId = 0, + .areaIds = {1}, + .sampleRate = 20.0, + .enableVariableUpdateRate = true, + })); + + VehiclePropValue propValue1 = { + .prop = 0, + .areaId = 0, + .value = {.int32Values = {0}}, + .timestamp = 1, + }; + auto clients = getManager()->getSubscribedClients(std::vector({propValue1})); + + ASSERT_THAT(clients[client1], UnorderedElementsAre(propValue1)); + + // A new event with the same value, but different status must not be filtered out. + VehiclePropValue propValue2 = { + .prop = 0, + .areaId = 0, + .value = {.int32Values = {0}}, + .status = VehiclePropertyStatus::UNAVAILABLE, + .timestamp = 2, + }; + clients = getManager()->getSubscribedClients({propValue2}); + + ASSERT_THAT(clients[client1], UnorderedElementsAre(propValue2)) + << "Must not filter out property events that has status change"; +} + +TEST_F(SubscriptionManagerTest, testSubscribe_enableVur_timestampUpdated_filterOutdatedEvent) { + SpAIBinder binder1 = ndk::SharedRefBase::make()->asBinder(); + std::shared_ptr client1 = IVehicleCallback::fromBinder(binder1); + SpAIBinder binder2 = ndk::SharedRefBase::make()->asBinder(); + std::shared_ptr client2 = IVehicleCallback::fromBinder(binder2); + std::vector options = {{ + .propId = 0, + .areaIds = {0}, + .sampleRate = 10.0, + .enableVariableUpdateRate = true, + }}; + + // client1 subscribe with VUR enabled. + auto result = getManager()->subscribe(client1, options, true); + ASSERT_TRUE(result.ok()) << "failed to subscribe: " << result.error().message(); + + // Let client2 subscribe with VUR disabled so that we enabled VUR in DefaultVehicleHal layer. + result = getManager()->subscribe(client2, + {{ + .propId = 0, + .areaIds = {0}, + .sampleRate = 10.0, + .enableVariableUpdateRate = false, + }}, + true); + ASSERT_TRUE(result.ok()) << "failed to subscribe: " << result.error().message(); + + VehiclePropValue value0 = { + .prop = 0, + .areaId = 0, + .value = {.int32Values = {0}}, + .timestamp = 1, + }; + auto clients = getManager()->getSubscribedClients({value0}); + + ASSERT_THAT(clients[client1], UnorderedElementsAre(value0)); + + // A new event with the same value arrived. This must update timestamp to 3. + VehiclePropValue value1 = { + .prop = 0, + .areaId = 0, + .value = {.int32Values = {0}}, + .timestamp = 3, + }; + clients = getManager()->getSubscribedClients({value1}); + + ASSERT_TRUE(clients.find(client1) == clients.end()) + << "Must filter out duplicate property events if VUR is enabled"; + + // The latest timestamp is 3, so even though the value is not the same, this is outdated and + // must be ignored. + VehiclePropValue value2 = { + .prop = 0, + .areaId = 0, + .value = {.int32Values = {1}}, + .timestamp = 2, + }; + clients = getManager()->getSubscribedClients({value1}); + + ASSERT_TRUE(clients.find(client1) == clients.end()) + << "Must filter out outdated property events if VUR is enabled"; +} + } // namespace vehicle } // namespace automotive } // namespace hardware diff --git a/automotive/vehicle/aidl/impl/vhal/vhal-default-service.rc b/automotive/vehicle/aidl/impl/vhal/vhal-default-service.rc index 19267cd383af99e5fb948d3f8f62cd28ef2a472a..9fa7b983022dc08d0e19d6a044f42349505803af 100644 --- a/automotive/vehicle/aidl/impl/vhal/vhal-default-service.rc +++ b/automotive/vehicle/aidl/impl/vhal/vhal-default-service.rc @@ -1,4 +1,4 @@ -service vendor.vehicle-hal-default /vendor/bin/hw/android.hardware.automotive.vehicle@V1-default-service +service vendor.vehicle-hal-default /vendor/bin/hw/android.hardware.automotive.vehicle@V3-default-service class early_hal user vehicle_network group system inet diff --git a/automotive/vehicle/aidl_property/Android.bp b/automotive/vehicle/aidl_property/Android.bp index 580be6829b12e88c16a62c31fd946563c5d03ff4..345a2e601e6cfa911e3299437fe812ed312fad27 100644 --- a/automotive/vehicle/aidl_property/Android.bp +++ b/automotive/vehicle/aidl_property/Android.bp @@ -28,7 +28,7 @@ aidl_interface { // This HAL was originally part of android.hardware.automotive.vehicle "android/hardware/automotive/vehicle/*.aidl", ], - frozen: true, + frozen: false, stability: "vintf", backend: { cpp: { @@ -55,7 +55,6 @@ aidl_interface { version: "2", imports: [], }, - ], } diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/CrossTrafficMonitoringWarningState.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/CrossTrafficMonitoringWarningState.aidl new file mode 100644 index 0000000000000000000000000000000000000000..90e2d8dfb8c64adfc7ba16a685be7d2ba39df636 --- /dev/null +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/CrossTrafficMonitoringWarningState.aidl @@ -0,0 +1,45 @@ +/* + * Copyright (C) 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/////////////////////////////////////////////////////////////////////////////// +// THIS 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 -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.automotive.vehicle; +@Backing(type="int") @VintfStability +enum CrossTrafficMonitoringWarningState { + OTHER = 0, + NO_WARNING = 1, + WARNING_FRONT_LEFT = 2, + WARNING_FRONT_RIGHT = 3, + WARNING_FRONT_BOTH = 4, + WARNING_REAR_LEFT = 5, + WARNING_REAR_RIGHT = 6, + WARNING_REAR_BOTH = 7, +} diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/DriverDistractionState.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/DriverDistractionState.aidl new file mode 100644 index 0000000000000000000000000000000000000000..54c02d53d1b2ef0c30c0a53c0c64ac689277d4fd --- /dev/null +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/DriverDistractionState.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/////////////////////////////////////////////////////////////////////////////// +// THIS 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 -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.automotive.vehicle; +@Backing(type="int") @VintfStability +enum DriverDistractionState { + OTHER = 0, + NOT_DISTRACTED = 1, + DISTRACTED = 2, +} diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/DriverDistractionWarning.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/DriverDistractionWarning.aidl new file mode 100644 index 0000000000000000000000000000000000000000..9236b1c278f225ff51aeea17a8598d79582ae98f --- /dev/null +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/DriverDistractionWarning.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/////////////////////////////////////////////////////////////////////////////// +// THIS 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 -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.automotive.vehicle; +@Backing(type="int") @VintfStability +enum DriverDistractionWarning { + OTHER = 0, + NO_WARNING = 1, + WARNING = 2, +} diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/DriverDrowsinessAttentionState.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/DriverDrowsinessAttentionState.aidl new file mode 100644 index 0000000000000000000000000000000000000000..22a90f36572b599752e252b1f3c077e149bd64a6 --- /dev/null +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/DriverDrowsinessAttentionState.aidl @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/////////////////////////////////////////////////////////////////////////////// +// THIS 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 -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.automotive.vehicle; +@Backing(type="int") @VintfStability +enum DriverDrowsinessAttentionState { + OTHER = 0, + KSS_RATING_1_EXTREMELY_ALERT = 1, + KSS_RATING_2_VERY_ALERT = 2, + KSS_RATING_3_ALERT = 3, + KSS_RATING_4_RATHER_ALERT = 4, + KSS_RATING_5_NEITHER_ALERT_NOR_SLEEPY = 5, + KSS_RATING_6_SOME_SLEEPINESS = 6, + KSS_RATING_7_SLEEPY_NO_EFFORT = 7, + KSS_RATING_8_SLEEPY_SOME_EFFORT = 8, + KSS_RATING_9_VERY_SLEEPY = 9, +} diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/DriverDrowsinessAttentionWarning.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/DriverDrowsinessAttentionWarning.aidl new file mode 100644 index 0000000000000000000000000000000000000000..dbf2364d4b934cb9295eb57343c93fb507a604b7 --- /dev/null +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/DriverDrowsinessAttentionWarning.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/////////////////////////////////////////////////////////////////////////////// +// THIS 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 -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.automotive.vehicle; +@Backing(type="int") @VintfStability +enum DriverDrowsinessAttentionWarning { + OTHER = 0, + NO_WARNING = 1, + WARNING = 2, +} diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/ElectronicStabilityControlState.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/ElectronicStabilityControlState.aidl new file mode 100644 index 0000000000000000000000000000000000000000..b061a25ecf59cf61e9081e18ab2ee67b306bf462 --- /dev/null +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/ElectronicStabilityControlState.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/////////////////////////////////////////////////////////////////////////////// +// THIS 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 -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.automotive.vehicle; +@Backing(type="int") @VintfStability +enum ElectronicStabilityControlState { + OTHER = 0, + ENABLED = 1, + ACTIVATED = 2, +} diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/ImpactSensorLocation.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/ImpactSensorLocation.aidl new file mode 100644 index 0000000000000000000000000000000000000000..6b75d8cd516ca030322aec29537904584ce55e0a --- /dev/null +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/ImpactSensorLocation.aidl @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/////////////////////////////////////////////////////////////////////////////// +// THIS 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 -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.automotive.vehicle; +@Backing(type="int") @VintfStability +enum ImpactSensorLocation { + OTHER = 0x01, + FRONT = 0x02, + FRONT_LEFT_DOOR_SIDE = 0x04, + FRONT_RIGHT_DOOR_SIDE = 0x08, + REAR_LEFT_DOOR_SIDE = 0x10, + REAR_RIGHT_DOOR_SIDE = 0x20, + REAR = 0x40, +} diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/LowSpeedCollisionWarningState.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/LowSpeedCollisionWarningState.aidl new file mode 100644 index 0000000000000000000000000000000000000000..6f6338b2fd276f2ca5280ebe2b6deaccc252622a --- /dev/null +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/LowSpeedCollisionWarningState.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/////////////////////////////////////////////////////////////////////////////// +// THIS 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 -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.automotive.vehicle; +@Backing(type="int") @VintfStability +enum LowSpeedCollisionWarningState { + OTHER = 0, + NO_WARNING = 1, + WARNING = 2, +} diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleAirbagLocation.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleAirbagLocation.aidl new file mode 100644 index 0000000000000000000000000000000000000000..9b966d7f942dfd066aedee7f7b12907ec7556a12 --- /dev/null +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleAirbagLocation.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/////////////////////////////////////////////////////////////////////////////// +// THIS 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 -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.automotive.vehicle; +@Backing(type="int") @VintfStability +enum VehicleAirbagLocation { + OTHER = 0x01, + FRONT = 0x02, + KNEE = 0x04, + LEFT_SIDE = 0x08, + RIGHT_SIDE = 0x10, + CURTAIN = 0x20, +} diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleApPowerStateShutdownParam.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleApPowerStateShutdownParam.aidl index 3fde1c7869bc048ebf2cbc55bf36464e9e9ba794..8b345b2bd11e116d861a6c9a13221706b50744e5 100644 --- a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleApPowerStateShutdownParam.aidl +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleApPowerStateShutdownParam.aidl @@ -40,4 +40,5 @@ enum VehicleApPowerStateShutdownParam { SLEEP_IMMEDIATELY = 4, HIBERNATE_IMMEDIATELY = 5, CAN_HIBERNATE = 6, + EMERGENCY_SHUTDOWN = 7, } diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleArea.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleArea.aidl index db867f4cc148e337045a1e3e41ae16a45c91adb9..b63003a73380fa47ce7ea845c498acf07a6de53e 100644 --- a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleArea.aidl +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleArea.aidl @@ -40,5 +40,6 @@ enum VehicleArea { SEAT = 0x05000000, DOOR = 0x06000000, WHEEL = 0x07000000, + VENDOR = 0x08000000, MASK = 0x0f000000, } diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleAreaSeat.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleAreaSeat.aidl index 44c9d54567d7d03c45971c9436d62fff27bafc2f..a24f51569777bc2b9a33c496d2a33686c173da63 100644 --- a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleAreaSeat.aidl +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleAreaSeat.aidl @@ -34,6 +34,7 @@ package android.hardware.automotive.vehicle; @Backing(type="int") @VintfStability enum VehicleAreaSeat { + UNKNOWN = 0x0000, ROW_1_LEFT = 0x0001, ROW_1_CENTER = 0x0002, ROW_1_RIGHT = 0x0004, diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleAutonomousState.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleAutonomousState.aidl new file mode 100644 index 0000000000000000000000000000000000000000..e15e71ed3e8a6b93eae65146cf89480b1599086a --- /dev/null +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleAutonomousState.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/////////////////////////////////////////////////////////////////////////////// +// THIS 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 -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.automotive.vehicle; +@Backing(type="int") @VintfStability +enum VehicleAutonomousState { + LEVEL_0 = 0, + LEVEL_1 = 1, + LEVEL_2 = 2, + LEVEL_3 = 3, + LEVEL_4 = 4, + LEVEL_5 = 5, +} diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl index ba75e7b261777d0b6d8c7aeb876e35fdc56dad0b..efae92f8abcc05c3968221f7d42827ec6216b11e 100644 --- a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -66,9 +66,11 @@ enum VehicleProperty { EV_CHARGE_PORT_CONNECTED = (((0x030B + 0x10000000) + 0x01000000) + 0x00200000) /* 287310603 */, EV_BATTERY_INSTANTANEOUS_CHARGE_RATE = (((0x030C + 0x10000000) + 0x01000000) + 0x00600000) /* 291504908 */, RANGE_REMAINING = (((0x0308 + 0x10000000) + 0x01000000) + 0x00600000) /* 291504904 */, + EV_BATTERY_AVERAGE_TEMPERATURE = (((0x030E + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.FLOAT) /* 291504910 */, TIRE_PRESSURE = (((0x0309 + 0x10000000) + 0x07000000) + 0x00600000) /* 392168201 */, CRITICALLY_LOW_TIRE_PRESSURE = (((0x030A + 0x10000000) + 0x07000000) + 0x00600000) /* 392168202 */, ENGINE_IDLE_AUTO_STOP_ENABLED = (((0x0320 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN) /* 287310624 */, + IMPACT_DETECTED = (((0x0330 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289407792 */, GEAR_SELECTION = (((0x0400 + 0x10000000) + 0x01000000) + 0x00400000) /* 289408000 */, CURRENT_GEAR = (((0x0401 + 0x10000000) + 0x01000000) + 0x00400000) /* 289408001 */, PARKING_BRAKE_ON = (((0x0402 + 0x10000000) + 0x01000000) + 0x00200000) /* 287310850 */, @@ -81,6 +83,8 @@ enum VehicleProperty { ABS_ACTIVE = (((0x040A + 0x10000000) + 0x01000000) + 0x00200000) /* 287310858 */, TRACTION_CONTROL_ACTIVE = (((0x040B + 0x10000000) + 0x01000000) + 0x00200000) /* 287310859 */, EV_STOPPING_MODE = (((0x040D + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289408013 */, + ELECTRONIC_STABILITY_CONTROL_ENABLED = (((0x040E + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN) /* 287310862 */, + ELECTRONIC_STABILITY_CONTROL_STATE = (((0x040F + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289408015 */, HVAC_FAN_SPEED = (((0x0500 + 0x10000000) + 0x05000000) + 0x00400000) /* 356517120 */, HVAC_FAN_DIRECTION = (((0x0501 + 0x10000000) + 0x05000000) + 0x00400000) /* 356517121 */, HVAC_TEMPERATURE_CURRENT = (((0x0502 + 0x10000000) + 0x05000000) + 0x00600000) /* 358614274 */, @@ -118,6 +122,7 @@ enum VehicleProperty { AP_POWER_BOOTUP_REASON = (((0x0A02 + 0x10000000) + 0x01000000) + 0x00400000) /* 289409538 */, DISPLAY_BRIGHTNESS = (((0x0A03 + 0x10000000) + 0x01000000) + 0x00400000) /* 289409539 */, PER_DISPLAY_BRIGHTNESS = (((0x0A04 + 0x10000000) + 0x01000000) + 0x00410000) /* 289475076 */, + VALET_MODE_ENABLED = (((0x0A05 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN) /* 287312389 */, HW_KEY_INPUT = (((0x0A10 + 0x10000000) + 0x01000000) + 0x00410000) /* 289475088 */, HW_KEY_INPUT_V2 = (((0x0A11 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.SEAT) + android.hardware.automotive.vehicle.VehiclePropertyType.MIXED) /* 367004177 */, HW_MOTION_INPUT = (((0x0A12 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.SEAT) + android.hardware.automotive.vehicle.VehiclePropertyType.MIXED) /* 367004178 */, @@ -167,11 +172,13 @@ enum VehicleProperty { SEAT_FOOTWELL_LIGHTS_SWITCH = (((0x0B9C + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.SEAT) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 356518812 */, SEAT_EASY_ACCESS_ENABLED = (((0x0B9D + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.SEAT) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN) /* 354421661 */, SEAT_AIRBAG_ENABLED = (((0x0B9E + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.SEAT) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN) /* 354421662 */, + SEAT_AIRBAGS_DEPLOYED = (((0x0BA5 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.SEAT) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 356518821 */, SEAT_CUSHION_SIDE_SUPPORT_POS = (((0x0B9F + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.SEAT) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 356518815 */, SEAT_CUSHION_SIDE_SUPPORT_MOVE = (((0x0BA0 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.SEAT) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 356518816 */, SEAT_LUMBAR_VERTICAL_POS = (((0x0BA1 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.SEAT) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 356518817 */, SEAT_LUMBAR_VERTICAL_MOVE = (((0x0BA2 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.SEAT) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 356518818 */, SEAT_WALK_IN_POS = (((0x0BA3 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.SEAT) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 356518819 */, + SEAT_BELT_PRETENSIONER_DEPLOYED = (((0x0BA6 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.SEAT) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN) /* 354421670 */, SEAT_OCCUPANCY = (((0x0BB0 + 0x10000000) + 0x05000000) + 0x00400000) /* 356518832 */, WINDOW_POS = (((0x0BC0 + 0x10000000) + 0x03000000) + 0x00400000) /* 322964416 */, WINDOW_MOVE = (((0x0BC1 + 0x10000000) + 0x03000000) + 0x00400000) /* 322964417 */, @@ -190,6 +197,11 @@ enum VehicleProperty { GLOVE_BOX_LOCKED = (((0x0BF1 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.SEAT) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN) /* 354421745 */, VEHICLE_MAP_SERVICE = (((0x0C00 + 0x10000000) + 0x01000000) + 0x00e00000) /* 299895808 */, LOCATION_CHARACTERIZATION = (((0x0C10 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289410064 */, + ULTRASONICS_SENSOR_POSITION = (((0x0C20 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.VENDOR) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32_VEC) /* 406916128 */, + ULTRASONICS_SENSOR_ORIENTATION = (((0x0C21 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.VENDOR) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32_VEC) /* 406916129 */, + ULTRASONICS_SENSOR_FIELD_OF_VIEW = (((0x0C22 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.VENDOR) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32_VEC) /* 406916130 */, + ULTRASONICS_SENSOR_DETECTION_RANGE = (((0x0C23 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.VENDOR) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32_VEC) /* 406916131 */, + ULTRASONICS_SENSOR_SUPPORTED_RANGES = (((0x0C24 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.VENDOR) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32_VEC) /* 406916132 */, OBD2_LIVE_FRAME = (((0x0D00 + 0x10000000) + 0x01000000) + 0x00e00000) /* 299896064 */, OBD2_FREEZE_FRAME = (((0x0D01 + 0x10000000) + 0x01000000) + 0x00e00000) /* 299896065 */, OBD2_FREEZE_FRAME_INFO = (((0x0D02 + 0x10000000) + 0x01000000) + 0x00e00000) /* 299896066 */, @@ -245,6 +257,8 @@ enum VehicleProperty { SUPPORTED_PROPERTY_IDS = (((0x0F48 + 0x10000000) + 0x01000000) + 0x00410000) /* 289476424 */, SHUTDOWN_REQUEST = (((0x0F49 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289410889 */, VEHICLE_IN_USE = (((0x0F4A + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN) /* 287313738 */, + CLUSTER_HEARTBEAT = (((0x0F4B + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.MIXED) /* 299896651 */, + VEHICLE_DRIVING_AUTOMATION_CURRENT_LEVEL = (((0x0F4C + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289410892 */, AUTOMATIC_EMERGENCY_BRAKING_ENABLED = (((0x1000 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN) /* 287313920 */, AUTOMATIC_EMERGENCY_BRAKING_STATE = (((0x1001 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289411073 */, FORWARD_COLLISION_WARNING_ENABLED = (((0x1002 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN) /* 287313922 */, @@ -270,4 +284,16 @@ enum VehicleProperty { HANDS_ON_DETECTION_ENABLED = (((0x1016 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN) /* 287313942 */, HANDS_ON_DETECTION_DRIVER_STATE = (((0x1017 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289411095 */, HANDS_ON_DETECTION_WARNING = (((0x1018 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289411096 */, + DRIVER_DROWSINESS_ATTENTION_SYSTEM_ENABLED = (((0x1019 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN) /* 287313945 */, + DRIVER_DROWSINESS_ATTENTION_STATE = (((0x101A + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289411098 */, + DRIVER_DROWSINESS_ATTENTION_WARNING_ENABLED = (((0x101B + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN) /* 287313947 */, + DRIVER_DROWSINESS_ATTENTION_WARNING = (((0x101C + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289411100 */, + DRIVER_DISTRACTION_SYSTEM_ENABLED = (((0x101D + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN) /* 287313949 */, + DRIVER_DISTRACTION_STATE = (((0x101E + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289411102 */, + DRIVER_DISTRACTION_WARNING_ENABLED = (((0x101F + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN) /* 287313951 */, + DRIVER_DISTRACTION_WARNING = (((0x1020 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289411104 */, + LOW_SPEED_COLLISION_WARNING_ENABLED = (((0x1021 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN) /* 287313953 */, + LOW_SPEED_COLLISION_WARNING_STATE = (((0x1022 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289411106 */, + CROSS_TRAFFIC_MONITORING_ENABLED = (((0x1023 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN) /* 287313955 */, + CROSS_TRAFFIC_MONITORING_WARNING_STATE = (((0x1024 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289411108 */, } diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehiclePropertyGroup.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehiclePropertyGroup.aidl index 714d514cf46397481dd987f6fe321d35d13a925e..b4f6850bbf0fdce119bc490543929a2d41d9259b 100644 --- a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehiclePropertyGroup.aidl +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehiclePropertyGroup.aidl @@ -36,5 +36,6 @@ package android.hardware.automotive.vehicle; enum VehiclePropertyGroup { SYSTEM = 0x10000000, VENDOR = 0x20000000, + BACKPORTED = 0x30000000, MASK = 0xf0000000, } diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/CrossTrafficMonitoringWarningState.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/CrossTrafficMonitoringWarningState.aidl new file mode 100644 index 0000000000000000000000000000000000000000..05be65d5cb988caa56ee8ba585fa31a5a99b898e --- /dev/null +++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/CrossTrafficMonitoringWarningState.aidl @@ -0,0 +1,71 @@ +/* + * Copyright (C) 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.hardware.automotive.vehicle; + +/** + * Used to enumerate the state of Cross Traffic Monitoring Warning system. + */ +@VintfStability +@Backing(type="int") +enum CrossTrafficMonitoringWarningState { + + /** + * This state is used as an alternative to any CrossTrafficMonitoringWarningState value that is + * not defined in the platform. Ideally, implementations of + * VehicleProperty#CROSS_TRAFFIC_MONITORING_WARNING_STATE should not use this state. The + * framework can use this field to remain backwards compatible if + * CrossTrafficMonitoringWarningState is extended to include additional states. + */ + OTHER = 0, + /** + * Cross Traffic Monitoring Warning is enabled and monitoring safety, but no potential collision + * is detected. + */ + NO_WARNING = 1, + /** + * Cross Traffic Monitoring Warning is enabled and is actively warning the user of incoming + * moving objects coming from the driver's left side in front of the vehicle. + */ + WARNING_FRONT_LEFT = 2, + /** + * Cross Traffic Monitoring Warning is enabled and is actively warning the user of incoming + * moving objects coming from the driver's right side in front of the vehicle. + */ + WARNING_FRONT_RIGHT = 3, + /** + * Cross Traffic Monitoring Warning is enabled and is actively warning the user of incoming + * moving objects coming from both the driver's left side and the driver's right side in front + * of the vehicle. + */ + WARNING_FRONT_BOTH = 4, + /** + * Cross Traffic Monitoring Warning is enabled and is actively warning the user of incoming + * moving objects coming from the driver's left side behind the vehicle. + */ + WARNING_REAR_LEFT = 5, + /** + * Cross Traffic Monitoring Warning is enabled and is actively warning the user of incoming + * moving objects coming from the driver's right side behind the vehicle. + */ + WARNING_REAR_RIGHT = 6, + /** + * Cross Traffic Monitoring Warning is enabled and is actively warning the user of incoming + * moving objects coming from the driver's left side and the driver's right side behind the + * vehicle. + */ + WARNING_REAR_BOTH = 7, +} diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/DriverDistractionState.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/DriverDistractionState.aidl new file mode 100644 index 0000000000000000000000000000000000000000..f350a6c41de4635b7e986bfe3d0eb09588030664 --- /dev/null +++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/DriverDistractionState.aidl @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.hardware.automotive.vehicle; + +/** + * Used to enumerate the current state of driver distraction monitoring. + * + * This enum could be extended in future releases to include additional feature states. + */ +@VintfStability +@Backing(type="int") +enum DriverDistractionState { + /** + * This state is used as an alternative for any DriverDistractionState value that is not + * defined in the platform. Ideally, implementations of + * VehicleProperty#DRIVER_DISTRACTION_STATE should not use this state. The framework + * can use this field to remain backwards compatible if DriverDistractionState is + * extended to include additional states. + */ + OTHER = 0, + /** + * The system detects that the driver is attentive / not distracted. + */ + NOT_DISTRACTED = 1, + /** + * The system detects that the driver is distracted, which can be anything that reduces the + * driver's foucs on the primary task of driving/controlling the vehicle. + */ + DISTRACTED = 2, +} diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/DriverDistractionWarning.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/DriverDistractionWarning.aidl new file mode 100644 index 0000000000000000000000000000000000000000..a4b1984a58244008fb638933aaaa2f0e0ae81f32 --- /dev/null +++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/DriverDistractionWarning.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.hardware.automotive.vehicle; + +/** + * Used to enumerate the current warning state of the driver distraction monitoring system. + */ +@VintfStability +@Backing(type="int") +enum DriverDistractionWarning { + /** + * This state is used as an alternative for any DriverDistractionWarning value that is + * defined in the platform. Ideally, implementations of + * VehicleProperty#DRIVER_DISTRACTION_WARNING should not use this state. The framework + * can use this field to remain backwards compatible if DriverDistractionWarning is + * extended to include additional states. + */ + OTHER = 0, + /** + * When the driver distraction warning is enabled and the driver's current distraction level + * does not warrant the system to send a warning. + */ + NO_WARNING = 1, + /** + * When the driver distraction warning is enabled and the system is warning the driver based on + * its assessment of the driver's current distraction level. + */ + WARNING = 2, +} diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/DriverDrowsinessAttentionState.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/DriverDrowsinessAttentionState.aidl new file mode 100644 index 0000000000000000000000000000000000000000..d2aec1ffc68ce6b63f3534c4b4d127964ab03480 --- /dev/null +++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/DriverDrowsinessAttentionState.aidl @@ -0,0 +1,74 @@ +/* + * Copyright (C) 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.hardware.automotive.vehicle; + +/** + * Used to enumerate the current state of driver drowsiness and attention monitoring. + * + * This enum could be extended in future releases to include additional feature states. + */ +@VintfStability +@Backing(type="int") +enum DriverDrowsinessAttentionState { + /** + * This state is used as an alternative for any DriverDrowsinessAttentionState value that is not + * defined in the platform. Ideally, implementations of + * VehicleProperty#DRIVER_DROWSINESS_ATTENTION_STATE should not use this state. The framework + * can use this field to remain backwards compatible if DriverDrowsinessAttentionState is + * extended to include additional states. + */ + OTHER = 0, + /** + * Karolinska Sleepiness Scale Rating 1 described as extermely alert. + */ + KSS_RATING_1_EXTREMELY_ALERT = 1, + /** + * Karolinska Sleepiness Scale Rating 2 described as very alert. + */ + KSS_RATING_2_VERY_ALERT = 2, + /** + * Karolinska Sleepiness Scale Rating 3 described as alert. + */ + KSS_RATING_3_ALERT = 3, + /** + * Karolinska Sleepiness Scale Rating 4 described as rather alert. + */ + KSS_RATING_4_RATHER_ALERT = 4, + /** + * Karolinska Sleepiness Scale Rating 5 described as neither alert nor sleepy. + */ + KSS_RATING_5_NEITHER_ALERT_NOR_SLEEPY = 5, + /** + * Karolinska Sleepiness Scale Rating 6 described as some signs of sleepiness. + */ + KSS_RATING_6_SOME_SLEEPINESS = 6, + /** + * Karolinska Sleepiness Scale Rating 7 described as sleepy with no effort to + * keep awake. + */ + KSS_RATING_7_SLEEPY_NO_EFFORT = 7, + /** + * Karolinska Sleepiness Scale Rating 8 described as sleepy with some effort to + * keep awake. + */ + KSS_RATING_8_SLEEPY_SOME_EFFORT = 8, + /** + * Karolinska Sleepiness Scale Rating 9 described as very sleepy, with great + * effort to keep away, and fighthing sleep. + */ + KSS_RATING_9_VERY_SLEEPY = 9, +} diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/DriverDrowsinessAttentionWarning.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/DriverDrowsinessAttentionWarning.aidl new file mode 100644 index 0000000000000000000000000000000000000000..53b66b9e5095e1992eaf7cef4f6d84bb240e20d8 --- /dev/null +++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/DriverDrowsinessAttentionWarning.aidl @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.hardware.automotive.vehicle; + +/** + * Used to enumerate the current warning state of the driver drowsiness and attention monitoring + * system. + */ +@VintfStability +@Backing(type="int") +enum DriverDrowsinessAttentionWarning { + /** + * This state is used as an alternative for any DriverDrowsinessAttentionWarning value that is + * defined in the platform. Ideally, implementations of + * VehicleProperty#DRIVER_DROWSINESS_ATTENTION_WARNING should not use this state. The framework + * can use this field to remain backwards compatible if DriverDrowsinessAttentionWarning is + * extended to include additional states. + */ + OTHER = 0, + /** + * When the driver drowsiness and attention warning is enabled, and the driver's current + * drowsiness and attention level does not warrant the system to send a warning. + */ + NO_WARNING = 1, + /** + * When the driver drowsiness and attention warning is enabled, and the system is warning the + * driver based on its assessment of the driver's current drowsiness and attention level. + */ + WARNING = 2, +} diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/ElectronicStabilityControlState.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/ElectronicStabilityControlState.aidl new file mode 100644 index 0000000000000000000000000000000000000000..006bbf2e701777a7ce953fccfc89c83490e08f94 --- /dev/null +++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/ElectronicStabilityControlState.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.hardware.automotive.vehicle; + +/** + * Used to enumerate the state of Electronic Stability Control (ESC). + */ +@VintfStability +@Backing(type="int") +enum ElectronicStabilityControlState { + + /** + * This state is used as an alternative to any ElectronicStabilityControlState value that is not + * defined in the platform. Ideally, implementations of + * VehicleProperty#ELECTRONIC_STABILITY_CONTROL_STATE should not use this state. The framework + * can use this field to remain backwards compatible if ElectronicStabilityControlState is + * extended to include additional states. + */ + OTHER = 0, + /** + * ESC is enabled and monitoring safety, but is not actively controlling the tires to prevent + * the car from skidding. + */ + ENABLED = 1, + /** + * ESC is enabled and is actively controlling the tires to prevent the car from skidding. + */ + ACTIVATED = 2, +} diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/ImpactSensorLocation.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/ImpactSensorLocation.aidl new file mode 100644 index 0000000000000000000000000000000000000000..0fc1a50a83dca04ad1e68a7b53a870ba4c87b685 --- /dev/null +++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/ImpactSensorLocation.aidl @@ -0,0 +1,57 @@ +/* + * Copyright (C) 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.hardware.automotive.vehicle; + +/** + * Used to enumerate the various impact sensor locations on the car. + */ +@VintfStability +@Backing(type="int") +enum ImpactSensorLocation { + /** + * Other impact sensor location. Ideally this should never be used. + */ + OTHER = 0x01, + /** + * Frontal impact sensor. Used for the sensor that detects head-on impact. + */ + FRONT = 0x02, + /** + * Front-left door side impact sensor. Used for the sensor that detects collisions from the + * side, in particular on the front-left door. + */ + FRONT_LEFT_DOOR_SIDE = 0x04, + /** + * Front-right door side impact sensor. Used for the sensor that detects collisions from the + * side, in particular on the front-right door. + */ + FRONT_RIGHT_DOOR_SIDE = 0x08, + /** + * Rear-left door side impact sensor. Used for the sensor that detects collisions from the + * side, in particular on the rear-left door. + */ + REAR_LEFT_DOOR_SIDE = 0x10, + /** + * Rear-right door side impact sensor. Used for the sensor that detects collisions from the + * side, in particular on the rear-right door. + */ + REAR_RIGHT_DOOR_SIDE = 0x20, + /** + * Rear impact sensor. Used for the sensor that detects collisions from the rear. + */ + REAR = 0x40, +} diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/LowSpeedCollisionWarningState.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/LowSpeedCollisionWarningState.aidl new file mode 100644 index 0000000000000000000000000000000000000000..028a2d9e40a983f34c7f6175ed6d95943f7f8cb2 --- /dev/null +++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/LowSpeedCollisionWarningState.aidl @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.hardware.automotive.vehicle; + +/** + * Used to enumerate the state of Low Speed Collision Warning State. + */ +@VintfStability +@Backing(type="int") +enum LowSpeedCollisionWarningState { + + /** + * This state is used as an alternative to any LowSpeedCollisionWarningState value that is not + * defined in the platform. Ideally, implementations of + * VehicleProperty#LOW_SPEED_COLLISION_WARNING_STATE should not use this state. The framework + * can use this field to remain backwards compatible if LowSpeedCollisionWarningState is + * extended to include additional states. + */ + OTHER = 0, + /** + * Low Speed Collision Warning is enabled and monitoring for potential collision, but no + * potential collision is detected. + */ + NO_WARNING = 1, + /** + * Low Speed Collision Warning is enabled, detects a potential collision, and is actively + * warning the user. + */ + WARNING = 2, +} diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleAirbagLocation.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleAirbagLocation.aidl new file mode 100644 index 0000000000000000000000000000000000000000..e4c43f7992b806f179a5e9b875f095f1d3487c1c --- /dev/null +++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleAirbagLocation.aidl @@ -0,0 +1,55 @@ +/* + * Copyright (C) 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.hardware.automotive.vehicle; + +/** + * Used to enumerate the various airbag locations per seat. + */ +@VintfStability +@Backing(type="int") +enum VehicleAirbagLocation { + /** + * This state is used as an alternative to any VehicleAirbagLocation value that is not defined + * in the platform. Ideally, implementations of VehicleProperty::SEAT_AIRBAGS_DEPLOYED should + * not use this state. The framework can use this field to remain backwards compatible if + * VehicleAirbagLocation is extended to include additional states. + */ + OTHER = 0x01, + /** + * Front airbags. This enum is for the airbags that protect the seated person from the front, + * particularly the seated person's torso. + */ + FRONT = 0x02, + /** + * Knee airbags. This enum is for the airbags that protect the seated person's knees. + */ + KNEE = 0x04, + /** + * Left side airbags. This enum is for the side airbags that protect the left side of the seated + * person. + */ + LEFT_SIDE = 0x08, + /** + * Right side airbags. This enum is for the side airbags that protect the right side of the + * seated person. + */ + RIGHT_SIDE = 0x10, + /** + * Curtain airbags. This enum is for the airbags lined above the windows of the vehicle. + */ + CURTAIN = 0x20, +} diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleApPowerStateShutdownParam.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleApPowerStateShutdownParam.aidl index a863d1423de2db83d5bb84d316ccdecd98ae3082..923d42aef19e3b2f1a61b2e7d2d87a74d9882e11 100644 --- a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleApPowerStateShutdownParam.aidl +++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleApPowerStateShutdownParam.aidl @@ -45,4 +45,8 @@ enum VehicleApPowerStateShutdownParam { * AP can enter hibernation (suspend to disk) instead of shutting down completely. */ CAN_HIBERNATE = 6, + /** + * AP must shutdown (gracefully) without a delay. + */ + EMERGENCY_SHUTDOWN = 7, } diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleArea.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleArea.aidl index 6f7f78386a8b63f6287f55e7a36e6ea410602f8b..259b231f7016e488896cced992754a637f03aaf1 100644 --- a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleArea.aidl +++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleArea.aidl @@ -49,6 +49,11 @@ enum VehicleArea { DOOR = 0x06000000, /** WHEEL maps to enum VehicleAreaWheel */ WHEEL = 0x07000000, + /** + * A property with the VENDOR vehicle area contains area IDs that are vendor defined. Each area + * ID within this area type must be unique with no overlapping bits set. + */ + VENDOR = 0x08000000, MASK = 0x0f000000, } diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleAreaSeat.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleAreaSeat.aidl index 89d50ea183da3ddb4397d58b611d24c87355f518..e70fb22717e2b152cf27d4d82fc993caacc76d50 100644 --- a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleAreaSeat.aidl +++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleAreaSeat.aidl @@ -22,6 +22,7 @@ package android.hardware.automotive.vehicle; @VintfStability @Backing(type="int") enum VehicleAreaSeat { + UNKNOWN = 0x0000, ROW_1_LEFT = 0x0001, ROW_1_CENTER = 0x0002, ROW_1_RIGHT = 0x0004, diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleAutonomousState.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleAutonomousState.aidl new file mode 100644 index 0000000000000000000000000000000000000000..3860e7f222e4aef638434b1d88b79c53f86d7c93 --- /dev/null +++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleAutonomousState.aidl @@ -0,0 +1,73 @@ +/* + * Copyright (C) 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.hardware.automotive.vehicle; + +/** + * Used to enumerate the various level of automation that can be expressed by the + * VEHICLE_DRIVING_AUTOMATION_CURRENT_LEVEL property. + */ +@VintfStability +@Backing(type="int") +enum VehicleAutonomousState { + /** + * No automation. ADAS systems are limited to providing warnings and momentary assistance. The + * driver is in constant supervision of all driving tasks and must steer, brake or accelerate as + * needed to maintain safety, and is still responsible for driving while the ADAS systems are + * engaged. Usage should be in accordance to Level 0 definition in J3016_202104 version of + * vehicle autonomy levels defined by SAE. + */ + LEVEL_0 = 0, + /** + * Driver assistance. ADAS systems can provide steering or brake/acceleration support to the + * driver. The driver is in constant supervision of all driving tasks and must steer, brake or + * accelerate as needed to maintain safety, and is still responsible for driving while the ADAS + * systems are engaged. Usage should be in accordance to Level 1 definition in J3016_202104 + * version of vehicle autonomy levels defined by SAE. + */ + LEVEL_1 = 1, + /** + * Partial automation. ADAS systems can provide both steering and brake/acceleration support to + * the driver at the same time. The driver is in constant supervision of all driving tasks and + * must steer, brake or accelerate as needed to maintain safety, and is still responsible for + * driving while the ADAS systems are engaged. Usage should be in accordance to Level 2 + * definition in J3016_202104 version of vehicle autonomy levels defined by SAE. + */ + LEVEL_2 = 2, + /** + * Conditional automation. ADAS systems can drive the vehicle under limited conditions and will + * not operate unless all required conditions are met. The driver is required to take over + * control of the vehicle when requested to do so by the ADAS systems, however is not + * responsible for driving while the ADAS systems are engaged. Usage should be in accordance to + * Level 3 definition in J3016_202104 version of vehicle autonomy levels defined by SAE. + */ + LEVEL_3 = 3, + /** + * High automation. ADAS systems can drive the vehicle under limited conditions and will not + * operate unless all required conditions are met. The driver is not required to take over + * control of the vehicle and is not responsible for driving while the ADAS systems are engaged. + * Usage should be in accordance to Level 4 definition in J3016_202104 version of vehicle + * autonomy levels defined by SAE. + */ + LEVEL_4 = 4, + /** + * Full automation. ADAS systems can drive the vehicle under all conditions. The driver is not + * required to take over control of the vehicle and is not responsible for driving while the + * ADAS systems are engaged. Usage should be in accordance to Level 5 definition in J3016_202104 + * version of vehicle autonomy levels defined by SAE. + */ + LEVEL_5 = 5, +} diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl index 717f5616dad4340d55d87ca44d243c8d3709f82c..acb6aeb5a1b870e960a4118f9f296d21cc8aa023 100644 --- a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -169,7 +169,7 @@ enum VehicleProperty { * int32Values[4] = wheel base * int32Values[5] = track width front * int32Values[6] = track width rear - * int32Values[7] = curb to curb turning radius + * int32Values[7] = curb to curb turning diameter * * @change_mode VehiclePropertyChangeMode.STATIC * @access VehiclePropertyAccess.READ @@ -345,6 +345,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE + * @access VehiclePropertyAccess.READ */ FUEL_DOOR_OPEN = 0x0308 + 0x10000000 + 0x01000000 + 0x00200000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:BOOLEAN @@ -383,6 +384,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE + * @access VehiclePropertyAccess.READ */ EV_CHARGE_PORT_OPEN = 0x030A + 0x10000000 + 0x01000000 + 0x00200000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:BOOLEAN @@ -419,10 +421,24 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.CONTINUOUS * @access VehiclePropertyAccess.READ_WRITE + * @access VehiclePropertyAccess.READ * @unit VehicleUnit:METER */ RANGE_REMAINING = 0x0308 + 0x10000000 + 0x01000000 + 0x00600000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:FLOAT + /** + * EV battery average temperature + * + * Exposes the temperature of the battery in an EV. If multiple batteries exist in the EV, or + * multiple temperature sensors exist, this property should be set to the mean or a meaningful + * weighted average that best represents the overall temperature of the battery system. + * + * @change_mode VehiclePropertyChangeMode.CONTINUOUS + * @access VehiclePropertyAccess.READ + * @unit VehicleUnit:CELSIUS + */ + EV_BATTERY_AVERAGE_TEMPERATURE = + 0x030E + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.FLOAT, /** * Tire pressure * @@ -476,9 +492,26 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE + * @access VehiclePropertyAccess.READ */ ENGINE_IDLE_AUTO_STOP_ENABLED = 0x0320 + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.BOOLEAN, + /** + * Impact detected. + * + * Bit flag property to relay information on whether an impact has occurred on a particular side + * of the vehicle as described through the ImpactSensorLocation enum. As a bit flag property, + * this property can be set to multiple ORed together values of the enum when necessary. + * + * For the global area ID (0), the VehicleAreaConfig#supportedEnumValues array must be defined + * unless all bit flags of ImpactSensorLocation are supported. + * + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ + * @data_enum ImpactSensorLocation + */ + IMPACT_DETECTED = + 0x0330 + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.INT32, /** * Currently selected gear * @@ -560,6 +593,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE + * @access VehiclePropertyAccess.READ */ EV_BRAKE_REGENERATION_LEVEL = 0x040C + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.INT32, @@ -648,10 +682,50 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE + * @access VehiclePropertyAccess.READ * @data_enum EvStoppingMode */ EV_STOPPING_MODE = 0x040D + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.INT32, + /** + * Enable or disable Electronic Stability Control (ESC). + * + * Set true to enable ESC and false to disable ESC. When ESC is enabled, a system in the vehicle + * should be controlling the tires during instances with high risk of skidding to actively + * prevent the same from happening. + * + * In general, ELECTRONIC_STABILITY_CONTROL_ENABLED should always return true or false. If the + * feature is not available due to some temporary state, such as the vehicle speed being too + * high, that information must be conveyed through the ErrorState values in the + * ELECTRONIC_STABILITY_CONTROL_STATE property. + * + * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to + * implement it as VehiclePropertyAccess.READ only. + * + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ_WRITE + * @access VehiclePropertyAccess.READ + */ + ELECTRONIC_STABILITY_CONTROL_ENABLED = + 0x040E + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.BOOLEAN, + /** + * Electronic Stability Control (ESC) state. + * + * Returns the current state of ESC. This property must always return a valid state defined in + * ElectronicStabilityControlState or ErrorState. It must not surface errors through StatusCode + * and must use the supported error states instead. + * + * For the global area ID (0), the VehicleAreaConfig#supportedEnumValues array must be defined + * unless all states of both ElectronicStabilityControlState (including OTHER, which is not + * recommended) and ErrorState are supported. + * + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ + * @data_enum ElectronicStabilityControlState + * @data_enum ErrorState + */ + ELECTRONIC_STABILITY_CONTROL_STATE = + 0x040F + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.INT32, /** * HVAC Properties * @@ -696,8 +770,9 @@ enum VehicleProperty { * and passenger side, an alternative mapping would be: * - ROW_1_LEFT * - ROW_1_RIGHT - * - * + */ + + /** * Fan speed setting * * The maxInt32Value and minInt32Value in VehicleAreaConfig must be defined. @@ -713,6 +788,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE + * @access VehiclePropertyAccess.READ */ HVAC_FAN_SPEED = 0x0500 + 0x10000000 + 0x05000000 + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:INT32 @@ -724,6 +800,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE + * @access VehiclePropertyAccess.READ * @data_enum VehicleHvacFanDirection */ HVAC_FAN_DIRECTION = 0x0501 + 0x10000000 + 0x05000000 @@ -763,6 +840,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE + * @access VehiclePropertyAccess.READ * @unit VehicleUnit:CELSIUS */ HVAC_TEMPERATURE_SET = 0x0503 + 0x10000000 + 0x05000000 @@ -775,6 +853,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE + * @access VehiclePropertyAccess.READ */ HVAC_DEFROSTER = 0x0504 + 0x10000000 + 0x03000000 + 0x00200000, // VehiclePropertyGroup:SYSTEM,VehicleArea:WINDOW,VehiclePropertyType:BOOLEAN @@ -786,6 +865,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE + * @access VehiclePropertyAccess.READ * @config_flags Supported areaIds */ HVAC_AC_ON = 0x0505 + 0x10000000 + 0x05000000 @@ -803,6 +883,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE + * @access VehiclePropertyAccess.READ */ HVAC_MAX_AC_ON = 0x0506 + 0x10000000 + 0x05000000 + 0x00200000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:BOOLEAN @@ -825,6 +906,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE + * @access VehiclePropertyAccess.READ */ HVAC_MAX_DEFROST_ON = 0x0507 + 0x10000000 + 0x05000000 + 0x00200000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:BOOLEAN @@ -841,6 +923,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE + * @access VehiclePropertyAccess.READ */ HVAC_RECIRC_ON = 0x0508 + 0x10000000 + 0x05000000 + 0x00200000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:BOOLEAN @@ -879,6 +962,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE + * @access VehiclePropertyAccess.READ */ HVAC_DUAL_ON = 0x0509 + 0x10000000 + 0x05000000 + 0x00200000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:BOOLEAN @@ -900,6 +984,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE + * @access VehiclePropertyAccess.READ */ HVAC_AUTO_ON = 0x050A + 0x10000000 + 0x05000000 + 0x00200000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:BOOLEAN @@ -921,6 +1006,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE + * @access VehiclePropertyAccess.READ */ HVAC_SEAT_TEMPERATURE = 0x050B + 0x10000000 + 0x05000000 + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:INT32 @@ -943,6 +1029,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE + * @access VehiclePropertyAccess.READ */ HVAC_SIDE_MIRROR_HEAT = 0x050C + 0x10000000 + 0x04000000 + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:MIRROR,VehiclePropertyType:INT32 @@ -965,6 +1052,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE + * @access VehiclePropertyAccess.READ */ HVAC_STEERING_WHEEL_HEAT = 0x050D + 0x10000000 + 0x01000000 + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:INT32 @@ -989,6 +1077,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE + * @access VehiclePropertyAccess.READ * @data_enum VehicleUnit */ HVAC_TEMPERATURE_DISPLAY_UNITS = 0x050E + 0x10000000 + 0x01000000 @@ -1043,6 +1132,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE + * @access VehiclePropertyAccess.READ */ HVAC_POWER_ON = 0x0510 + 0x10000000 + 0x05000000 + 0x00200000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:BOOLEAN @@ -1077,6 +1167,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE + * @access VehiclePropertyAccess.READ */ HVAC_AUTO_RECIRC_ON = 0x0512 + 0x10000000 + 0x05000000 + 0x00200000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:BOOLEAN @@ -1101,6 +1192,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE + * @access VehiclePropertyAccess.READ */ HVAC_SEAT_VENTILATION = 0x0513 + 0x10000000 + 0x05000000 + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:INT32 @@ -1112,6 +1204,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE + * @access VehiclePropertyAccess.READ */ HVAC_ELECTRIC_DEFROSTER_ON = 0x0514 + 0x10000000 + 0x03000000 + 0x00200000, // VehiclePropertyGroup:SYSTEM,VehicleArea:WINDOW,VehiclePropertyType:BOOLEAN @@ -1175,6 +1268,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE + * @access VehiclePropertyAccess.READ * @data_enum VehicleUnit */ DISTANCE_DISPLAY_UNITS = 0x0600 + 0x10000000 + 0x01000000 @@ -1198,6 +1292,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE + * @access VehiclePropertyAccess.READ * @data_enum VehicleUnit */ FUEL_VOLUME_DISPLAY_UNITS = 0x0601 + 0x10000000 + 0x01000000 @@ -1222,6 +1317,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE + * @access VehiclePropertyAccess.READ * @data_enum VehicleUnit */ TIRE_PRESSURE_DISPLAY_UNITS = 0x0602 + 0x10000000 + 0x01000000 @@ -1246,6 +1342,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE + * @access VehiclePropertyAccess.READ * @data_enum VehicleUnit */ EV_BATTERY_DISPLAY_UNITS = 0x0603 + 0x10000000 + 0x01000000 @@ -1262,6 +1359,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE + * @access VehiclePropertyAccess.READ */ FUEL_CONSUMPTION_UNITS_DISTANCE_OVER_VOLUME = 0x0604 + 0x10000000 + 0x01000000 + 0x00200000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:BOOLEAN @@ -1284,6 +1382,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE + * @access VehiclePropertyAccess.READ */ VEHICLE_SPEED_DISPLAY_UNITS = 0x0605 + 0x10000000 + 0x01000000 + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:INT32 @@ -1474,6 +1573,22 @@ enum VehicleProperty { */ PER_DISPLAY_BRIGHTNESS = 0x0A04 + 0x10000000 + 0x01000000 + 0x00410000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:INT32_VEC + /** + * Valet mode enabled + * + * This property allows the user to enable/disable valet mode in their vehicle. Valet mode is + * a privacy and security setting that prevents an untrusted driver to access more private areas + * in the vehicle, such as the glove box or the trunk(s). + * + * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to + * implement it as VehiclePropertyAccess.READ only. + * + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ_WRITE + * @access VehiclePropertyAccess.READ + */ + VALET_MODE_ENABLED = + 0x0A05 + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.BOOLEAN, /** * Property to feed H/W input events to android * @@ -1633,6 +1748,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE + * @access VehiclePropertyAccess.READ */ DOOR_POS = 0x0B00 + 0x10000000 + 0x06000000 + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:DOOR,VehiclePropertyType:INT32 @@ -1657,6 +1773,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE + * @access VehiclePropertyAccess.READ */ DOOR_MOVE = 0x0B01 + 0x10000000 + 0x06000000 + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:DOOR,VehiclePropertyType:INT32 @@ -1670,6 +1787,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE + * @access VehiclePropertyAccess.READ */ DOOR_LOCK = 0x0B02 + 0x10000000 + 0x06000000 + 0x00200000, // VehiclePropertyGroup:SYSTEM,VehicleArea:DOOR,VehiclePropertyType:BOOLEAN @@ -1685,6 +1803,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE + * @access VehiclePropertyAccess.READ */ DOOR_CHILD_LOCK_ENABLED = 0x0B03 + VehiclePropertyGroup.SYSTEM + VehicleArea.DOOR + VehiclePropertyType.BOOLEAN, @@ -1710,6 +1829,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE + * @access VehiclePropertyAccess.READ */ MIRROR_Z_POS = 0x0B40 + 0x10000000 + 0x04000000 + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:MIRROR,VehiclePropertyType:INT32 @@ -1735,6 +1855,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE + * @access VehiclePropertyAccess.READ */ MIRROR_Z_MOVE = 0x0B41 + 0x10000000 + 0x04000000 + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:MIRROR,VehiclePropertyType:INT32 @@ -1760,6 +1881,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE + * @access VehiclePropertyAccess.READ */ MIRROR_Y_POS = 0x0B42 + 0x10000000 + 0x04000000 + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:MIRROR,VehiclePropertyType:INT32 @@ -1784,6 +1906,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE + * @access VehiclePropertyAccess.READ */ MIRROR_Y_MOVE = 0x0B43 + 0x10000000 + 0x04000000 + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:MIRROR,VehiclePropertyType:INT32 @@ -1797,6 +1920,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE + * @access VehiclePropertyAccess.READ */ MIRROR_LOCK = 0x0B44 + 0x10000000 + 0x01000000 + 0x00200000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:BOOLEAN @@ -1810,6 +1934,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE + * @access VehiclePropertyAccess.READ */ MIRROR_FOLD = 0x0B45 + 0x10000000 + 0x01000000 + 0x00200000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:BOOLEAN @@ -1826,6 +1951,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE + * @access VehiclePropertyAccess.READ */ MIRROR_AUTO_FOLD_ENABLED = @@ -1843,6 +1969,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE + * @access VehiclePropertyAccess.READ */ MIRROR_AUTO_TILT_ENABLED = @@ -1891,6 +2018,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE + * @access VehiclePropertyAccess.READ */ SEAT_BELT_BUCKLED = 0x0B82 + 0x10000000 + 0x05000000 + 0x00200000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:BOOLEAN @@ -1915,6 +2043,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE + * @access VehiclePropertyAccess.READ */ SEAT_BELT_HEIGHT_POS = 0x0B83 + 0x10000000 + 0x05000000 + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:INT32 @@ -1942,6 +2071,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE + * @access VehiclePropertyAccess.READ */ SEAT_BELT_HEIGHT_MOVE = 0x0B84 + 0x10000000 + 0x05000000 + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:INT32 @@ -1966,6 +2096,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE + * @access VehiclePropertyAccess.READ */ SEAT_FORE_AFT_POS = 0x0B85 + 0x10000000 + 0x05000000 + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:INT32 @@ -1992,6 +2123,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE + * @access VehiclePropertyAccess.READ */ SEAT_FORE_AFT_MOVE = 0x0B86 + 0x10000000 + 0x05000000 + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:INT32 @@ -2018,6 +2150,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE + * @access VehiclePropertyAccess.READ */ SEAT_BACKREST_ANGLE_1_POS = 0x0B87 + 0x10000000 + 0x05000000 + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:INT32 @@ -2044,6 +2177,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE + * @access VehiclePropertyAccess.READ */ SEAT_BACKREST_ANGLE_1_MOVE = 0x0B88 + 0x10000000 + 0x05000000 + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:INT32 @@ -2072,6 +2206,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE + * @access VehiclePropertyAccess.READ */ SEAT_BACKREST_ANGLE_2_POS = 0x0B89 + 0x10000000 + 0x05000000 + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:INT32 @@ -2098,6 +2233,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE + * @access VehiclePropertyAccess.READ */ SEAT_BACKREST_ANGLE_2_MOVE = 0x0B8A + 0x10000000 + 0x05000000 + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:INT32 @@ -2120,6 +2256,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE + * @access VehiclePropertyAccess.READ */ SEAT_HEIGHT_POS = 0x0B8B + 0x10000000 + 0x05000000 + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:INT32 @@ -2144,6 +2281,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE + * @access VehiclePropertyAccess.READ */ SEAT_HEIGHT_MOVE = 0x0B8C + 0x10000000 + 0x05000000 + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:INT32 @@ -2171,6 +2309,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE + * @access VehiclePropertyAccess.READ */ SEAT_DEPTH_POS = 0x0B8D + 0x10000000 + 0x05000000 + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:INT32 @@ -2196,6 +2335,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE + * @access VehiclePropertyAccess.READ */ SEAT_DEPTH_MOVE = 0x0B8E + 0x10000000 + 0x05000000 + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:INT32 @@ -2222,6 +2362,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE + * @access VehiclePropertyAccess.READ */ SEAT_TILT_POS = 0x0B8F + 0x10000000 + 0x05000000 + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:INT32 @@ -2248,6 +2389,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE + * @access VehiclePropertyAccess.READ */ SEAT_TILT_MOVE = 0x0B90 + 0x10000000 + 0x05000000 + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:INT32 @@ -2272,6 +2414,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE + * @access VehiclePropertyAccess.READ */ SEAT_LUMBAR_FORE_AFT_POS = 0x0B91 + 0x10000000 + 0x05000000 + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:INT32 @@ -2299,6 +2442,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE + * @access VehiclePropertyAccess.READ */ SEAT_LUMBAR_FORE_AFT_MOVE = 0x0B92 + 0x10000000 + 0x05000000 + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:INT32 @@ -2323,6 +2467,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE + * @access VehiclePropertyAccess.READ */ SEAT_LUMBAR_SIDE_SUPPORT_POS = 0x0B93 + 0x10000000 + 0x05000000 + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:INT32 @@ -2350,6 +2495,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE + * @access VehiclePropertyAccess.READ */ SEAT_LUMBAR_SIDE_SUPPORT_MOVE = 0x0B94 + 0x10000000 + 0x05000000 + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:INT32 @@ -2369,6 +2515,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE + * @access VehiclePropertyAccess.READ */ SEAT_HEADREST_HEIGHT_POS = 0x0B95 + 0x10000000 + 0x01000000 + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:INT32 @@ -2395,6 +2542,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE + * @access VehiclePropertyAccess.READ */ SEAT_HEADREST_HEIGHT_POS_V2 = 0x0BA4 + VehiclePropertyGroup.SYSTEM + VehicleArea.SEAT + VehiclePropertyType.INT32, @@ -2423,6 +2571,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE + * @access VehiclePropertyAccess.READ */ SEAT_HEADREST_HEIGHT_MOVE = 0x0B96 + 0x10000000 + 0x05000000 + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:INT32 @@ -2445,6 +2594,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE + * @access VehiclePropertyAccess.READ */ SEAT_HEADREST_ANGLE_POS = 0x0B97 + 0x10000000 + 0x05000000 + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:INT32 @@ -2472,6 +2622,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE + * @access VehiclePropertyAccess.READ */ SEAT_HEADREST_ANGLE_MOVE = 0x0B98 + 0x10000000 + 0x05000000 + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:INT32 @@ -2494,6 +2645,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE + * @access VehiclePropertyAccess.READ */ SEAT_HEADREST_FORE_AFT_POS = 0x0B99 + 0x10000000 + 0x05000000 + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:INT32 @@ -2521,6 +2673,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE + * @access VehiclePropertyAccess.READ */ SEAT_HEADREST_FORE_AFT_MOVE = 0x0B9A + 0x10000000 + 0x05000000 + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:INT32 @@ -2565,6 +2718,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE + * @access VehiclePropertyAccess.READ * @data_enum VehicleLightSwitch */ SEAT_FOOTWELL_LIGHTS_SWITCH = @@ -2581,6 +2735,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE + * @access VehiclePropertyAccess.READ */ SEAT_EASY_ACCESS_ENABLED = 0x0B9D + VehiclePropertyGroup.SYSTEM + VehicleArea.SEAT + VehiclePropertyType.BOOLEAN, @@ -2600,9 +2755,32 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE + * @access VehiclePropertyAccess.READ */ SEAT_AIRBAG_ENABLED = 0x0B9E + VehiclePropertyGroup.SYSTEM + VehicleArea.SEAT + VehiclePropertyType.BOOLEAN, + /** + * Seat airbags deployed + * + * Bit flag property to relay information on which airbags have been deployed in the vehicle at + * each seat, vs which ones are currently still armed. If SEAT_AIRBAG_ENABLED is set to false at + * a particular areaId, this property should return status code UNAVAILABLE at that areaId. + * + * Enums apply to each seat, not the global vehicle. For example, VehicleAirbagsLocation#CURTAIN + * at the driver seat areaId represents whether the driver side curtain airbag has been + * deployed. Multiple bit flags can be set to indicate that multiple different airbags have been + * deployed for the seat. + * + * For each seat area ID, the VehicleAreaConfig#supportedEnumValues array must be defined unless + * all states of VehicleAirbagLocation are supported (including OTHER, which is not + * recommended). + * + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ + * @data_enum VehicleAirbagLocation + */ + SEAT_AIRBAGS_DEPLOYED = + 0x0BA5 + VehiclePropertyGroup.SYSTEM + VehicleArea.SEAT + VehiclePropertyType.INT32, /** * Represents property for seat’s hipside (bottom cushion’s side) support position. * @@ -2624,6 +2802,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE + * @access VehiclePropertyAccess.READ */ SEAT_CUSHION_SIDE_SUPPORT_POS = 0x0B9F + VehiclePropertyGroup.SYSTEM + VehicleArea.SEAT + VehiclePropertyType.INT32, @@ -2651,6 +2830,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE + * @access VehiclePropertyAccess.READ */ SEAT_CUSHION_SIDE_SUPPORT_MOVE = 0x0BA0 + VehiclePropertyGroup.SYSTEM + VehicleArea.SEAT + VehiclePropertyType.INT32, @@ -2673,6 +2853,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE + * @access VehiclePropertyAccess.READ */ SEAT_LUMBAR_VERTICAL_POS = 0x0BA1 + VehiclePropertyGroup.SYSTEM + VehicleArea.SEAT + VehiclePropertyType.INT32, @@ -2698,6 +2879,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE + * @access VehiclePropertyAccess.READ */ SEAT_LUMBAR_VERTICAL_MOVE = 0x0BA2 + VehiclePropertyGroup.SYSTEM + VehicleArea.SEAT + VehiclePropertyType.INT32, @@ -2723,9 +2905,28 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE + * @access VehiclePropertyAccess.READ */ SEAT_WALK_IN_POS = 0x0BA3 + VehiclePropertyGroup.SYSTEM + VehicleArea.SEAT + VehiclePropertyType.INT32, + /** + * Seat belt pretensioner deployed. + * + * Property to relay information on whether the seat belt pretensioner has been deployed for a + * particular seat due to a collision. This is different from the regular seat belt tightening + * system that continuously adds tension to the seat belts so that they fit snugly around the + * person sitting in the seat, nor is it the seat belt retractor system that locks the seat belt + * in place during sudden brakes or when the user jerks the seat belt. + * + * If this property is dependant on the state of other properties, and those properties are + * currently in the state that doesn't support this property, this should return + * StatusCode#NOT_AVAILABLE + * + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ + */ + SEAT_BELT_PRETENSIONER_DEPLOYED = + 0x0BA6 + VehiclePropertyGroup.SYSTEM + VehicleArea.SEAT + VehiclePropertyType.BOOLEAN, /** * Seat Occupancy * @@ -2770,6 +2971,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE + * @access VehiclePropertyAccess.READ */ WINDOW_POS = 0x0BC0 + 0x10000000 + 0x03000000 + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:WINDOW,VehiclePropertyType:INT32 @@ -2811,6 +3013,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE + * @access VehiclePropertyAccess.READ */ WINDOW_MOVE = 0x0BC1 + 0x10000000 + 0x03000000 + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:WINDOW,VehiclePropertyType:INT32 @@ -2824,6 +3027,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE + * @access VehiclePropertyAccess.READ */ WINDOW_LOCK = 0x0BC4 + 0x10000000 + 0x03000000 + 0x00200000, // VehiclePropertyGroup:SYSTEM,VehicleArea:WINDOW,VehiclePropertyType:BOOLEAN @@ -2889,6 +3093,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE + * @access VehiclePropertyAccess.READ * @data_enum WindshieldWipersSwitch */ WINDSHIELD_WIPERS_SWITCH = @@ -2915,6 +3120,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE + * @access VehiclePropertyAccess.READ */ STEERING_WHEEL_DEPTH_POS = 0x0BE0 + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.INT32, @@ -2940,6 +3146,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE + * @access VehiclePropertyAccess.READ */ STEERING_WHEEL_DEPTH_MOVE = 0x0BE1 + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.INT32, @@ -2962,6 +3169,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE + * @access VehiclePropertyAccess.READ */ STEERING_WHEEL_HEIGHT_POS = 0x0BE2 + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.INT32, @@ -2987,6 +3195,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE + * @access VehiclePropertyAccess.READ */ STEERING_WHEEL_HEIGHT_MOVE = 0x0BE3 + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.INT32, @@ -3001,6 +3210,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE + * @access VehiclePropertyAccess.READ */ STEERING_WHEEL_THEFT_LOCK_ENABLED = 0x0BE4 + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.BOOLEAN, @@ -3014,6 +3224,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE + * @access VehiclePropertyAccess.READ */ STEERING_WHEEL_LOCKED = 0x0BE5 + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.BOOLEAN, @@ -3028,6 +3239,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE + * @access VehiclePropertyAccess.READ */ STEERING_WHEEL_EASY_ACCESS_ENABLED = 0x0BE6 + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.BOOLEAN, @@ -3054,6 +3266,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE + * @access VehiclePropertyAccess.READ */ GLOVE_BOX_DOOR_POS = 0x0BF0 + VehiclePropertyGroup.SYSTEM + VehicleArea.SEAT + VehiclePropertyType.INT32, @@ -3072,6 +3285,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE + * @access VehiclePropertyAccess.READ */ GLOVE_BOX_LOCKED = 0x0BF1 + VehiclePropertyGroup.SYSTEM + VehicleArea.SEAT + VehiclePropertyType.BOOLEAN, @@ -3113,6 +3327,151 @@ enum VehicleProperty { */ LOCATION_CHARACTERIZATION = 0x0C10 + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.INT32, + + /** + * Static data for the position of each ultrasonic sensor installed on the vehicle. + * + * Each individual sensor is identified by its unique VehicleAreaConfig#areaId and returns the + * sensor's position formatted as [x, y, z] where: + * + * int32Values[0] = x, the position of the sensor along the x-axis relative to the origin of + * the Android Automotive sensor coordinate frame in millimeters + * int32Values[1] = y, the position of the sensor along the y-axis relative to the origin of + * the Android Automotive sensor coordinate frame in millimeters. + * int32Values[2] = z, the position of the sensor along the z-axis relative to the origin of + * the Android Automotive sensor coordinate frame in millimeters. + * + * If the data is aggregated by another ECU, then OEMs have the option of reporting the same + * reading across all included sensors or reporting a virtual representation of all the included + * sensors as if they were one sensor. + * + * @change_mode VehiclePropertyChangeMode.STATIC + * @access VehiclePropertyAccess.READ + */ + ULTRASONICS_SENSOR_POSITION = 0x0C20 + VehiclePropertyGroup.SYSTEM + VehicleArea.VENDOR + + VehiclePropertyType.INT32_VEC, + + /** + * Static data for the orientation of each ultrasonic sensor installed on the vehicle. + * + * Each individual sensor is identified by its VehicleAreaConfig#areaId and returns the sensor's + * orientation formatted as [qw, qx, qy, qz] where: + * + * int32Values[0] = qw, the quaternion coefficient w within the quaterinion (w + xi + yj + + * zk) describing the rotation of the sensor relative to the Android + * Automotive sensor coordinate frame. + * int32Values[1] = qx, the quaternion coefficient x within the quaterinion (w + xi + yj + + * zk) describing the rotation of the sensor relative to the Android + * Automotive sensor coordinate frame. + * int32Values[2] = qy, the quaternion coefficient y within the quaterinion (w + xi + yj + + * zk) describing the rotation of the sensor relative to the Android + * Automotive sensor coordinate frame. + * int32Values[3] = qz, the quaternion coefficient z within the quaterinion (w + xi + yj + + * zk) describing the rotation of the sensor relative to the Android + * Automotive sensor coordinate frame. + * + * This assumes each sensor uses the same axes conventions as Android Automotive. + * + * If the data is aggregated by another ECU, then OEMs have the option of reporting the same + * reading across all included sensors or reporting a virtual representation of all the included + * sensors as if they were one sensor. + * + * @change_mode VehiclePropertyChangeMode.STATIC + * @access VehiclePropertyAccess.READ + */ + ULTRASONICS_SENSOR_ORIENTATION = 0x0C21 + VehiclePropertyGroup.SYSTEM + VehicleArea.VENDOR + + VehiclePropertyType.INT32_VEC, + + /** + * Static data for the field of view of each ultrasonic sensor in degrees. + * + * Each individual sensor is identified by its VehicleAreaConfig#areaId and returns the sensor's + * field of view formatted as [horizontal, vertical] where: + * + * int32Values[0] = horizontal, the horizontal field of view for the specified ultrasonic + * sensor in degrees. + * int32Values[1] = vertical, the vertical field of view for the associated specified + * ultrasonic sensor in degrees. + * + * This assumes each sensor uses the same axes conventions as Android Automotive. + * + * If the data is aggregated by another ECU, then OEMs have the option of reporting the same + * reading across all included sensors or reporting a virtual representation of all the included + * sensors as if they were one sensor. + * + * @change_mode VehiclePropertyChangeMode.STATIC + * @access VehiclePropertyAccess.READ + */ + ULTRASONICS_SENSOR_FIELD_OF_VIEW = 0x0C22 + VehiclePropertyGroup.SYSTEM + VehicleArea.VENDOR + + VehiclePropertyType.INT32_VEC, + + /** + * Static data for the detection range of each ultrasonic sensor in millimeters. + * + * Each individual sensor is identified by its VehicleAreaConfig#areaId and returns the sensor's + * detection range formatted as [minimum, maximum] where: + * + * int32Values[0] = minimum, the minimum range detectable by the ultrasonic sensor in + * millimeters. + * int32Values[1] = maximum, the maximum range detectable by the ultrasonic sensor in + * millimeters. + * + * If the data is aggregated by another ECU, then OEMs have the option of reporting the same + * reading across all included sensors or reporting a virtual representation of all the included + * sensors as if they were one sensor. + * + * @change_mode VehiclePropertyChangeMode.STATIC + * @access VehiclePropertyAccess.READ + */ + ULTRASONICS_SENSOR_DETECTION_RANGE = 0x0C23 + VehiclePropertyGroup.SYSTEM + VehicleArea.VENDOR + + VehiclePropertyType.INT32_VEC, + + /** + * Static data for the supported ranges of each ultrasonic sensor in millimeters. + * + * For ultrasonic sensors that only support readings within a specific range. For example, if + * an ultrasonic sensor detects an object at 700mm, but can only report that an object has been + * detected between 500mm and 1000mm. + * + * Each individual sensor is identified by its VehicleAreaConfig#areaId and returns the sensor's + * supported ranges formatted as [range_min_1, range_max_1, range_min_2, range_max_2, ...] + * where: + * + * int32Values[0] = range_min_1, the minimum of one supported range by the specified sensor + * in millimeters, inclusive. + * int32Values[1] = range_max_1, the maximum of one supported range by the specified sensor + * in millimeters, inclusive. + * int32Values[2] = range_min_2, the minimum of another supported range by the specified + * sensor in millimeters, inclusive. + * int32Values[3] = range_max_2, the maximum of another supported range by the specified + sensor in millimeters, inclusive. + * + * Example: + * - Ultrasonic sensor supports the following ranges: + * - 150mm to 499mm + * - 500mm to 999mm + * - 1000mm to 1500mm + * - The associated supported ranges should be formatted as: + * - int32Values[0] = 150 + * - int32Values[1] = 499 + * - int32Values[2] = 500 + * - int32Values[3] = 999 + * - int32Values[4] = 1000 + * - int32Values[5] = 1500 + * + * If this property is not defined, all the values within the ULTRASONICS_SENSOR_DETECTION_RANGE + * for the specified sensor are assumed to be supported. + * + * If the data is aggregated by another ECU, then OEMs have the option of reporting the same + * reading across all included sensors or reporting a virtual representation of all the included + * sensors as if they were one sensor. + * + * @change_mode VehiclePropertyChangeMode.STATIC + * @access VehiclePropertyAccess.READ + */ + ULTRASONICS_SENSOR_SUPPORTED_RANGES = 0x0C24 + VehiclePropertyGroup.SYSTEM + VehicleArea.VENDOR + + VehiclePropertyType.INT32_VEC, + /** * OBD2 Live Sensor Data * @@ -3291,6 +3650,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE + * @access VehiclePropertyAccess.READ * @data_enum VehicleLightSwitch */ HEADLIGHTS_SWITCH = 0x0E10 + 0x10000000 + 0x01000000 @@ -3305,6 +3665,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE + * @access VehiclePropertyAccess.READ * @data_enum VehicleLightSwitch */ HIGH_BEAM_LIGHTS_SWITCH = 0x0E11 + 0x10000000 + 0x01000000 @@ -3335,6 +3696,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE + * @access VehiclePropertyAccess.READ * @data_enum VehicleLightSwitch */ FOG_LIGHTS_SWITCH = 0x0E12 + 0x10000000 + 0x01000000 @@ -3349,6 +3711,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE + * @access VehiclePropertyAccess.READ * @data_enum VehicleLightSwitch */ HAZARD_LIGHTS_SWITCH = 0x0E13 + 0x10000000 + 0x01000000 @@ -3377,6 +3740,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE + * @access VehiclePropertyAccess.READ * @data_enum VehicleLightSwitch */ CABIN_LIGHTS_SWITCH = 0x0F02 + 0x10000000 + 0x01000000 @@ -3405,6 +3769,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE + * @access VehiclePropertyAccess.READ * @data_enum VehicleLightSwitch */ READING_LIGHTS_SWITCH = 0x0F04 + 0x10000000 + 0x05000000 @@ -3450,6 +3815,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE + * @access VehiclePropertyAccess.READ * @data_enum VehicleLightSwitch */ STEERING_WHEEL_LIGHTS_SWITCH = @@ -4119,6 +4485,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE + * @access VehiclePropertyAccess.READ * @data_enum VehicleLightSwitch */ FRONT_FOG_LIGHTS_SWITCH = 0x0F3C + 0x10000000 + 0x01000000 @@ -4150,6 +4517,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE + * @access VehiclePropertyAccess.READ * @data_enum VehicleLightSwitch */ REAR_FOG_LIGHTS_SWITCH = 0x0F3E + 0x10000000 + 0x01000000 @@ -4166,6 +4534,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE + * @access VehiclePropertyAccess.READ * @unit VehicleUnit:AMPERE */ EV_CHARGE_CURRENT_DRAW_LIMIT = 0x0F3F + 0x10000000 + 0x01000000 @@ -4187,6 +4556,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE + * @access VehiclePropertyAccess.READ */ EV_CHARGE_PERCENT_LIMIT = 0x0F40 + 0x10000000 + 0x01000000 + 0x00600000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:FLOAT @@ -4214,6 +4584,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE + * @access VehiclePropertyAccess.READ */ EV_CHARGE_SWITCH = 0x0F42 + 0x10000000 + 0x01000000 + 0x00200000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:BOOLEAN @@ -4375,12 +4746,49 @@ enum VehicleProperty { * powers on the vehicle. VEHICLE_IN_USE is set to true. After a driving session, user powers * off the vehicle, VEHICLE_IN_USE is set to false. * + *

      This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to + * implement it as VehiclePropertyAccess.READ only. + * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE + * @access VehiclePropertyAccess.READ */ VEHICLE_IN_USE = 0x0F4A + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.BOOLEAN, + /** + * Sends the heartbeat signal to ClusterOS. + * + * int64[0]: epochTimeNs + * int64[1]: the visibility of ClusterUI, 0 - invisible, 1 - visible + * bytes: the app specific metadata, this can be empty when ClusterHomeService use the heartbeat + * to deliver the change of the visibility. + * + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.WRITE + */ + CLUSTER_HEARTBEAT = + 0x0F4B + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.MIXED, + + /** + * Current state of vehicle autonomy. + * + * Defines the level of autonomy currently engaged in the vehicle from the J3016_202104 revision + * of the SAE standard levels 0-5, with 0 representing no autonomy and 5 representing full + * driving automation. These levels should be used in accordance with the standards defined in + * https://www.sae.org/standards/content/j3016_202104/ and + * https://www.sae.org/blog/sae-j3016-update + * + * For the global area ID (0), the VehicleAreaConfig#supportedEnumValues array must be defined + * unless all states of VehicleAutonomousState are supported. + * + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ + * @data_enum VehicleAutonomousState + */ + VEHICLE_DRIVING_AUTOMATION_CURRENT_LEVEL = + 0x0F4C + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.INT32, + /*********************************************************************************************** * Start of ADAS Properties * @@ -4403,6 +4811,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE + * @access VehiclePropertyAccess.READ */ AUTOMATIC_EMERGENCY_BRAKING_ENABLED = 0x1000 + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.BOOLEAN, @@ -4445,6 +4854,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE + * @access VehiclePropertyAccess.READ */ FORWARD_COLLISION_WARNING_ENABLED = 0x1002 + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.BOOLEAN, @@ -4484,6 +4894,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE + * @access VehiclePropertyAccess.READ */ BLIND_SPOT_WARNING_ENABLED = 0x1004 + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.BOOLEAN, @@ -4524,6 +4935,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE + * @access VehiclePropertyAccess.READ */ LANE_DEPARTURE_WARNING_ENABLED = 0x1006 + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.BOOLEAN, @@ -4568,6 +4980,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE + * @access VehiclePropertyAccess.READ */ LANE_KEEP_ASSIST_ENABLED = 0x1008 + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.BOOLEAN, @@ -4616,6 +5029,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE + * @access VehiclePropertyAccess.READ */ LANE_CENTERING_ASSIST_ENABLED = 0x100A + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.BOOLEAN, @@ -4690,6 +5104,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE + * @access VehiclePropertyAccess.READ */ EMERGENCY_LANE_KEEP_ASSIST_ENABLED = 0x100D + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.BOOLEAN, @@ -4733,6 +5148,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE + * @access VehiclePropertyAccess.READ */ CRUISE_CONTROL_ENABLED = 0x100F + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.BOOLEAN, @@ -4758,6 +5174,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE + * @access VehiclePropertyAccess.READ * @data_enum CruiseControlType * @data_enum ErrorState */ @@ -4855,6 +5272,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE + * @access VehiclePropertyAccess.READ * @unit VehicleUnit:MILLI_SECS */ ADAPTIVE_CRUISE_CONTROL_TARGET_TIME_GAP = @@ -4906,6 +5324,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE + * @access VehiclePropertyAccess.READ */ HANDS_ON_DETECTION_ENABLED = 0x1016 + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.BOOLEAN, @@ -4956,6 +5375,277 @@ enum VehicleProperty { HANDS_ON_DETECTION_WARNING = 0x1018 + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.INT32, + /** + * Enable or disable driver drowsiness and attention monitoring. + * + * Set true to enable driver drowsiness and attention monitoring and false to disable driver + * drowsiness and attention monitoring. When driver drowsiness and attention monitoring is + * enabled, a system inside the vehicle should be monitoring the drowsiness and attention level + * of the driver and warn the driver if needed. + * + * In general, DRIVER_DROWSINESS_ATTENTION_SYSTEM_ENABLED should always return true or false. + * If the feature is not available due to some temporary state, that information must be + * conveyed through the ErrorState values in the DRIVER_DROWSINESS_ATTENTION_STATE property. + * + * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to + * implement it as VehiclePropertyAccess.READ only. + * + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ_WRITE + * @access VehiclePropertyAccess.READ + */ + DRIVER_DROWSINESS_ATTENTION_SYSTEM_ENABLED = + 0x1019 + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.BOOLEAN, + + /** + * Driver drowsiness and attention level state. + * + * Returns the current detected state of driver drowiness and attention level based on the + * Karolinska Sleepiness scale. If alternative measurement methods are used, the value should be + * translated to the Karolinska Sleepiness Scale equivalent. + * + * Generally, this property should return a valid state defined in the + * DriverDrowsinessAttentionState or ErrorState. For example, if the feature is not available + * due to some temporary state, that information should be conveyed through ErrorState. + * + * If the vehicle is sending a warning to the user because the driver is too drowsy, the warning + * should be surfaced through {@link #DRIVER_DROWSINESS_ATTENTION_WARNING}. + * + * For the global area ID (0), the VehicleAreaConfig#supportedEnumValues array must be defined + * unless all states of both DriverDrowsinessAttentionState (including OTHER, which is not + * recommended) and ErrorState are supported. + * + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ + * @data_enum DriverDrowsinessAttentionState + * @data_enum ErrorState + */ + DRIVER_DROWSINESS_ATTENTION_STATE = + 0x101A + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.INT32, + + /** + * Enable or disable driver drowsiness and attention warnings. + * + * Set true to enable driver drowsiness and attention warnings and false to disable driver + * drowsiness and attention warnings. + * + * When driver drowsiness and attention warnings are enabled, the driver drowsiness and + * attention monitoring system inside the vehicle should warn the driver when it detects the + * driver is drowsy or not attentive. + * + * In general, DRIVER_DROWSINESS_ATTENTION_WARNING_ENABLED should always return true or false. + * If the feature is not available due to some temporary state, that information must be + * conveyed through the ErrorState values in the DRIVER_DROWSINESS_ATTENTION_WARNING property. + * + * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to + * implement it as VehiclePropertyAccess.READ only. + * + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ_WRITE + * @access VehiclePropertyAccess.READ + */ + DRIVER_DROWSINESS_ATTENTION_WARNING_ENABLED = + 0x101B + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.BOOLEAN, + + /** + * Driver drowsiness and attention warning. + * + * Returns whether a warning is being sent to the driver for being drowsy or not attentive. + * + * Generally, this property should return a valid state defined in + * DriverDrowsinessAttentionWarning or ErrorState. For example, if the feature is not available + * due to some temporary state, that information should be conveyed through an ErrorState. + * + * For the global area ID (0), the VehicleAreaConfig#supportedEnumValues array must be defined + * unless all states of both DriverDrowsinessAttentionWarning (including OTHER, which is not + * recommended) and ErrorState are supported. + * + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ + * @data_enum DriverDrowsinessAttentionWarning + * @data_enum ErrorState + */ + DRIVER_DROWSINESS_ATTENTION_WARNING = + 0x101C + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.INT32, + + /** + * Enable or disable driver distraction monitoring. + * + * Set true to enable driver distraction monitoring and false to disable driver + * distraction monitoring. When driver distraction monitoring is enabled, a system + * inside the vehicle should be monitoring the distraction level of the driver and + * warn the driver if needed. + * + * In general, DRIVER_DISTRACTION_SYSTEM_ENABLED should always return true or false. If the + * feature is not available due to some temporary state, that information must be conveyed + * through the ErrorState values in the DRIVER_DISTRACTION_STATE property. + * + * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to + * implement it as VehiclePropertyAccess.READ only. + * + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ_WRITE + * @access VehiclePropertyAccess.READ + */ + DRIVER_DISTRACTION_SYSTEM_ENABLED = + 0x101D + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.BOOLEAN, + + /** + * Driver distraction state. + * + * Returns the current detected driver distraction state. + * + * Generally, this property should return a valid state defined in the DriverDistractionState or + * ErrorState. For example, if the feature is not available due to some temporary state, that + * information should be conveyed through ErrorState. + * + * If the vehicle is sending a warning to the user because the driver is too distracted, the + * warning should be surfaced through {@link #DRIVER_DISTRACTION_WARNING}. + * + * For the global area ID (0), the VehicleAreaConfig#supportedEnumValues array must be defined + * unless all states of both DriverDistractionState (including OTHER, which is not + * recommended) and ErrorState are supported. + * + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ + * @data_enum DriverDistractionState + * @data_enum ErrorState + */ + DRIVER_DISTRACTION_STATE = + 0x101E + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.INT32, + + /** + * Enable or disable driver distraction warnings. + * + * Set true to enable driver distraction warnings and false to disable driver distraction + * warnings. + * + * When driver distraction warnings are enabled, the driver distraction monitoring system inside + * the vehicle should warn the driver when it detects the driver is distracted. + * + * In general, DRIVER_DISTRACTION_WARNING_ENABLED should always return true or false. If the + * feature is not available due to some temporary state, that information must be conveyed + * through the ErrorState values in the DRIVER_DISTRACTION_WARNING property. + * + * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to + * implement it as VehiclePropertyAccess.READ only. + * + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ_WRITE + * @access VehiclePropertyAccess.READ + */ + DRIVER_DISTRACTION_WARNING_ENABLED = + 0x101F + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.BOOLEAN, + + /** + * Driver distraction warning. + * + * Returns whether a warning is being sent to the driver for being distracted. + * + * Generally, this property should return a valid state defined in DriverDistractionWarning or + * ErrorState. For example, if the feature is not available due to some temporary state, that + * information should be conveyed through an ErrorState. + * + * For the global area ID (0), the VehicleAreaConfig#supportedEnumValues array must be defined + * unless all states of both DriverDistractionWarning (including OTHER, which is not + * recommended) and ErrorState are supported. + * + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ + * @data_enum DriverDistractionWarning + * @data_enum ErrorState + */ + DRIVER_DISTRACTION_WARNING = + 0x1020 + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.INT32, + + /** + * Enable or disable Low Speed Collision Warning. + * + * Set true to enable low speed collision warning and false to disable low speed collision + * warning. When low speed collision warning is enabled, the ADAS system in the vehicle should + * warn the driver of potential collisions at low speeds. This property is different from the + * pre-existing FORWARD_COLLISION_WARNING_ENABLED, which should apply to higher speed + * applications only. If the vehicle doesn't have a separate collision detection system for low + * speed environments, this property should not be implemented. + * + * In general, LOW_SPEED_COLLISION_WARNING_ENABLED should always return true or false. If the + * feature is not available due to some temporary state, such as the vehicle speed being too + * high, that information must be conveyed through the ErrorState values in the + * LOW_SPEED_COLLISION_WARNING_STATE property. + * + * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to + * implement it as VehiclePropertyAccess.READ only. + * + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ_WRITE + * @access VehiclePropertyAccess.READ + */ + LOW_SPEED_COLLISION_WARNING_ENABLED = + 0x1021 + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.BOOLEAN, + + /** + * Low Speed Collision Warning state. + * + * Returns the current state of Low Speed Collision Warning. This property must always return a + * valid state defined in LowSpeedCollisionWarningState or ErrorState. It must not surface + * errors through StatusCode and must use the supported error states instead. This property is + * different from the pre-existing FORWARD_COLLISION_WARNING_STATE, which should apply to higher + * speed applications only. If the vehicle doesn't have a separate collision detection system + * for low speed environments, this property should not be implemented. + * + * For the global area ID (0), the VehicleAreaConfig#supportedEnumValues array must be defined + * unless all states of both LowSpeedCollisionWarningState (including OTHER, which is not + * recommended) and ErrorState are supported. + * + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ + * @data_enum LowSpeedCollisionWarningState + * @data_enum ErrorState + */ + LOW_SPEED_COLLISION_WARNING_STATE = + 0x1022 + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.INT32, + + /** + * Enable or disable Cross Traffic Monitoring. + * + * Set true to enable Cross Traffic Monitoring and false to disable Cross Traffic Monitoring. + * When Cross Traffic Monitoring is enabled, the ADAS system in the vehicle should be turned on + * and monitoring for potential sideways collisions. + * + * In general, CROSS_TRAFFIC_MONITORING_ENABLED should always return true or false. If the + * feature is not available due to some temporary state, such as the vehicle speed being too + * high, that information must be conveyed through the ErrorState values in the + * CROSS_TRAFFIC_MONITORING_STATE property. + * + * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to + * implement it as VehiclePropertyAccess.READ only. + * + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ_WRITE + * @access VehiclePropertyAccess.READ + */ + CROSS_TRAFFIC_MONITORING_ENABLED = + 0x1023 + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.BOOLEAN, + + /** + * Cross Traffic Monitoring warning state. + * + * Returns the current state of Cross Traffic Monitoring Warning. This property must always + * return a valid state defined in CrossTrafficMonitoringWarningState or ErrorState. It must not + * surface errors through StatusCode and must use the supported error states instead. + * + * For the global area ID (0), the VehicleAreaConfig#supportedEnumValues array must be defined + * unless all states of both CrossTrafficMonitoringWarningState (including OTHER, which is not + * recommended) and ErrorState are supported. + * + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ + * @data_enum CrossTrafficMonitoringWarningState + * @data_enum ErrorState + */ + CROSS_TRAFFIC_MONITORING_WARNING_STATE = + 0x1024 + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.INT32, + /*************************************************************************** * End of ADAS Properties **************************************************************************/ diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehiclePropertyGroup.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehiclePropertyGroup.aidl index a2cbdec5e8b9ea56055ac19181d82a28876b0d39..a4173889299bef6765b96cdc357c3a39962df6a2 100644 --- a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehiclePropertyGroup.aidl +++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehiclePropertyGroup.aidl @@ -29,5 +29,34 @@ enum VehiclePropertyGroup { */ VENDOR = 0x20000000, + /** + * Group reserved for backporting system properties introduced in a newer Android + * release to an older Android release. + * + * It is recommended to map the system property ID to a backported property ID by replacing the + * VehiclePropertyGroup, e.g. backported PERF_VEHICLE_SPEED(0x11600207) would be 0x31600207. + * + * When updated to a newer Android release where the property is defined as system properties, + * the backported properties must be migrated to system properties. + * + * In Android system, the backported property is treated the same as a vendor defined property + * with the same vendor permission model, a.k.a. Default required permission is + * `android.car.Car.PERMISSION_VENDOR_EXTENSION`, or customized by + * `SUPPORT_CUSTOMIZE_VENDOR_PERMISSION` VHAL property. + * + * Only applications with vendor permissions may access these backported properties. + * + * Vendors must also make sure this property's behavior is consistent with what is expected for + * the backported system property, e.g. the access mode, the change mode and the config array + * must be correct. + * + * When vendors define custom properties, they must use {@code VENDOR} flag, instead of + * {@code BACKPORTED} + */ + BACKPORTED = 0x30000000, + + /** + * The bit mask for {@code VehiclePropertyGroup}. This is not a group by itself. + */ MASK = 0xf0000000, } diff --git a/automotive/vehicle/tools/generate_annotation_enums.py b/automotive/vehicle/tools/generate_annotation_enums.py old mode 100644 new mode 100755 index c36cbb015e3547d63df4b448aa99572e83986f5c..05fc99a23199d1623b16525cd7c2b02f99fc0fba --- a/automotive/vehicle/tools/generate_annotation_enums.py +++ b/automotive/vehicle/tools/generate_annotation_enums.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/python3 # Copyright (C) 2022 The Android Open Source Project # @@ -18,37 +18,45 @@ Need ANDROID_BUILD_TOP environmental variable to be set. This script will update ChangeModeForVehicleProperty.h and AccessForVehicleProperty.h under generated_lib/cpp and - ChangeModeForVehicleProperty.java and AccessForVehicleProperty.java under generated_lib/java. + ChangeModeForVehicleProperty.java, AccessForVehicleProperty.java, EnumForVehicleProperty.java under generated_lib/java. Usage: $ python generate_annotation_enums.py """ +import argparse +import filecmp import os import re import sys - -PROP_AIDL_FILE_PATH = ("hardware/interfaces/automotive/vehicle/aidl_property/android/hardware/" + - "automotive/vehicle/VehicleProperty.aidl") -CHANGE_MODE_CPP_FILE_PATH = ("hardware/interfaces/automotive/vehicle/aidl/generated_lib/cpp/" + - "ChangeModeForVehicleProperty.h") -ACCESS_CPP_FILE_PATH = ("hardware/interfaces/automotive/vehicle/aidl/generated_lib/cpp/" + - "AccessForVehicleProperty.h") -CHANGE_MODE_JAVA_FILE_PATH = ("hardware/interfaces/automotive/vehicle/aidl/generated_lib/java/" + - "ChangeModeForVehicleProperty.java") -ACCESS_JAVA_FILE_PATH = ("hardware/interfaces/automotive/vehicle/aidl/generated_lib/java/" + - "AccessForVehicleProperty.java") - -TAB = " " -RE_ENUM_START = re.compile("\s*enum VehicleProperty \{") -RE_ENUM_END = re.compile("\s*\}\;") -RE_COMMENT_BEGIN = re.compile("\s*\/\*\*?") -RE_COMMENT_END = re.compile("\s*\*\/") -RE_CHANGE_MODE = re.compile("\s*\* @change_mode (\S+)\s*") -RE_ACCESS = re.compile("\s*\* @access (\S+)\s*") -RE_VALUE = re.compile("\s*(\w+)\s*=(.*)") +import tempfile + +PROP_AIDL_FILE_PATH = ('hardware/interfaces/automotive/vehicle/aidl_property/android/hardware/' + + 'automotive/vehicle/VehicleProperty.aidl') +CHANGE_MODE_CPP_FILE_PATH = ('hardware/interfaces/automotive/vehicle/aidl/generated_lib/cpp/' + + 'ChangeModeForVehicleProperty.h') +ACCESS_CPP_FILE_PATH = ('hardware/interfaces/automotive/vehicle/aidl/generated_lib/cpp/' + + 'AccessForVehicleProperty.h') +CHANGE_MODE_JAVA_FILE_PATH = ('hardware/interfaces/automotive/vehicle/aidl/generated_lib/java/' + + 'ChangeModeForVehicleProperty.java') +ACCESS_JAVA_FILE_PATH = ('hardware/interfaces/automotive/vehicle/aidl/generated_lib/java/' + + 'AccessForVehicleProperty.java') +ENUM_JAVA_FILE_PATH = ('hardware/interfaces/automotive/vehicle/aidl/generated_lib/java/' + + 'EnumForVehicleProperty.java') +SCRIPT_PATH = 'hardware/interfaces/automotive/vehicle/tools/generate_annotation_enums.py' + +TAB = ' ' +RE_ENUM_START = re.compile('\s*enum VehicleProperty \{') +RE_ENUM_END = re.compile('\s*\}\;') +RE_COMMENT_BEGIN = re.compile('\s*\/\*\*?') +RE_COMMENT_END = re.compile('\s*\*\/') +RE_CHANGE_MODE = re.compile('\s*\* @change_mode (\S+)\s*') +RE_ACCESS = re.compile('\s*\* @access (\S+)\s*') +RE_DATA_ENUM = re.compile('\s*\* @data_enum (\S+)\s*') +RE_UNIT = re.compile('\s*\* @unit (\S+)\s+') +RE_VALUE = re.compile('\s*(\w+)\s*=(.*)') LICENSE = """/* - * Copyright (C) 2022 The Android Open Source Project + * Copyright (C) 2023 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -161,57 +169,145 @@ ACCESS_JAVA_FOOTER = """ } """ +ENUM_JAVA_HEADER = """package android.hardware.automotive.vehicle; + +import java.util.List; +import java.util.Map; + +public final class EnumForVehicleProperty { + + public static final Map>> values = Map.ofEntries( +""" + +ENUM_JAVA_FOOTER = """ + ); + +} +""" + + +class PropertyConfig: + """Represents one VHAL property definition in VehicleProperty.aidl.""" + + def __init__(self): + self.name = None + self.description = None + self.change_mode = None + self.access_modes = [] + self.enum_types = [] + self.unit_type = None + + def __repr__(self): + return self.__str__() + + def __str__(self): + return ('PropertyConfig{{' + + 'name: {}, description: {}, change_mode: {}, access_modes: {}, enum_types: {}' + + ', unit_type: {}}}').format(self.name, self.description, self.change_mode, + self.access_modes, self.enum_types, self.unit_type) -class Converter: - def __init__(self, name, annotation_re): - self.name = name - self.annotation_re = annotation_re +class FileParser: - def convert(self, input, output, header, footer, cpp): + def __init__(self): + self.configs = None + + def parseFile(self, input_file): + """Parses the input VehicleProperty.aidl file into a list of property configs.""" processing = False in_comment = False - content = LICENSE + header - annotation = None - id = 0 - with open(input, 'r') as f: + configs = [] + config = None + with open(input_file, 'r') as f: for line in f.readlines(): if RE_ENUM_START.match(line): processing = True - annotation = None elif RE_ENUM_END.match(line): processing = False if not processing: continue if RE_COMMENT_BEGIN.match(line): in_comment = True + config = PropertyConfig() + description = '' if RE_COMMENT_END.match(line): in_comment = False if in_comment: - match = self.annotation_re.match(line) + if not config.description: + sline = line.strip() + # Skip the first line of comment + if sline.startswith('*'): + # Remove the '*'. + sline = sline[1:].strip() + # We reach an empty line of comment, the description part is ending. + if sline == '': + config.description = description + else: + if description != '': + description += ' ' + description += sline + match = RE_CHANGE_MODE.match(line) + if match: + config.change_mode = match.group(1).replace('VehiclePropertyChangeMode.', '') + match = RE_ACCESS.match(line) + if match: + config.access_modes.append(match.group(1).replace('VehiclePropertyAccess.', '')) + match = RE_UNIT.match(line) if match: - annotation = match.group(1) + config.unit_type = match.group(1) + match = RE_DATA_ENUM.match(line) + if match: + config.enum_types.append(match.group(1)) else: match = RE_VALUE.match(line) if match: prop_name = match.group(1) - if prop_name == "INVALID": + if prop_name == 'INVALID': continue - if not annotation: - print("No @" + self.name + " annotation for property: " + prop_name) - sys.exit(1) - if id != 0: - content += "\n" - if cpp: - annotation = annotation.replace(".", "::") - content += (TAB + TAB + "{VehicleProperty::" + prop_name + ", " + - annotation + "},") - else: - content += (TAB + TAB + "Map.entry(VehicleProperty." + prop_name + ", " + - annotation + "),") - id += 1 - - # Remove the additional "," at the end for the Java file. + if not config.change_mode: + raise Exception( + 'No change_mode annotation for property: ' + prop_name) + if not config.access_modes: + raise Exception( + 'No access_mode annotation for property: ' + prop_name) + config.name = prop_name + configs.append(config) + + self.configs = configs + + def convert(self, output, header, footer, cpp, field): + """Converts the property config file to C++/Java output file.""" + counter = 0 + content = LICENSE + header + for config in self.configs: + if field == 'change_mode': + if cpp: + annotation = "VehiclePropertyChangeMode::" + config.change_mode + else: + annotation = "VehiclePropertyChangeMode." + config.change_mode + elif field == 'access_mode': + if cpp: + annotation = "VehiclePropertyAccess::" + config.access_modes[0] + else: + annotation = "VehiclePropertyAccess." + config.access_modes[0] + elif field == 'enum_types': + if len(config.enum_types) < 1: + continue; + if not cpp: + annotation = "List.of(" + ', '.join([class_name + ".class" for class_name in config.enum_types]) + ")" + else: + raise Exception('Unknown field: ' + field) + if counter != 0: + content += '\n' + if cpp: + content += (TAB + TAB + '{VehicleProperty::' + config.name + ', ' + + annotation + '},') + else: + content += (TAB + TAB + 'Map.entry(VehicleProperty.' + config.name + ', ' + + annotation + '),') + counter += 1 + + # Remove the additional ',' at the end for the Java file. if not cpp: content = content[:-1] @@ -220,26 +316,125 @@ class Converter: with open(output, 'w') as f: f.write(content) + def outputAsCsv(self, output): + content = 'name,description,change mode,access mode,enum type,unit type\n' + for config in self.configs: + enum_types = None + if not config.enum_types: + enum_types = '/' + else: + enum_types = '/'.join(config.enum_types) + unit_type = config.unit_type + if not unit_type: + unit_type = '/' + access_modes = '' + content += '"{}","{}","{}","{}","{}","{}"\n'.format( + config.name, + # Need to escape quote as double quote. + config.description.replace('"', '""'), + config.change_mode, + '/'.join(config.access_modes), + enum_types, + unit_type) + + with open(output, 'w+') as f: + f.write(content) -def main(): - android_top = os.environ['ANDROID_BUILD_TOP'] - if not android_top: - print("ANDROID_BUILD_TOP is not in envorinmental variable, please run source and lunch " + - "at the android root") - aidl_file = os.path.join(android_top, PROP_AIDL_FILE_PATH) - change_mode_cpp_output = os.path.join(android_top, CHANGE_MODE_CPP_FILE_PATH); - access_cpp_output = os.path.join(android_top, ACCESS_CPP_FILE_PATH); - change_mode_java_output = os.path.join(android_top, CHANGE_MODE_JAVA_FILE_PATH); - access_java_output = os.path.join(android_top, ACCESS_JAVA_FILE_PATH); +def createTempFile(): + f = tempfile.NamedTemporaryFile(delete=False); + f.close(); + return f.name - c = Converter("change_mode", RE_CHANGE_MODE); - c.convert(aidl_file, change_mode_cpp_output, CHANGE_MODE_CPP_HEADER, CHANGE_MODE_CPP_FOOTER, True) - c.convert(aidl_file, change_mode_java_output, CHANGE_MODE_JAVA_HEADER, CHANGE_MODE_JAVA_FOOTER, False) - c = Converter("access", RE_ACCESS) - c.convert(aidl_file, access_cpp_output, ACCESS_CPP_HEADER, ACCESS_CPP_FOOTER, True) - c.convert(aidl_file, access_java_output, ACCESS_JAVA_HEADER, ACCESS_JAVA_FOOTER, False) +def main(): + parser = argparse.ArgumentParser( + description='Generate Java and C++ enums based on annotations in VehicleProperty.aidl') + parser.add_argument('--android_build_top', required=False, help='Path to ANDROID_BUILD_TOP') + parser.add_argument('--preupload_files', nargs='*', required=False, help='modified files') + parser.add_argument('--check_only', required=False, action='store_true', + help='only check whether the generated files need update') + parser.add_argument('--output_csv', required=False, + help='Path to the parsing result in CSV style, useful for doc generation') + args = parser.parse_args(); + android_top = None + output_folder = None + if args.android_build_top: + android_top = args.android_build_top + vehiclePropertyUpdated = False + for preuload_file in args.preupload_files: + if preuload_file.endswith('VehicleProperty.aidl'): + vehiclePropertyUpdated = True + break + if not vehiclePropertyUpdated: + return + else: + android_top = os.environ['ANDROID_BUILD_TOP'] + if not android_top: + print('ANDROID_BUILD_TOP is not in environmental variable, please run source and lunch ' + + 'at the android root') -if __name__ == "__main__": + aidl_file = os.path.join(android_top, PROP_AIDL_FILE_PATH) + f = FileParser(); + f.parseFile(aidl_file) + + if args.output_csv: + f.outputAsCsv(args.output_csv) + return + + change_mode_cpp_file = os.path.join(android_top, CHANGE_MODE_CPP_FILE_PATH); + access_cpp_file = os.path.join(android_top, ACCESS_CPP_FILE_PATH); + change_mode_java_file = os.path.join(android_top, CHANGE_MODE_JAVA_FILE_PATH); + access_java_file = os.path.join(android_top, ACCESS_JAVA_FILE_PATH); + enum_java_file = os.path.join(android_top, ENUM_JAVA_FILE_PATH); + temp_files = [] + + if not args.check_only: + change_mode_cpp_output = change_mode_cpp_file + access_cpp_output = access_cpp_file + change_mode_java_output = change_mode_java_file + access_java_output = access_java_file + enum_java_output = enum_java_file + else: + change_mode_cpp_output = createTempFile() + temp_files.append(change_mode_cpp_output) + access_cpp_output = createTempFile() + temp_files.append(access_cpp_output) + change_mode_java_output = createTempFile() + temp_files.append(change_mode_java_output) + access_java_output = createTempFile() + temp_files.append(access_java_output) + enum_java_output = createTempFile() + temp_files.append(enum_java_output) + + try: + f.convert(change_mode_cpp_output, CHANGE_MODE_CPP_HEADER, CHANGE_MODE_CPP_FOOTER, + True, 'change_mode') + f.convert(change_mode_java_output, CHANGE_MODE_JAVA_HEADER, + CHANGE_MODE_JAVA_FOOTER, False, 'change_mode') + f.convert(access_cpp_output, ACCESS_CPP_HEADER, ACCESS_CPP_FOOTER, True, 'access_mode') + f.convert(access_java_output, ACCESS_JAVA_HEADER, ACCESS_JAVA_FOOTER, False, 'access_mode') + f.convert(enum_java_output, ENUM_JAVA_HEADER, ENUM_JAVA_FOOTER, False, 'enum_types') + + if not args.check_only: + return + + if ((not filecmp.cmp(change_mode_cpp_output, change_mode_cpp_file)) or + (not filecmp.cmp(change_mode_java_output, change_mode_java_file)) or + (not filecmp.cmp(access_cpp_output, access_cpp_file)) or + (not filecmp.cmp(access_java_output, access_java_file)) or + (not filecmp.cmp(enum_java_output, enum_java_file))): + print('The generated enum files for VehicleProperty.aidl requires update, ') + print('Run \npython ' + android_top + '/' + SCRIPT_PATH) + sys.exit(1) + except Exception as e: + print('Error parsing VehicleProperty.aidl') + print(e) + sys.exit(1) + finally: + for file in temp_files: + os.remove(file) + + +if __name__ == '__main__': main() \ No newline at end of file diff --git a/automotive/vehicle/tools/translate_aidl_enums.py b/automotive/vehicle/tools/translate_aidl_enums.py new file mode 100644 index 0000000000000000000000000000000000000000..d224f6fcc12701caf0e4e58228c2f70dd78902e5 --- /dev/null +++ b/automotive/vehicle/tools/translate_aidl_enums.py @@ -0,0 +1,231 @@ +#!/usr/bin/python3 + +# Copyright (C) 2023 The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +"""A script to generate ENUM_NAME.java file and test files using ENUM_NAME.aidl file. + + Need ANDROID_BUILD_TOP environmental variable to be set. This script will update ENUM_NAME.java + under packages/services/Car/car-lib/src/android/car/hardware/property, as well as the + ENUM_NAMETest.java files in cts/tests/tests/car/src/android/car/cts and + packages/services/Car/tests/android_car_api_test/src/android/car/apitest + + Usage: + $ python translate_aidl_enums.py ENUM_NAME.aidl +""" +import os +import sys + +LICENSE = """/* + * Copyright (C) 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +""" + +class EnumParser: + def __init__(self, file_path, file_name): + self.filePath = file_path + self.fileName = file_name + self.lowerFileName = self.fileName[0].lower() + self.fileName[1:] + self.enums = [] + self.outputMsg = [] + self.outputMsg.append(LICENSE) + self.outputMsg.append("\npackage android.car.hardware.property;\n") + self.outputMsg.append(""" +import android.annotation.IntDef; +import android.annotation.NonNull; + +import com.android.car.internal.util.ConstantDebugUtils; + +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +""") + + with open(self.filePath, 'r') as f: + for line in f.readlines()[16:]: + if line in ["package android.hardware.automotive.vehicle;\n", + "@VintfStability\n", + '@Backing(type="int")\n']: + continue + + msg = line + msgSplit = msg.strip().split() + if len(msgSplit) > 0 and msgSplit[0] == "enum": + msgSplit[0] = "public final class" + msg = " ".join(msgSplit) + "\n" + elif len(msgSplit) > 1 and msgSplit[1] == '=': + msgSplit.insert(0, " public static final int") + self.enums.append(msgSplit[1]) + msgSplit[-1] = msgSplit[-1][:-1] + ";\n" + msg = " ".join(msgSplit) + elif msg == "}\n": + self.outputMsg.append(""" + private {2}() {{}} + + /** + * Returns a user-friendly representation of {{@code {2}}}. + */ + @NonNull + public static String toString(@{2}Int int {0}) {{ + String {0}String = ConstantDebugUtils.toName( + {2}.class, {0}); + return ({0}String != null) + ? {0}String + : "0x" + Integer.toHexString({0}); + }} + + /** @hide */ + @IntDef({1}) + @Retention(RetentionPolicy.SOURCE) + public @interface {2}Int {{}}\n""".format(self.lowerFileName, "{" + ", ".join(self.enums) + "}", + self.fileName)) + self.outputMsg.append(msg) + self.outputMsg.append("TODO: delete this line and manually update this file with app-facing documentation and necessary tags.\n") + + self.outputMsgApiTest = [] + self.outputMsgApiTest.append(LICENSE) + self.outputMsgApiTest.append("""package android.car.apitest; + +import static com.google.common.truth.Truth.assertWithMessage; + +import android.test.suitebuilder.annotation.SmallTest; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; + +import java.util.Arrays; +import java.util.Collection; + +@SmallTest +@RunWith(Parameterized.class) +public class {0}Test {{ + private final int mJavaConstantValue; + private final int mHalConstantValue; + + public {0}Test(int javaConstantValue, int halConstantValue) {{ + mJavaConstantValue = javaConstantValue; + mHalConstantValue = halConstantValue; + }} + + @Parameterized.Parameters + public static Collection constantValues() {{ + return Arrays.asList( + new Object[][] {{""".format(self.fileName)) + for enum in self.enums: + self.outputMsgApiTest.append(""" + {{ + android.car.hardware.property.{0}.{1}, + android.hardware.automotive.vehicle.{0}.{1} + }},""".format(self.fileName, enum)) + self.outputMsgApiTest.append(""" + }); + } + + @Test + public void testMatchWithVehicleHal() { + assertWithMessage("Java constant") + .that(mJavaConstantValue) + .isEqualTo(mHalConstantValue); + } +} +""") + + self.outputMsgCtsTest = [] + self.outputMsgCtsTest.append(LICENSE) + self.outputMsgCtsTest.append(""" +package android.car.cts; + +import static com.google.common.truth.Truth.assertThat; +import static com.google.common.truth.Truth.assertWithMessage; + +import android.car.cts.utils.VehiclePropertyUtils; +import android.car.hardware.property.{0}; + +import org.junit.Test; + +import java.util.List; + +public class {0}Test {{ + + @Test + public void testToString() {{""".format(self.fileName)) + for enum in self.enums: + self.outputMsgCtsTest.append(""" + assertThat({0}.toString( + {0}.{1})) + .isEqualTo("{1}");""".format(self.fileName, enum)) + self.outputMsgCtsTest.append(""" + assertThat({0}.toString({1})).isEqualTo("{2}"); + assertThat({0}.toString(12)).isEqualTo("0xc"); + }} + + @Test + public void testAll{0}sAreMappedInToString() {{ + List {3}s = + VehiclePropertyUtils.getIntegersFromDataEnums({0}.class); + for (Integer {3} : {3}s) {{ + String {3}String = {0}.toString( + {3}); + assertWithMessage("%s starts with 0x", {3}String).that( + {3}String.startsWith("0x")).isFalse(); + }} + }} +}} +""".format(self.fileName, len(self.enums), hex(len(self.enums)), self.lowerFileName)) + +def main(): + if len(sys.argv) != 2: + print("Usage: {} enum_aidl_file".format(sys.argv[0])) + sys.exit(1) + print("WARNING: This file only generates the base enum values in the framework layer. The " + + "generated files must be reviewed by you and edited if any additional changes are " + + "required. The java enum file should be updated with app-developer facing " + + "documentation, the @FlaggedApi tag for the new API, and with the @SystemApi tag if " + + "the new property is system API") + file_path = sys.argv[1] + file_name = file_path.split('/')[-1][:-5] + parser = EnumParser(file_path, file_name) + + android_top = os.environ['ANDROID_BUILD_TOP'] + if not android_top: + print('ANDROID_BUILD_TOP is not in environmental variable, please run source and lunch ' + + 'at the android root') + + with open(android_top + "/packages/services/Car/car-lib/src/android/car/hardware/property/" + + file_name + ".java", 'w') as f: + f.write("".join(parser.outputMsg)) + + with open(android_top + + "/packages/services/Car/tests/android_car_api_test/src/android/car/apitest/" + + file_name + "Test.java", 'w') as f: + f.write("".join(parser.outputMsgApiTest)) + + with open(android_top + "/cts/tests/tests/car/src/android/car/cts/" + file_name + "Test.java", + 'w') as f: + f.write("".join(parser.outputMsgCtsTest)) + +if __name__ == "__main__": + main() \ No newline at end of file diff --git a/automotive/vehicle/vhal_static_cpp_lib.mk b/automotive/vehicle/vhal_static_cpp_lib.mk index 995589c47ef5e87b2c116e5a6a2d2f49cac68c23..6b3d4866f818e5d10583adbb7ecadd7960ef9c9d 100644 --- a/automotive/vehicle/vhal_static_cpp_lib.mk +++ b/automotive/vehicle/vhal_static_cpp_lib.mk @@ -16,5 +16,5 @@ # interface and VHAL properties. LOCAL_STATIC_LIBRARIES += \ - android.hardware.automotive.vehicle-V2-ndk \ - android.hardware.automotive.vehicle.property-V2-ndk + android.hardware.automotive.vehicle-V3-ndk \ + android.hardware.automotive.vehicle.property-V3-ndk diff --git a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp index 910ae7ca9ef14b0c14e530a4ea75ce15bab05cc2..d3c34c554a69864b3303d3cd0e30dedebadeb402 100644 --- a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp +++ b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp @@ -166,9 +166,8 @@ TEST_P(VtsHalAutomotiveVehicleTargetTest, getAllPropConfigs) { ASSERT_TRUE(result.ok()) << "Failed to get all property configs, error: " << result.error().message(); - ASSERT_GE(result.value().size(), 1u) - << StringPrintf("Expect to get at least 1 property config, got %zu", - result.value().size()); + ASSERT_GE(result.value().size(), 1u) << StringPrintf( + "Expect to get at least 1 property config, got %zu", result.value().size()); } // Test getPropConfigs() can query properties returned by getAllPropConfigs. @@ -188,9 +187,8 @@ TEST_P(VtsHalAutomotiveVehicleTargetTest, getPropConfigsWithValidProps) { ASSERT_TRUE(result.ok()) << "Failed to get required property config, error: " << result.error().message(); - ASSERT_EQ(result.value().size(), properties.size()) - << StringPrintf("Expect to get exactly %zu configs, got %zu", - properties.size(), result.value().size()); + ASSERT_EQ(result.value().size(), properties.size()) << StringPrintf( + "Expect to get exactly %zu configs, got %zu", properties.size(), result.value().size()); } // Test getPropConfig() with an invalid propertyId returns an error code. @@ -550,6 +548,37 @@ TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyLocationCharacterizationConfig) VehicleArea::GLOBAL, VehiclePropertyType::INT32); } +TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyUltrasonicsSensorPositionConfig) { + verifyProperty(VehicleProperty::ULTRASONICS_SENSOR_POSITION, VehiclePropertyAccess::READ, + VehiclePropertyChangeMode::STATIC, VehiclePropertyGroup::SYSTEM, + VehicleArea::VENDOR, VehiclePropertyType::INT32_VEC); +} + +TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyUltrasonicsSensorOrientationConfig) { + verifyProperty(VehicleProperty::ULTRASONICS_SENSOR_ORIENTATION, VehiclePropertyAccess::READ, + VehiclePropertyChangeMode::STATIC, VehiclePropertyGroup::SYSTEM, + VehicleArea::VENDOR, VehiclePropertyType::INT32_VEC); +} + +TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyUltrasonicsSensorFieldOfViewConfig) { + verifyProperty(VehicleProperty::ULTRASONICS_SENSOR_FIELD_OF_VIEW, VehiclePropertyAccess::READ, + VehiclePropertyChangeMode::STATIC, VehiclePropertyGroup::SYSTEM, + VehicleArea::VENDOR, VehiclePropertyType::INT32_VEC); +} + +TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyUltrasonicsSensorDetectionRangeConfig) { + verifyProperty(VehicleProperty::ULTRASONICS_SENSOR_DETECTION_RANGE, VehiclePropertyAccess::READ, + VehiclePropertyChangeMode::STATIC, VehiclePropertyGroup::SYSTEM, + VehicleArea::VENDOR, VehiclePropertyType::INT32_VEC); +} + +TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyUltrasonicsSensorSupportedRangesConfig) { + verifyProperty(VehicleProperty::ULTRASONICS_SENSOR_SUPPORTED_RANGES, + VehiclePropertyAccess::READ, VehiclePropertyChangeMode::STATIC, + VehiclePropertyGroup::SYSTEM, VehicleArea::VENDOR, + VehiclePropertyType::INT32_VEC); +} + TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyEmergencyLaneKeepAssistEnabledConfig) { verifyProperty(VehicleProperty::EMERGENCY_LANE_KEEP_ASSIST_ENABLED, VehiclePropertyAccess::READ_WRITE, VehiclePropertyChangeMode::ON_CHANGE, @@ -623,6 +652,54 @@ TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyHandsOnDetectionWarningConfig) { VehicleArea::GLOBAL, VehiclePropertyType::INT32); } +TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyDriverDrowsinessAttentionSystemEnabledConfig) { + verifyProperty(VehicleProperty::DRIVER_DROWSINESS_ATTENTION_SYSTEM_ENABLED, + VehiclePropertyAccess::READ_WRITE, VehiclePropertyChangeMode::ON_CHANGE, + VehiclePropertyGroup::SYSTEM, VehicleArea::GLOBAL, VehiclePropertyType::BOOLEAN); +} + +TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyDriverDrowsinessAttentionStateConfig) { + verifyProperty(VehicleProperty::DRIVER_DROWSINESS_ATTENTION_STATE, VehiclePropertyAccess::READ, + VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, + VehicleArea::GLOBAL, VehiclePropertyType::INT32); +} + +TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyDriverDrowsinessAttentionWarningEnabledConfig) { + verifyProperty(VehicleProperty::DRIVER_DROWSINESS_ATTENTION_WARNING_ENABLED, + VehiclePropertyAccess::READ_WRITE, VehiclePropertyChangeMode::ON_CHANGE, + VehiclePropertyGroup::SYSTEM, VehicleArea::GLOBAL, VehiclePropertyType::BOOLEAN); +} + +TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyDriverDrowsinessAttentionWarningConfig) { + verifyProperty(VehicleProperty::DRIVER_DROWSINESS_ATTENTION_WARNING, + VehiclePropertyAccess::READ, VehiclePropertyChangeMode::ON_CHANGE, + VehiclePropertyGroup::SYSTEM, VehicleArea::GLOBAL, VehiclePropertyType::INT32); +} + +TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyDriverDistractionSystemEnabledConfig) { + verifyProperty(VehicleProperty::DRIVER_DISTRACTION_SYSTEM_ENABLED, + VehiclePropertyAccess::READ_WRITE, VehiclePropertyChangeMode::ON_CHANGE, + VehiclePropertyGroup::SYSTEM, VehicleArea::GLOBAL, VehiclePropertyType::BOOLEAN); +} + +TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyDriverDistractionStateConfig) { + verifyProperty(VehicleProperty::DRIVER_DISTRACTION_STATE, VehiclePropertyAccess::READ, + VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, + VehicleArea::GLOBAL, VehiclePropertyType::INT32); +} + +TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyDriverDistractionWarningEnabledConfig) { + verifyProperty(VehicleProperty::DRIVER_DISTRACTION_WARNING_ENABLED, + VehiclePropertyAccess::READ_WRITE, VehiclePropertyChangeMode::ON_CHANGE, + VehiclePropertyGroup::SYSTEM, VehicleArea::GLOBAL, VehiclePropertyType::BOOLEAN); +} + +TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyDriverDistractionWarningConfig) { + verifyProperty(VehicleProperty::DRIVER_DISTRACTION_WARNING, VehiclePropertyAccess::READ, + VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, + VehicleArea::GLOBAL, VehiclePropertyType::INT32); +} + TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyEvBrakeRegenerationLevelConfig) { verifyProperty(VehicleProperty::EV_BRAKE_REGENERATION_LEVEL, VehiclePropertyAccess::READ_WRITE, VehiclePropertyChangeMode::ON_CHANGE, @@ -887,6 +964,84 @@ TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyLaneCenteringAssistStateConfig) VehicleArea::GLOBAL, VehiclePropertyType::INT32); } +TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyClusterHeartbeatConfig) { + verifyProperty(VehicleProperty::CLUSTER_HEARTBEAT, VehiclePropertyAccess::WRITE, + VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, + VehicleArea::GLOBAL, VehiclePropertyType::MIXED); +} + +TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyVehicleDrivingAutomationCurrentLevelConfig) { + verifyProperty(VehicleProperty::VEHICLE_DRIVING_AUTOMATION_CURRENT_LEVEL, + VehiclePropertyAccess::READ, VehiclePropertyChangeMode::ON_CHANGE, + VehiclePropertyGroup::SYSTEM, VehicleArea::GLOBAL, VehiclePropertyType::INT32); +} + +TEST_P(VtsHalAutomotiveVehicleTargetTest, verifySeatAirbagsDeployedConfig) { + verifyProperty(VehicleProperty::SEAT_AIRBAGS_DEPLOYED, VehiclePropertyAccess::READ, + VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, + VehicleArea::SEAT, VehiclePropertyType::INT32); +} + +TEST_P(VtsHalAutomotiveVehicleTargetTest, verifySeatBeltPretensionerDeployedConfig) { + verifyProperty(VehicleProperty::SEAT_BELT_PRETENSIONER_DEPLOYED, VehiclePropertyAccess::READ, + VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, + VehicleArea::SEAT, VehiclePropertyType::BOOLEAN); +} + +TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyImpactDetectedConfig) { + verifyProperty(VehicleProperty::IMPACT_DETECTED, VehiclePropertyAccess::READ, + VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, + VehicleArea::GLOBAL, VehiclePropertyType::INT32); +} + +TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyEvBatteryAverageTemperatureConfig) { + verifyProperty(VehicleProperty::EV_BATTERY_AVERAGE_TEMPERATURE, VehiclePropertyAccess::READ, + VehiclePropertyChangeMode::CONTINUOUS, VehiclePropertyGroup::SYSTEM, + VehicleArea::GLOBAL, VehiclePropertyType::FLOAT); +} + +TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyLowSpeedCollisionWarningEnabledConfig) { + verifyProperty(VehicleProperty::LOW_SPEED_COLLISION_WARNING_ENABLED, + VehiclePropertyAccess::READ_WRITE, VehiclePropertyChangeMode::ON_CHANGE, + VehiclePropertyGroup::SYSTEM, VehicleArea::GLOBAL, VehiclePropertyType::BOOLEAN); +} + +TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyLowSpeedCollisionWarningStateConfig) { + verifyProperty(VehicleProperty::LOW_SPEED_COLLISION_WARNING_STATE, VehiclePropertyAccess::READ, + VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, + VehicleArea::GLOBAL, VehiclePropertyType::INT32); +} + +TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyValetModeEnabledConfig) { + verifyProperty(VehicleProperty::VALET_MODE_ENABLED, VehiclePropertyAccess::READ_WRITE, + VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, + VehicleArea::GLOBAL, VehiclePropertyType::BOOLEAN); +} + +TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyElectronicStabilityControlEnabledConfig) { + verifyProperty(VehicleProperty::ELECTRONIC_STABILITY_CONTROL_ENABLED, + VehiclePropertyAccess::READ_WRITE, VehiclePropertyChangeMode::ON_CHANGE, + VehiclePropertyGroup::SYSTEM, VehicleArea::GLOBAL, VehiclePropertyType::BOOLEAN); +} + +TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyElectronicStabilityControlStateConfig) { + verifyProperty(VehicleProperty::ELECTRONIC_STABILITY_CONTROL_STATE, VehiclePropertyAccess::READ, + VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, + VehicleArea::GLOBAL, VehiclePropertyType::INT32); +} + +TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyCrossTrafficMonitoringEnabledConfig) { + verifyProperty(VehicleProperty::CROSS_TRAFFIC_MONITORING_ENABLED, + VehiclePropertyAccess::READ_WRITE, VehiclePropertyChangeMode::ON_CHANGE, + VehiclePropertyGroup::SYSTEM, VehicleArea::GLOBAL, VehiclePropertyType::BOOLEAN); +} + +TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyCrossTrafficMonitoringWarningStateConfig) { + verifyProperty(VehicleProperty::CROSS_TRAFFIC_MONITORING_WARNING_STATE, + VehiclePropertyAccess::READ, VehiclePropertyChangeMode::ON_CHANGE, + VehiclePropertyGroup::SYSTEM, VehicleArea::GLOBAL, VehiclePropertyType::INT32); +} + bool VtsHalAutomotiveVehicleTargetTest::checkIsSupported(int32_t propertyId) { auto result = mVhalClient->getPropConfigs({propertyId}); return result.ok(); diff --git a/biometrics/common/aidl/Android.bp b/biometrics/common/aidl/Android.bp index b41a9374ea1c88c39328f4c8d52cbe25e5213e9e..8502a82ee78a4dbe5ab6010fc20b8da2edb81b88 100644 --- a/biometrics/common/aidl/Android.bp +++ b/biometrics/common/aidl/Android.bp @@ -13,7 +13,7 @@ aidl_interface { srcs: [ "android/hardware/biometrics/common/*.aidl", ], - frozen: true, + frozen: false, stability: "vintf", backend: { java: { diff --git a/biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/current/android/hardware/biometrics/common/FoldState.aidl b/biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/current/android/hardware/biometrics/common/FoldState.aidl new file mode 100644 index 0000000000000000000000000000000000000000..06baf00638d966f63042ff63fb22649c68edb59f --- /dev/null +++ b/biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/current/android/hardware/biometrics/common/FoldState.aidl @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/////////////////////////////////////////////////////////////////////////////// +// THIS 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 -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.common; +/* @hide */ +@Backing(type="int") @VintfStability +enum FoldState { + UNKNOWN, + HALF_OPENED, + FULLY_OPENED, + FULLY_CLOSED, +} diff --git a/biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/current/android/hardware/biometrics/common/OperationContext.aidl b/biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/current/android/hardware/biometrics/common/OperationContext.aidl index 378017e8d427ffb8f662076d49d07e6ffeae3d55..42c305a985c1a6072c5fbebda0380e4ce726a358 100644 --- a/biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/current/android/hardware/biometrics/common/OperationContext.aidl +++ b/biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/current/android/hardware/biometrics/common/OperationContext.aidl @@ -45,4 +45,5 @@ parcelable OperationContext { android.hardware.biometrics.common.WakeReason wakeReason = android.hardware.biometrics.common.WakeReason.UNKNOWN; android.hardware.biometrics.common.DisplayState displayState = android.hardware.biometrics.common.DisplayState.UNKNOWN; @nullable android.hardware.biometrics.common.AuthenticateReason authenticateReason; + android.hardware.biometrics.common.FoldState foldState = android.hardware.biometrics.common.FoldState.UNKNOWN; } diff --git a/biometrics/common/aidl/android/hardware/biometrics/common/FoldState.aidl b/biometrics/common/aidl/android/hardware/biometrics/common/FoldState.aidl new file mode 100644 index 0000000000000000000000000000000000000000..03e606a468ee12712030ea69496da7a07bf40ebd --- /dev/null +++ b/biometrics/common/aidl/android/hardware/biometrics/common/FoldState.aidl @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.hardware.biometrics.common; + +/** + * Fold/Unfold state during an operation. + * + * @hide + */ +@VintfStability +@Backing(type="int") +enum FoldState { + /** The fold state is unknown. */ + UNKNOWN, + + /** The fold state is half opened. */ + HALF_OPENED, + + /** The fold state is fully opened. */ + FULLY_OPENED, + + /** The fold state is fully closed. */ + FULLY_CLOSED, +} diff --git a/biometrics/common/aidl/android/hardware/biometrics/common/OperationContext.aidl b/biometrics/common/aidl/android/hardware/biometrics/common/OperationContext.aidl index f4191d751ace3c77236c93c6d64e24a00522e21e..584057d1b5ac1b106318c8b4ff841b53d8c94fa9 100644 --- a/biometrics/common/aidl/android/hardware/biometrics/common/OperationContext.aidl +++ b/biometrics/common/aidl/android/hardware/biometrics/common/OperationContext.aidl @@ -18,6 +18,7 @@ package android.hardware.biometrics.common; import android.hardware.biometrics.common.AuthenticateReason; import android.hardware.biometrics.common.DisplayState; +import android.hardware.biometrics.common.FoldState; import android.hardware.biometrics.common.OperationReason; import android.hardware.biometrics.common.WakeReason; @@ -71,4 +72,7 @@ parcelable OperationContext { * framework may choose to omit the reason at any time based on the device's policy. */ @nullable AuthenticateReason authenticateReason; + + /** The current fold/unfold state. */ + FoldState foldState = FoldState.UNKNOWN; } diff --git a/biometrics/common/util/Android.bp b/biometrics/common/util/Android.bp index b990812856cd907bcc9a464f9d3bb28167f28fca..599c4917727fcd2a3a9e3e0d009050e8e18dfd57 100644 --- a/biometrics/common/util/Android.bp +++ b/biometrics/common/util/Android.bp @@ -13,6 +13,6 @@ cc_library { shared_libs: [ "libbase", "libbinder_ndk", - "android.hardware.biometrics.common-V3-ndk", + "android.hardware.biometrics.common-V4-ndk", ], } diff --git a/biometrics/common/util/include/util/Util.h b/biometrics/common/util/include/util/Util.h index da19dc6afe321c7022790f246fbad24f56b9386b..efd66bc373c423840de307686b35af85781c4cf2 100644 --- a/biometrics/common/util/include/util/Util.h +++ b/biometrics/common/util/include/util/Util.h @@ -23,6 +23,9 @@ #include #include +#include +using ::android::base::ParseInt; + namespace aidl::android::hardware::biometrics { #define SLEEP_MS(x) \ @@ -64,6 +67,87 @@ class Util { std::sregex_token_iterator()); return parts; } + + // Returns a vector of integers for the string separated by comma, + // Empty vector is returned if there is any parsing error + static std::vector parseIntSequence(const std::string& str, + const std::string& sep = ",") { + std::vector seqs = Util::split(str, sep); + std::vector res; + + for (const auto& seq : seqs) { + int32_t val; + if (ParseInt(seq, &val)) { + res.push_back(val); + } else { + LOG(WARNING) << "Invalid int sequence:" + str + " seq:" + seq; + res.clear(); + break; + } + } + + return res; + } + + // Parses a single enrollment stage string in the format of + // enroll_stage_spec: [-acquiredInfos] + // duration: integerInMs + // acquiredInfos: [info1,info2,...] + // + // Returns false if there is parsing error + // + static bool parseEnrollmentCaptureSingle(const std::string& str, + std::vector>& res) { + std::vector defaultAcquiredInfo = {1}; + bool aborted = true; + + do { + std::smatch sms; + // Parses strings like "1000-[5,1]" or "500" + std::regex ex("((\\d+)(-\\[([\\d|,]+)\\])?)"); + if (!regex_match(str.cbegin(), str.cend(), sms, ex)) break; + int32_t duration; + if (!ParseInt(sms.str(2), &duration)) break; + res.push_back({duration}); + if (!sms.str(4).empty()) { + auto acqv = parseIntSequence(sms.str(4)); + if (acqv.empty()) break; + res.push_back(acqv); + } else + res.push_back(defaultAcquiredInfo); + aborted = false; + } while (0); + + return !aborted; + } + + // Parses enrollment string consisting of one or more stages in the formst of + // [,enroll_stage_spec,...] + // Empty vector is returned in case of parsing error + static std::vector> parseEnrollmentCapture(const std::string& str) { + std::vector> res; + + std::string s(str); + s.erase(std::remove_if(s.begin(), s.end(), ::isspace), s.end()); + bool aborted = false; + std::smatch sms; + // Parses strings like "1000-[5,1],500,800-[6,5,1]" + // -------------- ----- --------------- + // into parts: A B C + while (regex_search(s, sms, std::regex("^(,)?(\\d+(-\\[[\\d|,]+\\])?)"))) { + if (!parseEnrollmentCaptureSingle(sms.str(2), res)) { + aborted = true; + break; + } + s = sms.suffix(); + } + if (aborted || s.length() != 0) { + res.clear(); + LOG(ERROR) << "Failed to parse enrollment captures:" + str; + } + + return res; + } }; } // namespace aidl::android::hardware::biometrics diff --git a/biometrics/face/aidl/Android.bp b/biometrics/face/aidl/Android.bp index 79df9c63547bdc2e4669b7a858a6bd8574418324..7adf402f8123e881ce494522e79c277129d2e5e3 100644 --- a/biometrics/face/aidl/Android.bp +++ b/biometrics/face/aidl/Android.bp @@ -14,10 +14,13 @@ aidl_interface { "android/hardware/biometrics/face/**/*.aidl", ], imports: [ - "android.hardware.biometrics.common-V3", + "android.hardware.biometrics.common-V4", "android.hardware.common-V2", "android.hardware.keymaster-V4", ], + include_dirs: [ + "frameworks/native/aidl/gui", + ], stability: "vintf", backend: { java: { @@ -26,6 +29,11 @@ aidl_interface { cpp: { enabled: false, }, + ndk: { + additional_shared_libraries: [ + "libnativewindow", + ], + }, }, versions_with_info: [ { @@ -52,6 +60,14 @@ aidl_interface { "android.hardware.keymaster-V4", ], }, + { + version: "4", + imports: [ + "android.hardware.biometrics.common-V4", + "android.hardware.common-V2", + "android.hardware.keymaster-V4", + ], + }, ], frozen: true, diff --git a/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/4/.hash b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/4/.hash new file mode 100644 index 0000000000000000000000000000000000000000..e9a5aa391633b221d57aa21a973794c5bac28e70 --- /dev/null +++ b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/4/.hash @@ -0,0 +1 @@ +c43fbb9be4a662cc9ace640dba21cccdb84c6c21 diff --git a/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/4/android/hardware/biometrics/face/AcquiredInfo.aidl b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/4/android/hardware/biometrics/face/AcquiredInfo.aidl new file mode 100644 index 0000000000000000000000000000000000000000..1420cdcee5039b19c46b6b014d39b88b2f54f824 --- /dev/null +++ b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/4/android/hardware/biometrics/face/AcquiredInfo.aidl @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2021 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 -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.face; +/* @hide */ +@Backing(type="byte") @VintfStability +enum AcquiredInfo { + UNKNOWN, + GOOD, + INSUFFICIENT, + TOO_BRIGHT, + TOO_DARK, + TOO_CLOSE, + TOO_FAR, + FACE_TOO_HIGH, + FACE_TOO_LOW, + FACE_TOO_RIGHT, + FACE_TOO_LEFT, + POOR_GAZE, + NOT_DETECTED, + TOO_MUCH_MOTION, + RECALIBRATE, + TOO_DIFFERENT, + TOO_SIMILAR, + PAN_TOO_EXTREME, + TILT_TOO_EXTREME, + ROLL_TOO_EXTREME, + FACE_OBSCURED, + START, + SENSOR_DIRTY, + VENDOR, + FIRST_FRAME_RECEIVED, + DARK_GLASSES_DETECTED, + MOUTH_COVERING_DETECTED, +} diff --git a/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/4/android/hardware/biometrics/face/AuthenticationFrame.aidl b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/4/android/hardware/biometrics/face/AuthenticationFrame.aidl new file mode 100644 index 0000000000000000000000000000000000000000..bbaca1249aded608ccb467c8f4644277763e48af --- /dev/null +++ b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/4/android/hardware/biometrics/face/AuthenticationFrame.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2021 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 -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.face; +/* @hide */ +@VintfStability +parcelable AuthenticationFrame { + android.hardware.biometrics.face.BaseFrame data; +} diff --git a/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/4/android/hardware/biometrics/face/BaseFrame.aidl b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/4/android/hardware/biometrics/face/BaseFrame.aidl new file mode 100644 index 0000000000000000000000000000000000000000..1dd0a9c3d42263a8862d5f621117f10b2916cf96 --- /dev/null +++ b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/4/android/hardware/biometrics/face/BaseFrame.aidl @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2021 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 -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.face; +/* @hide */ +@VintfStability +parcelable BaseFrame { + android.hardware.biometrics.face.AcquiredInfo acquiredInfo = android.hardware.biometrics.face.AcquiredInfo.UNKNOWN; + int vendorCode; + float pan; + float tilt; + float distance; + boolean isCancellable; +} diff --git a/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/4/android/hardware/biometrics/face/Cell.aidl b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/4/android/hardware/biometrics/face/Cell.aidl new file mode 100644 index 0000000000000000000000000000000000000000..d423a69e95719dc4c8d4bd67c0307c11085a5664 --- /dev/null +++ b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/4/android/hardware/biometrics/face/Cell.aidl @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2021 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 -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.face; +/* @hide */ +@VintfStability +parcelable Cell { + int x; + int y; + int z; +} diff --git a/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/4/android/hardware/biometrics/face/EnrollmentFrame.aidl b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/4/android/hardware/biometrics/face/EnrollmentFrame.aidl new file mode 100644 index 0000000000000000000000000000000000000000..90be5d0ad42ff4511588680734d9e9a8fed96c5d --- /dev/null +++ b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/4/android/hardware/biometrics/face/EnrollmentFrame.aidl @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2021 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 -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.face; +/* @hide */ +@VintfStability +parcelable EnrollmentFrame { + @nullable android.hardware.biometrics.face.Cell cell; + android.hardware.biometrics.face.EnrollmentStage stage = android.hardware.biometrics.face.EnrollmentStage.UNKNOWN; + android.hardware.biometrics.face.BaseFrame data; +} diff --git a/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/4/android/hardware/biometrics/face/EnrollmentStage.aidl b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/4/android/hardware/biometrics/face/EnrollmentStage.aidl new file mode 100644 index 0000000000000000000000000000000000000000..89b06ca2b09556dc38892290ac47a97059e32f21 --- /dev/null +++ b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/4/android/hardware/biometrics/face/EnrollmentStage.aidl @@ -0,0 +1,45 @@ +/* + * Copyright (C) 2021 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 -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.face; +/* @hide */ +@Backing(type="byte") @VintfStability +enum EnrollmentStage { + UNKNOWN, + FIRST_FRAME_RECEIVED, + WAITING_FOR_CENTERING, + HOLD_STILL_IN_CENTER, + ENROLLING_MOVEMENT_1, + ENROLLING_MOVEMENT_2, + ENROLLMENT_FINISHED, +} diff --git a/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/4/android/hardware/biometrics/face/EnrollmentStageConfig.aidl b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/4/android/hardware/biometrics/face/EnrollmentStageConfig.aidl new file mode 100644 index 0000000000000000000000000000000000000000..ee1c01ade2477957cac96b1617164ded84e5ad7c --- /dev/null +++ b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/4/android/hardware/biometrics/face/EnrollmentStageConfig.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2021 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 -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.face; +/* @hide */ +@VintfStability +parcelable EnrollmentStageConfig { + android.hardware.biometrics.face.EnrollmentStage stage = android.hardware.biometrics.face.EnrollmentStage.UNKNOWN; + List cells; +} diff --git a/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/4/android/hardware/biometrics/face/EnrollmentType.aidl b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/4/android/hardware/biometrics/face/EnrollmentType.aidl new file mode 100644 index 0000000000000000000000000000000000000000..180ea5dcf2745ca5bf4f43bd16e2fd325523b286 --- /dev/null +++ b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/4/android/hardware/biometrics/face/EnrollmentType.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2021 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 -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.face; +/* @hide */ +@Backing(type="byte") @VintfStability +enum EnrollmentType { + DEFAULT, + ACCESSIBILITY, +} diff --git a/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/4/android/hardware/biometrics/face/Error.aidl b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/4/android/hardware/biometrics/face/Error.aidl new file mode 100644 index 0000000000000000000000000000000000000000..5761e31653a01a51469ae13aeb642748fc7f4f18 --- /dev/null +++ b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/4/android/hardware/biometrics/face/Error.aidl @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2021 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 -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.face; +/* @hide */ +@Backing(type="byte") @VintfStability +enum Error { + UNKNOWN, + HW_UNAVAILABLE, + UNABLE_TO_PROCESS, + TIMEOUT, + NO_SPACE, + CANCELED, + UNABLE_TO_REMOVE, + VENDOR, + REENROLL_REQUIRED, +} diff --git a/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/4/android/hardware/biometrics/face/FaceEnrollOptions.aidl b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/4/android/hardware/biometrics/face/FaceEnrollOptions.aidl new file mode 100644 index 0000000000000000000000000000000000000000..c96153112de810e32fe2769a9234ee8dd25d048d --- /dev/null +++ b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/4/android/hardware/biometrics/face/FaceEnrollOptions.aidl @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/////////////////////////////////////////////////////////////////////////////// +// THIS 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 -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.face; +/* @hide */ +@VintfStability +parcelable FaceEnrollOptions { + android.hardware.keymaster.HardwareAuthToken hardwareAuthToken; + android.hardware.biometrics.face.EnrollmentType enrollmentType; + android.hardware.biometrics.face.Feature[] features; + /** + * @deprecated use {@link surfacePreview} instead {@link NativeHandle} a handle used to render content from the face HAL. Note that only one of [{@link surfacePreview}, {@link nativeHandlePreview}] should be set at one time. + */ + @nullable android.hardware.common.NativeHandle nativeHandlePreview; + @nullable android.view.Surface surfacePreview; + @nullable android.hardware.biometrics.common.OperationContext context; +} diff --git a/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/4/android/hardware/biometrics/face/FaceSensorType.aidl b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/4/android/hardware/biometrics/face/FaceSensorType.aidl new file mode 100644 index 0000000000000000000000000000000000000000..ec03733a3f166f97368aeba8441bd9dc09970e17 --- /dev/null +++ b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/4/android/hardware/biometrics/face/FaceSensorType.aidl @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2021 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 -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.face; +/* @hide */ +@Backing(type="byte") @VintfStability +enum FaceSensorType { + UNKNOWN, + RGB, + IR, +} diff --git a/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/4/android/hardware/biometrics/face/Feature.aidl b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/4/android/hardware/biometrics/face/Feature.aidl new file mode 100644 index 0000000000000000000000000000000000000000..3337df8688a7f32a80f343651d68ef625613820c --- /dev/null +++ b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/4/android/hardware/biometrics/face/Feature.aidl @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2021 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 -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.face; +/* @hide */ +@Backing(type="byte") @VintfStability +enum Feature { + REQUIRE_ATTENTION, + REQUIRE_DIVERSE_POSES, + DEBUG, +} diff --git a/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/4/android/hardware/biometrics/face/IFace.aidl b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/4/android/hardware/biometrics/face/IFace.aidl new file mode 100644 index 0000000000000000000000000000000000000000..1ae76de543535da5fe1cf978de92f9097b46c839 --- /dev/null +++ b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/4/android/hardware/biometrics/face/IFace.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2021 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 -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.face; +/* @hide */ +@VintfStability +interface IFace { + android.hardware.biometrics.face.SensorProps[] getSensorProps(); + android.hardware.biometrics.face.ISession createSession(in int sensorId, in int userId, in android.hardware.biometrics.face.ISessionCallback cb); +} diff --git a/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/4/android/hardware/biometrics/face/ISession.aidl b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/4/android/hardware/biometrics/face/ISession.aidl new file mode 100644 index 0000000000000000000000000000000000000000..b655d5f5b26edd576b59a2d6db2613e5af2bb149 --- /dev/null +++ b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/4/android/hardware/biometrics/face/ISession.aidl @@ -0,0 +1,63 @@ +/* + * Copyright (C) 2021 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 -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.face; +/* @hide */ +@VintfStability +interface ISession { + void generateChallenge(); + void revokeChallenge(in long challenge); + android.hardware.biometrics.face.EnrollmentStageConfig[] getEnrollmentConfig(in android.hardware.biometrics.face.EnrollmentType enrollmentType); + /** + * @deprecated use {@link enrollWithOptions} instead. + */ + android.hardware.biometrics.common.ICancellationSignal enroll(in android.hardware.keymaster.HardwareAuthToken hat, in android.hardware.biometrics.face.EnrollmentType type, in android.hardware.biometrics.face.Feature[] features, in @nullable android.hardware.common.NativeHandle previewSurface); + android.hardware.biometrics.common.ICancellationSignal authenticate(in long operationId); + android.hardware.biometrics.common.ICancellationSignal detectInteraction(); + void enumerateEnrollments(); + void removeEnrollments(in int[] enrollmentIds); + void getFeatures(); + void setFeature(in android.hardware.keymaster.HardwareAuthToken hat, in android.hardware.biometrics.face.Feature feature, boolean enabled); + void getAuthenticatorId(); + void invalidateAuthenticatorId(); + void resetLockout(in android.hardware.keymaster.HardwareAuthToken hat); + void close(); + android.hardware.biometrics.common.ICancellationSignal authenticateWithContext(in long operationId, in android.hardware.biometrics.common.OperationContext context); + /** + * @deprecated use {@link enrollWithOptions} instead. + */ + android.hardware.biometrics.common.ICancellationSignal enrollWithContext(in android.hardware.keymaster.HardwareAuthToken hat, in android.hardware.biometrics.face.EnrollmentType type, in android.hardware.biometrics.face.Feature[] features, in @nullable android.hardware.common.NativeHandle previewSurface, in android.hardware.biometrics.common.OperationContext context); + android.hardware.biometrics.common.ICancellationSignal detectInteractionWithContext(in android.hardware.biometrics.common.OperationContext context); + void onContextChanged(in android.hardware.biometrics.common.OperationContext context); + android.hardware.biometrics.common.ICancellationSignal enrollWithOptions(in android.hardware.biometrics.face.FaceEnrollOptions options); +} diff --git a/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/4/android/hardware/biometrics/face/ISessionCallback.aidl b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/4/android/hardware/biometrics/face/ISessionCallback.aidl new file mode 100644 index 0000000000000000000000000000000000000000..c6c035b1d08881e136338a0a50565361f2ff9531 --- /dev/null +++ b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/4/android/hardware/biometrics/face/ISessionCallback.aidl @@ -0,0 +1,57 @@ +/* + * Copyright (C) 2021 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 -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.face; +/* @hide */ +@VintfStability +interface ISessionCallback { + void onChallengeGenerated(in long challenge); + void onChallengeRevoked(in long challenge); + void onAuthenticationFrame(in android.hardware.biometrics.face.AuthenticationFrame frame); + void onEnrollmentFrame(in android.hardware.biometrics.face.EnrollmentFrame frame); + void onError(in android.hardware.biometrics.face.Error error, in int vendorCode); + void onEnrollmentProgress(in int enrollmentId, int remaining); + void onAuthenticationSucceeded(in int enrollmentId, in android.hardware.keymaster.HardwareAuthToken hat); + void onAuthenticationFailed(); + void onLockoutTimed(in long durationMillis); + void onLockoutPermanent(); + void onLockoutCleared(); + void onInteractionDetected(); + void onEnrollmentsEnumerated(in int[] enrollmentIds); + void onFeaturesRetrieved(in android.hardware.biometrics.face.Feature[] features); + void onFeatureSet(android.hardware.biometrics.face.Feature feature); + void onEnrollmentsRemoved(in int[] enrollmentIds); + void onAuthenticatorIdRetrieved(in long authenticatorId); + void onAuthenticatorIdInvalidated(in long newAuthenticatorId); + void onSessionClosed(); +} diff --git a/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/4/android/hardware/biometrics/face/SensorProps.aidl b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/4/android/hardware/biometrics/face/SensorProps.aidl new file mode 100644 index 0000000000000000000000000000000000000000..918332b85d0af7ae2f894974975955816b4236dd --- /dev/null +++ b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/4/android/hardware/biometrics/face/SensorProps.aidl @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2021 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 -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.face; +/* @hide */ +@VintfStability +parcelable SensorProps { + android.hardware.biometrics.common.CommonProps commonProps; + android.hardware.biometrics.face.FaceSensorType sensorType = android.hardware.biometrics.face.FaceSensorType.UNKNOWN; + boolean halControlsPreview; + int previewDisplayId; + int enrollPreviewWidth; + int enrollPreviewHeight; + float enrollTranslationX; + float enrollTranslationY; + float enrollPreviewScale; + boolean supportsDetectInteraction; +} diff --git a/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/AcquiredInfo.aidl b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/AcquiredInfo.aidl index eaa43f3f9e0ad776d09f74ad5422a84c4c118989..1420cdcee5039b19c46b6b014d39b88b2f54f824 100644 --- a/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/AcquiredInfo.aidl +++ b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/AcquiredInfo.aidl @@ -32,33 +32,34 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.biometrics.face; +/* @hide */ @Backing(type="byte") @VintfStability enum AcquiredInfo { - UNKNOWN = 0, - GOOD = 1, - INSUFFICIENT = 2, - TOO_BRIGHT = 3, - TOO_DARK = 4, - TOO_CLOSE = 5, - TOO_FAR = 6, - FACE_TOO_HIGH = 7, - FACE_TOO_LOW = 8, - FACE_TOO_RIGHT = 9, - FACE_TOO_LEFT = 10, - POOR_GAZE = 11, - NOT_DETECTED = 12, - TOO_MUCH_MOTION = 13, - RECALIBRATE = 14, - TOO_DIFFERENT = 15, - TOO_SIMILAR = 16, - PAN_TOO_EXTREME = 17, - TILT_TOO_EXTREME = 18, - ROLL_TOO_EXTREME = 19, - FACE_OBSCURED = 20, - START = 21, - SENSOR_DIRTY = 22, - VENDOR = 23, - FIRST_FRAME_RECEIVED = 24, - DARK_GLASSES_DETECTED = 25, - MOUTH_COVERING_DETECTED = 26, + UNKNOWN, + GOOD, + INSUFFICIENT, + TOO_BRIGHT, + TOO_DARK, + TOO_CLOSE, + TOO_FAR, + FACE_TOO_HIGH, + FACE_TOO_LOW, + FACE_TOO_RIGHT, + FACE_TOO_LEFT, + POOR_GAZE, + NOT_DETECTED, + TOO_MUCH_MOTION, + RECALIBRATE, + TOO_DIFFERENT, + TOO_SIMILAR, + PAN_TOO_EXTREME, + TILT_TOO_EXTREME, + ROLL_TOO_EXTREME, + FACE_OBSCURED, + START, + SENSOR_DIRTY, + VENDOR, + FIRST_FRAME_RECEIVED, + DARK_GLASSES_DETECTED, + MOUTH_COVERING_DETECTED, } diff --git a/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/AuthenticationFrame.aidl b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/AuthenticationFrame.aidl index 20bc76779bae4770bb02f9fa0d576d09f1bf9e35..bbaca1249aded608ccb467c8f4644277763e48af 100644 --- a/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/AuthenticationFrame.aidl +++ b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/AuthenticationFrame.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.biometrics.face; +/* @hide */ @VintfStability parcelable AuthenticationFrame { android.hardware.biometrics.face.BaseFrame data; diff --git a/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/BaseFrame.aidl b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/BaseFrame.aidl index 67b5cf41692df6234e13d7e724fd360b25e45dfc..1dd0a9c3d42263a8862d5f621117f10b2916cf96 100644 --- a/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/BaseFrame.aidl +++ b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/BaseFrame.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.biometrics.face; +/* @hide */ @VintfStability parcelable BaseFrame { android.hardware.biometrics.face.AcquiredInfo acquiredInfo = android.hardware.biometrics.face.AcquiredInfo.UNKNOWN; diff --git a/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/Cell.aidl b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/Cell.aidl index 6be8c8e97518d1605c251ddb3679a51288999c09..d423a69e95719dc4c8d4bd67c0307c11085a5664 100644 --- a/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/Cell.aidl +++ b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/Cell.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.biometrics.face; +/* @hide */ @VintfStability parcelable Cell { int x; diff --git a/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/EnrollmentFrame.aidl b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/EnrollmentFrame.aidl index 0ea10d6ddb0ef2c0198480f551a84988316cca13..90be5d0ad42ff4511588680734d9e9a8fed96c5d 100644 --- a/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/EnrollmentFrame.aidl +++ b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/EnrollmentFrame.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.biometrics.face; +/* @hide */ @VintfStability parcelable EnrollmentFrame { @nullable android.hardware.biometrics.face.Cell cell; diff --git a/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/EnrollmentStage.aidl b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/EnrollmentStage.aidl index ce5679ab31b2ce933c8591b53ccd2db9847d635f..89b06ca2b09556dc38892290ac47a97059e32f21 100644 --- a/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/EnrollmentStage.aidl +++ b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/EnrollmentStage.aidl @@ -32,13 +32,14 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.biometrics.face; +/* @hide */ @Backing(type="byte") @VintfStability enum EnrollmentStage { - UNKNOWN = 0, - FIRST_FRAME_RECEIVED = 1, - WAITING_FOR_CENTERING = 2, - HOLD_STILL_IN_CENTER = 3, - ENROLLING_MOVEMENT_1 = 4, - ENROLLING_MOVEMENT_2 = 5, - ENROLLMENT_FINISHED = 6, + UNKNOWN, + FIRST_FRAME_RECEIVED, + WAITING_FOR_CENTERING, + HOLD_STILL_IN_CENTER, + ENROLLING_MOVEMENT_1, + ENROLLING_MOVEMENT_2, + ENROLLMENT_FINISHED, } diff --git a/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/EnrollmentStageConfig.aidl b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/EnrollmentStageConfig.aidl index 48db2cf615675a9aa06679c22a0276f3741e361c..ee1c01ade2477957cac96b1617164ded84e5ad7c 100644 --- a/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/EnrollmentStageConfig.aidl +++ b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/EnrollmentStageConfig.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.biometrics.face; +/* @hide */ @VintfStability parcelable EnrollmentStageConfig { android.hardware.biometrics.face.EnrollmentStage stage = android.hardware.biometrics.face.EnrollmentStage.UNKNOWN; diff --git a/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/EnrollmentType.aidl b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/EnrollmentType.aidl index 8e99ad6529fd7f8a7997d9c1effb49384f93787f..180ea5dcf2745ca5bf4f43bd16e2fd325523b286 100644 --- a/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/EnrollmentType.aidl +++ b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/EnrollmentType.aidl @@ -32,8 +32,9 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.biometrics.face; +/* @hide */ @Backing(type="byte") @VintfStability enum EnrollmentType { - DEFAULT = 0, - ACCESSIBILITY = 1, + DEFAULT, + ACCESSIBILITY, } diff --git a/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/Error.aidl b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/Error.aidl index 1a2166193265e9377fbc54514086bd27b7d1921f..5761e31653a01a51469ae13aeb642748fc7f4f18 100644 --- a/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/Error.aidl +++ b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/Error.aidl @@ -32,15 +32,16 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.biometrics.face; +/* @hide */ @Backing(type="byte") @VintfStability enum Error { - UNKNOWN = 0, - HW_UNAVAILABLE = 1, - UNABLE_TO_PROCESS = 2, - TIMEOUT = 3, - NO_SPACE = 4, - CANCELED = 5, - UNABLE_TO_REMOVE = 6, - VENDOR = 7, - REENROLL_REQUIRED = 8, + UNKNOWN, + HW_UNAVAILABLE, + UNABLE_TO_PROCESS, + TIMEOUT, + NO_SPACE, + CANCELED, + UNABLE_TO_REMOVE, + VENDOR, + REENROLL_REQUIRED, } diff --git a/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/FaceEnrollOptions.aidl b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/FaceEnrollOptions.aidl new file mode 100644 index 0000000000000000000000000000000000000000..c96153112de810e32fe2769a9234ee8dd25d048d --- /dev/null +++ b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/FaceEnrollOptions.aidl @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/////////////////////////////////////////////////////////////////////////////// +// THIS 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 -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.face; +/* @hide */ +@VintfStability +parcelable FaceEnrollOptions { + android.hardware.keymaster.HardwareAuthToken hardwareAuthToken; + android.hardware.biometrics.face.EnrollmentType enrollmentType; + android.hardware.biometrics.face.Feature[] features; + /** + * @deprecated use {@link surfacePreview} instead {@link NativeHandle} a handle used to render content from the face HAL. Note that only one of [{@link surfacePreview}, {@link nativeHandlePreview}] should be set at one time. + */ + @nullable android.hardware.common.NativeHandle nativeHandlePreview; + @nullable android.view.Surface surfacePreview; + @nullable android.hardware.biometrics.common.OperationContext context; +} diff --git a/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/FaceSensorType.aidl b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/FaceSensorType.aidl index a215b99f72e1854ac79dd905af61f94b7cde94a5..ec03733a3f166f97368aeba8441bd9dc09970e17 100644 --- a/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/FaceSensorType.aidl +++ b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/FaceSensorType.aidl @@ -32,9 +32,10 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.biometrics.face; +/* @hide */ @Backing(type="byte") @VintfStability enum FaceSensorType { - UNKNOWN = 0, - RGB = 1, - IR = 2, + UNKNOWN, + RGB, + IR, } diff --git a/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/Feature.aidl b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/Feature.aidl index 1875b97431990bef2d5a3b5ace56f27de8c92cc2..3337df8688a7f32a80f343651d68ef625613820c 100644 --- a/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/Feature.aidl +++ b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/Feature.aidl @@ -32,9 +32,10 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.biometrics.face; +/* @hide */ @Backing(type="byte") @VintfStability enum Feature { - REQUIRE_ATTENTION = 0, - REQUIRE_DIVERSE_POSES = 1, - DEBUG = 2, + REQUIRE_ATTENTION, + REQUIRE_DIVERSE_POSES, + DEBUG, } diff --git a/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/IFace.aidl b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/IFace.aidl index fc4a4d04bb0a68dc6d19dc7fcacddf682fbd6a0e..1ae76de543535da5fe1cf978de92f9097b46c839 100644 --- a/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/IFace.aidl +++ b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/IFace.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.biometrics.face; +/* @hide */ @VintfStability interface IFace { android.hardware.biometrics.face.SensorProps[] getSensorProps(); diff --git a/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/ISession.aidl b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/ISession.aidl index 366553485a83d0e583f7a89ef624cde0d5ef24aa..b655d5f5b26edd576b59a2d6db2613e5af2bb149 100644 --- a/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/ISession.aidl +++ b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/ISession.aidl @@ -32,11 +32,15 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.biometrics.face; +/* @hide */ @VintfStability interface ISession { void generateChallenge(); void revokeChallenge(in long challenge); android.hardware.biometrics.face.EnrollmentStageConfig[] getEnrollmentConfig(in android.hardware.biometrics.face.EnrollmentType enrollmentType); + /** + * @deprecated use {@link enrollWithOptions} instead. + */ android.hardware.biometrics.common.ICancellationSignal enroll(in android.hardware.keymaster.HardwareAuthToken hat, in android.hardware.biometrics.face.EnrollmentType type, in android.hardware.biometrics.face.Feature[] features, in @nullable android.hardware.common.NativeHandle previewSurface); android.hardware.biometrics.common.ICancellationSignal authenticate(in long operationId); android.hardware.biometrics.common.ICancellationSignal detectInteraction(); @@ -49,7 +53,11 @@ interface ISession { void resetLockout(in android.hardware.keymaster.HardwareAuthToken hat); void close(); android.hardware.biometrics.common.ICancellationSignal authenticateWithContext(in long operationId, in android.hardware.biometrics.common.OperationContext context); + /** + * @deprecated use {@link enrollWithOptions} instead. + */ android.hardware.biometrics.common.ICancellationSignal enrollWithContext(in android.hardware.keymaster.HardwareAuthToken hat, in android.hardware.biometrics.face.EnrollmentType type, in android.hardware.biometrics.face.Feature[] features, in @nullable android.hardware.common.NativeHandle previewSurface, in android.hardware.biometrics.common.OperationContext context); android.hardware.biometrics.common.ICancellationSignal detectInteractionWithContext(in android.hardware.biometrics.common.OperationContext context); void onContextChanged(in android.hardware.biometrics.common.OperationContext context); + android.hardware.biometrics.common.ICancellationSignal enrollWithOptions(in android.hardware.biometrics.face.FaceEnrollOptions options); } diff --git a/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/ISessionCallback.aidl b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/ISessionCallback.aidl index bbace29aa0f012060bf483af8efaef62c672c0e1..c6c035b1d08881e136338a0a50565361f2ff9531 100644 --- a/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/ISessionCallback.aidl +++ b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/ISessionCallback.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.biometrics.face; +/* @hide */ @VintfStability interface ISessionCallback { void onChallengeGenerated(in long challenge); diff --git a/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/SensorProps.aidl b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/SensorProps.aidl index 8b3c51bb1270f891c3768dd9e332ee9166c7a521..918332b85d0af7ae2f894974975955816b4236dd 100644 --- a/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/SensorProps.aidl +++ b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/SensorProps.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.biometrics.face; +/* @hide */ @VintfStability parcelable SensorProps { android.hardware.biometrics.common.CommonProps commonProps; diff --git a/biometrics/face/aidl/android/hardware/biometrics/face/AcquiredInfo.aidl b/biometrics/face/aidl/android/hardware/biometrics/face/AcquiredInfo.aidl index cf68421062b1dbaa0f8af7f4c2d229c29d3ad2fa..48b3e8c4cce14df80e62645d5f4c97e4c66cbf7e 100644 --- a/biometrics/face/aidl/android/hardware/biometrics/face/AcquiredInfo.aidl +++ b/biometrics/face/aidl/android/hardware/biometrics/face/AcquiredInfo.aidl @@ -15,7 +15,9 @@ */ package android.hardware.biometrics.face; - +/** + * @hide + */ @VintfStability @Backing(type="byte") enum AcquiredInfo { diff --git a/biometrics/face/aidl/android/hardware/biometrics/face/AuthenticationFrame.aidl b/biometrics/face/aidl/android/hardware/biometrics/face/AuthenticationFrame.aidl index be61a20c6f2bc6fde234e68301d2c9d9d471c38f..08ef9730d1c12d66301b7dd6b20063e7540b8278 100644 --- a/biometrics/face/aidl/android/hardware/biometrics/face/AuthenticationFrame.aidl +++ b/biometrics/face/aidl/android/hardware/biometrics/face/AuthenticationFrame.aidl @@ -20,6 +20,7 @@ import android.hardware.biometrics.face.BaseFrame; /** * Describes an individual frame captured during authentication. + * @hide */ @VintfStability parcelable AuthenticationFrame { diff --git a/biometrics/face/aidl/android/hardware/biometrics/face/BaseFrame.aidl b/biometrics/face/aidl/android/hardware/biometrics/face/BaseFrame.aidl index 58ad01a0c0d5f9c3ebc471b699453d0760e360e4..e407d915f88201b7d5e8b10114ab36537121f04b 100644 --- a/biometrics/face/aidl/android/hardware/biometrics/face/BaseFrame.aidl +++ b/biometrics/face/aidl/android/hardware/biometrics/face/BaseFrame.aidl @@ -22,6 +22,7 @@ import android.hardware.biometrics.face.AcquiredInfo; * Metadata of an individual frame. Can be used by the framework to provide user feedback. * This parcelable is part of AuthenticationFrame and EnrollmentFrame, and shouldn't be used * independently of those parcelables. + * @hide */ @VintfStability parcelable BaseFrame { diff --git a/biometrics/face/aidl/android/hardware/biometrics/face/Cell.aidl b/biometrics/face/aidl/android/hardware/biometrics/face/Cell.aidl index 77f33b96f3e701b35362d33128d18cf5368a5116..8960d57edbfc0a13847e1949af91ddc9983f4b43 100644 --- a/biometrics/face/aidl/android/hardware/biometrics/face/Cell.aidl +++ b/biometrics/face/aidl/android/hardware/biometrics/face/Cell.aidl @@ -18,6 +18,7 @@ package android.hardware.biometrics.face; /** * Coordinates of an enrollment UI cell in a vendor-defined coordinate system. + * @hide */ @VintfStability parcelable Cell { diff --git a/biometrics/face/aidl/android/hardware/biometrics/face/EnrollmentFrame.aidl b/biometrics/face/aidl/android/hardware/biometrics/face/EnrollmentFrame.aidl index ecb0e79aca668385f40fbc1a050a1efd83904476..15f019cb37b1285be31410b29cd56ec088845e25 100644 --- a/biometrics/face/aidl/android/hardware/biometrics/face/EnrollmentFrame.aidl +++ b/biometrics/face/aidl/android/hardware/biometrics/face/EnrollmentFrame.aidl @@ -22,6 +22,7 @@ import android.hardware.biometrics.face.EnrollmentStage; /** * Describes an individual frame captured during enrollment. + * @hide */ @VintfStability parcelable EnrollmentFrame { diff --git a/biometrics/face/aidl/android/hardware/biometrics/face/EnrollmentStage.aidl b/biometrics/face/aidl/android/hardware/biometrics/face/EnrollmentStage.aidl index 5974838e01365936f5bc29be1e15cd0fab39c7a0..1a3c029a8c4c370e75d906f6662038d1e9504900 100644 --- a/biometrics/face/aidl/android/hardware/biometrics/face/EnrollmentStage.aidl +++ b/biometrics/face/aidl/android/hardware/biometrics/face/EnrollmentStage.aidl @@ -18,6 +18,7 @@ package android.hardware.biometrics.face; /** * Enrollment stages that can be mapped to the enrollment UI actions in the framework. + * @hide */ @VintfStability @Backing(type="byte") diff --git a/biometrics/face/aidl/android/hardware/biometrics/face/EnrollmentStageConfig.aidl b/biometrics/face/aidl/android/hardware/biometrics/face/EnrollmentStageConfig.aidl index a8fa9abc8ea33b21ede40910669d51f023478667..362d752aa3ed390bb173c158b55b70e591bdd374 100644 --- a/biometrics/face/aidl/android/hardware/biometrics/face/EnrollmentStageConfig.aidl +++ b/biometrics/face/aidl/android/hardware/biometrics/face/EnrollmentStageConfig.aidl @@ -19,6 +19,9 @@ package android.hardware.biometrics.face; import android.hardware.biometrics.face.Cell; import android.hardware.biometrics.face.EnrollmentStage; +/** + * @hide + */ @VintfStability parcelable EnrollmentStageConfig { /** diff --git a/biometrics/face/aidl/android/hardware/biometrics/face/EnrollmentType.aidl b/biometrics/face/aidl/android/hardware/biometrics/face/EnrollmentType.aidl index c9609339962207bd0c6b612c4d783feffeffe2b2..5d92087d82bd131633a1125c33116fa16e7aaa34 100644 --- a/biometrics/face/aidl/android/hardware/biometrics/face/EnrollmentType.aidl +++ b/biometrics/face/aidl/android/hardware/biometrics/face/EnrollmentType.aidl @@ -16,6 +16,9 @@ package android.hardware.biometrics.face; +/** + * @hide + */ @VintfStability @Backing(type="byte") enum EnrollmentType { diff --git a/biometrics/face/aidl/android/hardware/biometrics/face/Error.aidl b/biometrics/face/aidl/android/hardware/biometrics/face/Error.aidl index e99415ac3681b7d5ca3c1f8e506a4ccec95f0a72..77d4717093b532426516edca3bb09333681d1492 100644 --- a/biometrics/face/aidl/android/hardware/biometrics/face/Error.aidl +++ b/biometrics/face/aidl/android/hardware/biometrics/face/Error.aidl @@ -15,7 +15,9 @@ */ package android.hardware.biometrics.face; - +/** + * @hide + */ @VintfStability @Backing(type="byte") enum Error { diff --git a/biometrics/face/aidl/android/hardware/biometrics/face/FaceEnrollOptions.aidl b/biometrics/face/aidl/android/hardware/biometrics/face/FaceEnrollOptions.aidl new file mode 100644 index 0000000000000000000000000000000000000000..c57fb55ccb103086c4977e65a8c474021e8dbcbc --- /dev/null +++ b/biometrics/face/aidl/android/hardware/biometrics/face/FaceEnrollOptions.aidl @@ -0,0 +1,70 @@ +/* + * Copyright (C) 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.hardware.biometrics.face; + +import android.hardware.biometrics.common.OperationContext; +import android.hardware.biometrics.face.EnrollmentStageConfig; +import android.hardware.biometrics.face.EnrollmentType; +import android.hardware.biometrics.face.Feature; +import android.hardware.common.NativeHandle; +import android.hardware.keymaster.HardwareAuthToken; +import android.view.Surface; + +/** + * Enroll options used to pass information to the HAL when requesting an enroll operation. + * @hide + */ +@VintfStability +parcelable FaceEnrollOptions { + /** + * See {@link HardwareAuthToken}. + */ + HardwareAuthToken hardwareAuthToken; + + /** + * See {@link EnrollmentType} + */ + EnrollmentType enrollmentType; + + /** + * See {@link Feature} + */ + Feature[] features; + + /** + * @deprecated use {@link surfacePreview} instead + * + * {@link NativeHandle} a handle used to render content from the face HAL. + * + * Note that only one of [{@link surfacePreview}, {@link nativeHandlePreview}] + * should be set at one time. + */ + @nullable NativeHandle nativeHandlePreview; + + /** + * {@link Surface} a surface used to render content from the face HAL. + * + * Note that only one of [{@link surfacePreview}, {@link nativeHandlePreview}] + * should be set at one time. + */ + @nullable Surface surfacePreview; + + /** + * See {@link OperationContext} + */ + @nullable OperationContext context; +} diff --git a/biometrics/face/aidl/android/hardware/biometrics/face/FaceSensorType.aidl b/biometrics/face/aidl/android/hardware/biometrics/face/FaceSensorType.aidl index a5ed2e84e790d6628cb9349d46834427d8bd66bc..bf315a52505e16f748fba340bd231a7c9755b2d9 100644 --- a/biometrics/face/aidl/android/hardware/biometrics/face/FaceSensorType.aidl +++ b/biometrics/face/aidl/android/hardware/biometrics/face/FaceSensorType.aidl @@ -16,6 +16,9 @@ package android.hardware.biometrics.face; +/** + * @hide + */ @VintfStability @Backing(type="byte") enum FaceSensorType { diff --git a/biometrics/face/aidl/android/hardware/biometrics/face/Feature.aidl b/biometrics/face/aidl/android/hardware/biometrics/face/Feature.aidl index bff1a022b78e5ec1c479ede11da4db5480806847..9cbab5522a441d383df8728036fed53c20a24cae 100644 --- a/biometrics/face/aidl/android/hardware/biometrics/face/Feature.aidl +++ b/biometrics/face/aidl/android/hardware/biometrics/face/Feature.aidl @@ -16,6 +16,9 @@ package android.hardware.biometrics.face; +/** + * @hide + */ @VintfStability @Backing(type="byte") enum Feature { diff --git a/biometrics/face/aidl/android/hardware/biometrics/face/IFace.aidl b/biometrics/face/aidl/android/hardware/biometrics/face/IFace.aidl index 65c589f19299f667660436d4dffee200bb6f4982..0ead43598c21d4bc1ac070668245d87a9105c336 100644 --- a/biometrics/face/aidl/android/hardware/biometrics/face/IFace.aidl +++ b/biometrics/face/aidl/android/hardware/biometrics/face/IFace.aidl @@ -20,6 +20,9 @@ import android.hardware.biometrics.face.ISession; import android.hardware.biometrics.face.ISessionCallback; import android.hardware.biometrics.face.SensorProps; +/** + * @hide + */ @VintfStability interface IFace { /** diff --git a/biometrics/face/aidl/android/hardware/biometrics/face/ISession.aidl b/biometrics/face/aidl/android/hardware/biometrics/face/ISession.aidl index 2be76cb9019def05dcf65141a62325577deb75aa..26cb36148233ff5033f45cc3007e641f1cfcef0b 100644 --- a/biometrics/face/aidl/android/hardware/biometrics/face/ISession.aidl +++ b/biometrics/face/aidl/android/hardware/biometrics/face/ISession.aidl @@ -20,6 +20,7 @@ import android.hardware.biometrics.common.ICancellationSignal; import android.hardware.biometrics.common.OperationContext; import android.hardware.biometrics.face.EnrollmentStageConfig; import android.hardware.biometrics.face.EnrollmentType; +import android.hardware.biometrics.face.FaceEnrollOptions; import android.hardware.biometrics.face.Feature; import android.hardware.common.NativeHandle; import android.hardware.keymaster.HardwareAuthToken; @@ -41,6 +42,7 @@ import android.hardware.keymaster.HardwareAuthToken; * ISession only supports execution of one operation at a time, regardless of whether it's * cancellable or not. The framework must wait for a corresponding callback indicating the end of * the current operation before a new operation can be started. + * @hide */ @VintfStability @@ -115,44 +117,7 @@ interface ISession { EnrollmentStageConfig[] getEnrollmentConfig(in EnrollmentType enrollmentType); /** - * enroll: - * - * A request to add a face enrollment. - * - * At any point during enrollment, if a non-recoverable error occurs, the HAL must notify the - * framework via ISessionCallback#onError with the applicable enrollment-specific error. - * - * Before capturing face data, the HAL must first verify the authenticity and integrity of the - * provided HardwareAuthToken. In addition, it must check that the challenge within the provided - * HardwareAuthToken is valid. See ISession#generateChallenge. If any of the above checks fail, - * the framework must be notified using ISessionCallback#onError with Error::UNABLE_TO_PROCESS. - * - * During enrollment, the HAL may notify the framework via ISessionCallback#onAcquired with - * messages that may be used to guide the user. This callback can be invoked multiple times if - * necessary. Similarly, the framework may be notified of enrollment progress changes via - * ISessionCallback#onEnrollmentProgress. Once the framework is notified that there are 0 - * "remaining" steps, the framework may cache the "enrollmentId". See - * ISessionCallback#onEnrollmentProgress for more info. - * - * When a face is successfully added and before the framework is notified of remaining=0, the - * HAL must update and associate this (sensorId, userId) pair with a new entropy-encoded random - * identifier. See ISession#getAuthenticatorId for more information. - * - * Callbacks that signify the end of this operation's lifecycle: - * - ISessionCallback#onError - * - ISessionCallback#onEnrollmentProgress(enrollmentId, remaining=0) - * - * Other applicable callbacks: - * - ISessionCallback#onAcquired - * - * @param hat See above documentation. - * @param enrollmentType See the EnrollmentType enum. - * @param features See the Feature enum. - * @param previewSurface A surface provided by the framework if SensorProps#halControlsPreview - * is set to true. The HAL must send the preview frames to previewSurface - * if it's not null. - * @return ICancellationSignal An object that can be used by the framework to cancel this - * operation. + * @deprecated use {@link enrollWithOptions} instead. */ ICancellationSignal enroll(in HardwareAuthToken hat, in EnrollmentType type, in Feature[] features, in @nullable NativeHandle previewSurface); @@ -456,7 +421,9 @@ interface ISession { /* See ISession#authenticateWithContext(long) */ ICancellationSignal authenticateWithContext(in long operationId, in OperationContext context); - /* See ISession#enroll(HardwareAuthToken, EnrollmentType, Feature[], NativeHandle) */ + /* + * @deprecated use {@link enrollWithOptions} instead. + */ ICancellationSignal enrollWithContext(in HardwareAuthToken hat, in EnrollmentType type, in Feature[] features, in @nullable NativeHandle previewSurface, in OperationContext context); @@ -469,4 +436,41 @@ interface ISession { * running when the context changes. */ void onContextChanged(in OperationContext context); + + /** + * enrollWithOptions: + * + * A request to add a face enrollment. + * + * At any point during enrollment, if a non-recoverable error occurs, the HAL must notify the + * framework via ISessionCallback#onError with the applicable enrollment-specific error. + * + * Before capturing face data, the HAL must first verify the authenticity and integrity of the + * provided HardwareAuthToken. In addition, it must check that the challenge within the provided + * HardwareAuthToken is valid. See ISession#generateChallenge. If any of the above checks fail, + * the framework must be notified using ISessionCallback#onError with Error::UNABLE_TO_PROCESS. + * + * During enrollment, the HAL may notify the framework via ISessionCallback#onAcquired with + * messages that may be used to guide the user. This callback can be invoked multiple times if + * necessary. Similarly, the framework may be notified of enrollment progress changes via + * ISessionCallback#onEnrollmentProgress. Once the framework is notified that there are 0 + * "remaining" steps, the framework may cache the "enrollmentId". See + * ISessionCallback#onEnrollmentProgress for more info. + * + * When a face is successfully added and before the framework is notified of remaining=0, the + * HAL must update and associate this (sensorId, userId) pair with a new entropy-encoded random + * identifier. See ISession#getAuthenticatorId for more information. + * + * Callbacks that signify the end of this operation's lifecycle: + * - ISessionCallback#onError + * - ISessionCallback#onEnrollmentProgress(enrollmentId, remaining=0) + * + * Other applicable callbacks: + * - ISessionCallback#onAcquired + * + * @param FaceEnrollOptions See {@link FaceEnrollOptions} for more detail. + * @return ICancellationSignal An object that can be used by the framework to cancel this + * operation. + */ + ICancellationSignal enrollWithOptions(in FaceEnrollOptions options); } diff --git a/biometrics/face/aidl/android/hardware/biometrics/face/ISessionCallback.aidl b/biometrics/face/aidl/android/hardware/biometrics/face/ISessionCallback.aidl index 9eb575cc3caba370df90eb056865c4dc332791fe..b38e366f9827ca359505d3cb030814da0f30186a 100644 --- a/biometrics/face/aidl/android/hardware/biometrics/face/ISessionCallback.aidl +++ b/biometrics/face/aidl/android/hardware/biometrics/face/ISessionCallback.aidl @@ -23,6 +23,9 @@ import android.hardware.biometrics.face.Error; import android.hardware.biometrics.face.Feature; import android.hardware.keymaster.HardwareAuthToken; +/** + * @hide + */ @VintfStability interface ISessionCallback { /** diff --git a/biometrics/face/aidl/android/hardware/biometrics/face/SensorProps.aidl b/biometrics/face/aidl/android/hardware/biometrics/face/SensorProps.aidl index 5f881ca1d3973352c1e4270f25e42eba0cff0c23..09fd9e5093752a6949ab6f2f0f1905edea344920 100644 --- a/biometrics/face/aidl/android/hardware/biometrics/face/SensorProps.aidl +++ b/biometrics/face/aidl/android/hardware/biometrics/face/SensorProps.aidl @@ -19,6 +19,9 @@ package android.hardware.biometrics.face; import android.hardware.biometrics.common.CommonProps; import android.hardware.biometrics.face.FaceSensorType; +/** + * @hide + */ @VintfStability parcelable SensorProps { /** diff --git a/biometrics/face/aidl/default/Android.bp b/biometrics/face/aidl/default/Android.bp index 82ad9174a555a6372d310ff2d2812a9ba583404a..4e8390a64e40a77b763be71ef86eda2d47ce69fa 100644 --- a/biometrics/face/aidl/default/Android.bp +++ b/biometrics/face/aidl/default/Android.bp @@ -8,36 +8,48 @@ package { } filegroup { - name: "face-default.rc", - srcs: ["face-default.rc"], + name: "face-example.rc", + srcs: ["face-example.rc"], } filegroup { - name: "face-default.xml", - srcs: ["face-default.xml"], + name: "face-example.xml", + srcs: ["face-example.xml"], } cc_binary { name: "android.hardware.biometrics.face-service.example", relative_install_path: "hw", - init_rc: [":face-default.rc"], - vintf_fragments: [":face-default.xml"], + init_rc: [":face-example.rc"], + vintf_fragments: [":face-example.xml"], vendor: true, + shared_libs: [ - "libbase", "libbinder_ndk", - "android.hardware.biometrics.face-V3-ndk", - "android.hardware.biometrics.common-V3-ndk", - "android.hardware.biometrics.common.thread", - "android.hardware.biometrics.common.util", + "liblog", + "libnativewindow", ], srcs: [ + "FakeLockoutTracker.cpp", "main.cpp", "Face.cpp", "FakeFaceEngine.cpp", "Session.cpp", ], - static_libs: ["libandroid.hardware.biometrics.face.VirtualProps"], + include_dirs: [ + "frameworks/native/aidl/gui", + ], + stl: "c++_static", + static_libs: [ + "android.hardware.biometrics.common-V4-ndk", + "android.hardware.biometrics.common.thread", + "android.hardware.biometrics.common.util", + "android.hardware.biometrics.face-V4-ndk", + "android.hardware.common-V2-ndk", + "android.hardware.keymaster-V4-ndk", + "libandroid.hardware.biometrics.face.VirtualProps", + "libbase", + ], } sysprop_library { @@ -52,15 +64,46 @@ cc_test { srcs: [ "tests/FakeFaceEngineTest.cpp", "FakeFaceEngine.cpp", + "FakeLockoutTracker.cpp", ], shared_libs: [ "libbase", "libbinder_ndk", + "libnativewindow", + ], + include_dirs: [ + "frameworks/native/aidl/gui", + ], + static_libs: [ + "libandroid.hardware.biometrics.face.VirtualProps", + "android.hardware.biometrics.face-V4-ndk", + "android.hardware.biometrics.common-V4-ndk", + "android.hardware.keymaster-V4-ndk", + "android.hardware.biometrics.common.util", + ], + vendor: true, + test_suites: ["general-tests"], + require_root: true, +} + +cc_test { + name: "android.hardware.biometrics.face.FakeLockoutTrackerTest", + srcs: [ + "tests/FakeLockoutTrackerTest.cpp", + "FakeLockoutTracker.cpp", + ], + shared_libs: [ + "libbase", + "libbinder_ndk", + "libnativewindow", + ], + include_dirs: [ + "frameworks/native/aidl/gui", ], static_libs: [ "libandroid.hardware.biometrics.face.VirtualProps", - "android.hardware.biometrics.face-V3-ndk", - "android.hardware.biometrics.common-V3-ndk", + "android.hardware.biometrics.face-V4-ndk", + "android.hardware.biometrics.common-V4-ndk", "android.hardware.keymaster-V4-ndk", "android.hardware.biometrics.common.util", ], diff --git a/biometrics/face/aidl/default/FakeFaceEngine.cpp b/biometrics/face/aidl/default/FakeFaceEngine.cpp index 0f088f4331a61bec8e6e3920cd1eaba051cd86f4..7380611853388e160fa67d859b93a1b81d7d48da 100644 --- a/biometrics/face/aidl/default/FakeFaceEngine.cpp +++ b/biometrics/face/aidl/default/FakeFaceEngine.cpp @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#define LOG_TAG "FaceVirtualHalEngine" + #include "FakeFaceEngine.h" #include @@ -53,15 +71,6 @@ void FakeFaceEngine::enrollImpl(ISessionCallback* cb, const keymaster::HardwareA const std::vector& /*features*/, const std::future& cancel) { BEGIN_OP(FaceHalProperties::operation_start_enroll_latency().value_or(0)); - // format is ",::,::... - auto nextEnroll = FaceHalProperties::next_enrollment().value_or(""); - // Erase the next enrollment - FaceHalProperties::next_enrollment({}); - - AuthenticationFrame frame; - frame.data.acquiredInfo = AcquiredInfo::START; - frame.data.vendorCode = 0; - cb->onAuthenticationFrame(frame); // Do proper HAT verification in the real implementation. if (hat.mac.empty()) { @@ -70,122 +79,215 @@ void FakeFaceEngine::enrollImpl(ISessionCallback* cb, const keymaster::HardwareA return; } - if (FaceHalProperties::operation_enroll_fails().value_or(false)) { - LOG(ERROR) << "Fail: operation_enroll_fails"; - cb->onError(Error::VENDOR, 0 /* vendorError */); - return; - } - - auto parts = Util::split(nextEnroll, ","); - if (parts.size() < 2) { - LOG(ERROR) << "Fail: invalid next_enrollment for : " << nextEnroll; + // Format: : + // ------:-----------------------------------------:-------------- + // | | |--->enrollment success (true/false) + // | |--> progress_steps + // | + // |-->enrollment id + // + // + // progress_steps + // -[acquiredInfo,...]+ + // ---------------------------- --------------------- + // | |-> sequence of acquiredInfo code + // | --> time duration of the step in ms + // + // E.g. 1:2000-[21,1108,5,6,1],1000-[1113,4,1]:true + // A success enrollement of id 1 by 2 steps + // 1st step lasts 2000ms with acquiredInfo codes (21,1108,5,6,1) + // 2nd step lasts 1000ms with acquiredInfo codes (1113,4,1) + // + std::string defaultNextEnrollment = + "1:1000-[21,7,1,1103],1500-[1108,1],2000-[1113,1],2500-[1118,1]:true"; + auto nextEnroll = FaceHalProperties::next_enrollment().value_or(defaultNextEnrollment); + auto parts = Util::split(nextEnroll, ":"); + if (parts.size() != 3) { + LOG(ERROR) << "Fail: invalid next_enrollment:" << nextEnroll; cb->onError(Error::VENDOR, 0 /* vendorError */); return; } - auto enrollmentId = std::stoi(parts[0]); - const int numBuckets = parts.size() - 1; - for (size_t i = 1; i < parts.size(); i++) { - auto enrollHit = Util::split(parts[i], ":"); - if (enrollHit.size() != 3) { - LOG(ERROR) << "Error when unpacking enrollment hit: " << parts[i]; - cb->onError(Error::VENDOR, 0 /* vendorError */); - } - std::string bucket = enrollHit[0]; - std::string delay = enrollHit[1]; - std::string succeeds = enrollHit[2]; - - SLEEP_MS(std::stoi(delay)); - - if (shouldCancel(cancel)) { - LOG(ERROR) << "Fail: cancel"; - cb->onError(Error::CANCELED, 0 /* vendorCode */); - return; + auto progress = Util::parseEnrollmentCapture(parts[1]); + for (size_t i = 0; i < progress.size(); i += 2) { + auto left = (progress.size() - i) / 2 - 1; + auto duration = progress[i][0]; + auto acquired = progress[i + 1]; + auto N = acquired.size(); + + for (int j = 0; j < N; j++) { + SLEEP_MS(duration / N); + + if (shouldCancel(cancel)) { + LOG(ERROR) << "Fail: cancel"; + cb->onError(Error::CANCELED, 0 /* vendorCode */); + return; + } + EnrollmentFrame frame = {}; + auto ac = convertAcquiredInfo(acquired[j]); + frame.data.acquiredInfo = ac.first; + frame.data.vendorCode = ac.second; + frame.stage = (i == 0 && j == 0) ? EnrollmentStage::FIRST_FRAME_RECEIVED + : (i == progress.size() - 2 && j == N - 1) + ? EnrollmentStage::ENROLLMENT_FINISHED + : EnrollmentStage::WAITING_FOR_CENTERING; + cb->onEnrollmentFrame(frame); } - if (!IS_TRUE(succeeds)) { // end and failed - LOG(ERROR) << "Fail: requested by caller: " << parts[i]; + if (left == 0 && !IS_TRUE(parts[2])) { // end and failed + LOG(ERROR) << "Fail: requested by caller: " << nextEnroll; + FaceHalProperties::next_enrollment({}); cb->onError(Error::UNABLE_TO_PROCESS, 0 /* vendorCode */); - return; - } - - EnrollmentFrame frame; - - frame.data.acquiredInfo = AcquiredInfo::GOOD; - frame.data.vendorCode = 0; - cb->onEnrollmentFrame(frame); - - frame.data.acquiredInfo = AcquiredInfo::VENDOR; - frame.data.vendorCode = std::stoi(bucket); - cb->onEnrollmentFrame(frame); - - int remainingBuckets = numBuckets - i; - if (remainingBuckets > 0) { - cb->onEnrollmentProgress(enrollmentId, remainingBuckets); + } else { // progress and update props if last time + LOG(INFO) << "onEnroll: " << enrollmentId << " left: " << left; + if (left == 0) { + auto enrollments = FaceHalProperties::enrollments(); + enrollments.emplace_back(enrollmentId); + FaceHalProperties::enrollments(enrollments); + FaceHalProperties::next_enrollment({}); + // change authenticatorId after new enrollment + auto id = FaceHalProperties::authenticator_id().value_or(0); + auto newId = id + 1; + FaceHalProperties::authenticator_id(newId); + LOG(INFO) << "Enrolled: " << enrollmentId; + } + cb->onEnrollmentProgress(enrollmentId, left); } } - - auto enrollments = FaceHalProperties::enrollments(); - enrollments.push_back(enrollmentId); - FaceHalProperties::enrollments(enrollments); - LOG(INFO) << "enrolled : " << enrollmentId; - cb->onEnrollmentProgress(enrollmentId, 0); } void FakeFaceEngine::authenticateImpl(ISessionCallback* cb, int64_t /*operationId*/, const std::future& cancel) { BEGIN_OP(FaceHalProperties::operation_authenticate_latency().value_or(0)); - // Signal to the framework that we have begun authenticating. - AuthenticationFrame frame; - frame.data.acquiredInfo = AcquiredInfo::START; - frame.data.vendorCode = 0; - cb->onAuthenticationFrame(frame); - - // Also signal that we have opened the camera. - frame = {}; - frame.data.acquiredInfo = AcquiredInfo::FIRST_FRAME_RECEIVED; - frame.data.vendorCode = 0; - cb->onAuthenticationFrame(frame); - - auto now = Util::getSystemNanoTime(); - int64_t duration = FaceHalProperties::operation_authenticate_duration().value_or(0); - if (duration > 0) { - do { - SLEEP_MS(5); - } while (!Util::hasElapsed(now, duration)); - } + auto id = FaceHalProperties::enrollment_hit().value_or(0); + auto enrolls = FaceHalProperties::enrollments(); + auto isEnrolled = std::find(enrolls.begin(), enrolls.end(), id) != enrolls.end(); - if (FaceHalProperties::operation_authenticate_fails().value_or(false)) { - LOG(ERROR) << "Fail: operation_authenticate_fails"; - cb->onError(Error::VENDOR, 0 /* vendorError */); - return; + auto vec2str = [](std::vector va) { + std::stringstream ss; + bool isFirst = true; + for (auto ac : va) { + if (!isFirst) ss << ","; + ss << std::to_string((int8_t)ac); + isFirst = false; + } + return ss.str(); + }; + + // default behavior mimic face sensor in U + int64_t defaultAuthDuration = 500; + std::string defaultAcquiredInfo = + vec2str({AcquiredInfo::START, AcquiredInfo::FIRST_FRAME_RECEIVED}); + if (!isEnrolled) { + std::vector v; + for (int i = 0; i < 56; i++) v.push_back(AcquiredInfo::NOT_DETECTED); + defaultAcquiredInfo += "," + vec2str(v); + defaultAuthDuration = 2100; + } else { + defaultAcquiredInfo += "," + vec2str({AcquiredInfo::TOO_BRIGHT, AcquiredInfo::TOO_BRIGHT, + AcquiredInfo::TOO_BRIGHT, AcquiredInfo::TOO_BRIGHT, + AcquiredInfo::GOOD, AcquiredInfo::GOOD}); } - if (FaceHalProperties::lockout().value_or(false)) { - LOG(ERROR) << "Fail: lockout"; - cb->onLockoutPermanent(); - cb->onError(Error::HW_UNAVAILABLE, 0 /* vendorError */); + int64_t now = Util::getSystemNanoTime(); + int64_t duration = + FaceHalProperties::operation_authenticate_duration().value_or(defaultAuthDuration); + auto acquired = + FaceHalProperties::operation_authenticate_acquired().value_or(defaultAcquiredInfo); + auto acquiredInfos = Util::parseIntSequence(acquired); + int N = acquiredInfos.size(); + + if (N == 0) { + LOG(ERROR) << "Fail to parse authentiate acquired info: " + acquired; + cb->onError(Error::UNABLE_TO_PROCESS, 0 /* vendorError */); return; } - if (shouldCancel(cancel)) { - LOG(ERROR) << "Fail: cancel"; - cb->onError(Error::CANCELED, 0 /* vendorCode */); + if (mLockoutTracker.checkIfLockout(cb)) { return; } - auto id = FaceHalProperties::enrollment_hit().value_or(0); - auto enrolls = FaceHalProperties::enrollments(); - auto isEnrolled = std::find(enrolls.begin(), enrolls.end(), id) != enrolls.end(); - if (id < 0 || !isEnrolled) { - LOG(ERROR) << (isEnrolled ? "invalid enrollment hit" : "Fail: not enrolled"); + int i = 0; + do { + if (FaceHalProperties::lockout().value_or(false)) { + LOG(ERROR) << "Fail: lockout"; + cb->onLockoutPermanent(); + cb->onError(Error::HW_UNAVAILABLE, 0 /* vendorError */); + return; + } + + if (FaceHalProperties::operation_authenticate_fails().value_or(false)) { + LOG(ERROR) << "Fail: operation_authenticate_fails"; + mLockoutTracker.addFailedAttempt(cb); + cb->onAuthenticationFailed(); + return; + } + + auto err = FaceHalProperties::operation_authenticate_error().value_or(0); + if (err != 0) { + LOG(ERROR) << "Fail: operation_authenticate_error"; + auto ec = convertError(err); + cb->onError(ec.first, ec.second); + return; /* simply terminating current operation for any user inserted error, + revisit if tests need*/ + } + + if (shouldCancel(cancel)) { + LOG(ERROR) << "Fail: cancel"; + cb->onError(Error::CANCELED, 0 /* vendorCode */); + return; + } + + if (i < N) { + auto ac = convertAcquiredInfo(acquiredInfos[i]); + AuthenticationFrame frame; + frame.data.acquiredInfo = ac.first; + frame.data.vendorCode = ac.second; + cb->onAuthenticationFrame(frame); + LOG(INFO) << "AcquiredInfo:" << i << ": (" << (int)ac.first << "," << (int)ac.second + << ")"; + i++; + } + + SLEEP_MS(duration / N); + } while (!Util::hasElapsed(now, duration)); + + if (id > 0 && isEnrolled) { + mLockoutTracker.reset(); + cb->onAuthenticationSucceeded(id, {} /* hat */); + return; + } else { + LOG(ERROR) << "Fail: face not enrolled"; + mLockoutTracker.addFailedAttempt(cb); cb->onAuthenticationFailed(); - cb->onError(Error::UNABLE_TO_PROCESS, 0 /* vendorError */); + cb->onError(Error::TIMEOUT, 0 /* vendorError*/); return; } +} + +std::pair FakeFaceEngine::convertAcquiredInfo(int32_t code) { + std::pair res; + if (code > FACE_ACQUIRED_VENDOR_BASE) { + res.first = AcquiredInfo::VENDOR; + res.second = code - FACE_ACQUIRED_VENDOR_BASE; + } else { + res.first = (AcquiredInfo)code; + res.second = 0; + } + return res; +} - cb->onAuthenticationSucceeded(id, {} /* hat */); +std::pair FakeFaceEngine::convertError(int32_t code) { + std::pair res; + if (code > FACE_ERROR_VENDOR_BASE) { + res.first = Error::VENDOR; + res.second = code - FACE_ERROR_VENDOR_BASE; + } else { + res.first = (Error)code; + res.second = 0; + } + return res; } void FakeFaceEngine::detectInteractionImpl(ISessionCallback* cb, const std::future& cancel) { @@ -312,7 +414,8 @@ void FakeFaceEngine::resetLockoutImpl(ISessionCallback* cb, const keymaster::HardwareAuthToken& /*hat*/) { BEGIN_OP(0); FaceHalProperties::lockout(false); + mLockoutTracker.reset(); cb->onLockoutCleared(); } -} // namespace aidl::android::hardware::biometrics::face \ No newline at end of file +} // namespace aidl::android::hardware::biometrics::face diff --git a/biometrics/face/aidl/default/FakeFaceEngine.h b/biometrics/face/aidl/default/FakeFaceEngine.h index edb54ce0f8640bf109deee46fb71e4fd1bae624e..8d9303c491205b6e7d77645006c49e3adf325398 100644 --- a/biometrics/face/aidl/default/FakeFaceEngine.h +++ b/biometrics/face/aidl/default/FakeFaceEngine.h @@ -21,11 +21,12 @@ #include #include -#include - #include +#include #include +#include "FakeLockoutTracker.h" + namespace aidl::android::hardware::biometrics::face { namespace face = aidl::android::hardware::biometrics::face; @@ -37,6 +38,7 @@ using aidl::android::hardware::common::NativeHandle; class FakeFaceEngine { public: FakeFaceEngine() : mRandom(std::mt19937::default_seed) {} + virtual ~FakeFaceEngine() {} static face::FaceSensorType GetSensorType(); static common::SensorStrength GetSensorStrength(); @@ -59,7 +61,21 @@ class FakeFaceEngine { void invalidateAuthenticatorIdImpl(ISessionCallback* cb); void resetLockoutImpl(ISessionCallback* cb, const keymaster::HardwareAuthToken& /*hat*/); + virtual std::string toString() const { + std::ostringstream os; + os << "----- FakeFaceEngine:: -----" << std::endl; + os << mLockoutTracker.toString(); + return os.str(); + } + std::mt19937 mRandom; + + private: + static constexpr int32_t FACE_ACQUIRED_VENDOR_BASE = 1000; + static constexpr int32_t FACE_ERROR_VENDOR_BASE = 1000; + std::pair convertAcquiredInfo(int32_t code); + std::pair convertError(int32_t code); + FakeLockoutTracker mLockoutTracker; }; -} // namespace aidl::android::hardware::biometrics::face \ No newline at end of file +} // namespace aidl::android::hardware::biometrics::face diff --git a/biometrics/face/aidl/default/FakeLockoutTracker.cpp b/biometrics/face/aidl/default/FakeLockoutTracker.cpp new file mode 100644 index 0000000000000000000000000000000000000000..70bf08ee219db810e944b22a84fe41ef4d12acac --- /dev/null +++ b/biometrics/face/aidl/default/FakeLockoutTracker.cpp @@ -0,0 +1,138 @@ +/* + * Copyright (C) 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#define LOG_TAG "FaceVirtualHalLockoutTracker" + +#include "FakeLockoutTracker.h" +#include +#include +#include "util/Util.h" + +using namespace ::android::face::virt; + +namespace aidl::android::hardware::biometrics::face { + +void FakeLockoutTracker::reset(bool dueToTimerExpire) { + if (!dueToTimerExpire) { + mFailedCount = 0; + mLastFailedTime = 0; + } + mTimedFailedCount = 0; + mCurrentMode = LockoutMode::kNone; + abortTimer(); +} + +void FakeLockoutTracker::addFailedAttempt(ISessionCallback* cb) { + bool lockoutEnabled = FaceHalProperties::lockout_enable().value_or(false); + bool timedLockoutenabled = FaceHalProperties::lockout_timed_enable().value_or(false); + if (lockoutEnabled) { + mFailedCount++; + mTimedFailedCount++; + mLastFailedTime = Util::getSystemNanoTime(); + int32_t lockoutTimedThreshold = FaceHalProperties::lockout_timed_threshold().value_or(3); + int32_t lockoutPermanetThreshold = + FaceHalProperties::lockout_permanent_threshold().value_or(5); + if (mFailedCount >= lockoutPermanetThreshold) { + mCurrentMode = LockoutMode::kPermanent; + LOG(ERROR) << "FakeLockoutTracker: lockoutPermanent"; + cb->onLockoutPermanent(); + abortTimer(); + } else if (timedLockoutenabled && mTimedFailedCount >= lockoutTimedThreshold) { + if (mCurrentMode == LockoutMode::kNone) { + mCurrentMode = LockoutMode::kTimed; + startLockoutTimer(getTimedLockoutDuration(), cb); + } + LOG(ERROR) << "FakeLockoutTracker: lockoutTimed"; + cb->onLockoutTimed(getLockoutTimeLeft()); + } + } else { + reset(); + } +} + +FakeLockoutTracker::LockoutMode FakeLockoutTracker::getMode() { + return mCurrentMode; +} + +int32_t FakeLockoutTracker::getTimedLockoutDuration() { + return FaceHalProperties::lockout_timed_duration().value_or(10 * 1000); +} + +int64_t FakeLockoutTracker::getLockoutTimeLeft() { + int64_t res = 0; + + if (mLastFailedTime > 0) { + auto now = Util::getSystemNanoTime(); + auto elapsed = (now - mLastFailedTime) / 1000000LL; + res = getTimedLockoutDuration() - elapsed; + LOG(INFO) << "elapsed=" << elapsed << " now = " << now + << " mLastFailedTime=" << mLastFailedTime << " res=" << res; + } + + return res; +} + +bool FakeLockoutTracker::checkIfLockout(ISessionCallback* cb) { + if (mCurrentMode == LockoutMode::kPermanent) { + LOG(ERROR) << "Lockout permanent"; + cb->onLockoutPermanent(); + return true; + } else if (mCurrentMode == LockoutMode::kTimed) { + auto timeLeft = getLockoutTimeLeft(); + LOG(ERROR) << "Lockout timed " << timeLeft; + cb->onLockoutTimed(timeLeft); + return true; + } + return false; +} + +void FakeLockoutTracker::startLockoutTimer(int64_t timeout, ISessionCallback* cb) { + LOG(ERROR) << "startLockoutTimer: to=" << timeout; + if (mIsLockoutTimerStarted) return; + std::function action = + std::bind(&FakeLockoutTracker::lockoutTimerExpired, this, std::placeholders::_1); + std::thread([timeout, action, cb]() { + std::this_thread::sleep_for(std::chrono::milliseconds(timeout)); + action(cb); + }).detach(); + + mIsLockoutTimerStarted = true; +} + +void FakeLockoutTracker::lockoutTimerExpired(ISessionCallback* cb) { + LOG(INFO) << "lockout timer expired"; + mIsLockoutTimerStarted = false; + + if (mIsLockoutTimerAborted) { + mIsLockoutTimerAborted = false; + return; + } + + // if more failures seen since the timer started, need to restart timer again + auto deltaTime = getLockoutTimeLeft(); + if (deltaTime <= 0) { + cb->onLockoutCleared(); + reset(true); + } else { + startLockoutTimer(deltaTime, cb); + } +} + +void FakeLockoutTracker::abortTimer() { + if (mIsLockoutTimerStarted) mIsLockoutTimerAborted = true; +} + +} // namespace aidl::android::hardware::biometrics::face diff --git a/biometrics/face/aidl/default/FakeLockoutTracker.h b/biometrics/face/aidl/default/FakeLockoutTracker.h new file mode 100644 index 0000000000000000000000000000000000000000..f2d38f3608c3cfdab5f0f9039ed663e8b377c627 --- /dev/null +++ b/biometrics/face/aidl/default/FakeLockoutTracker.h @@ -0,0 +1,70 @@ +/* + * Copyright (C) 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include +#include +#include +#include + +namespace aidl::android::hardware::biometrics::face { + +// Lockout implementation for Face Virtual HAL +class FakeLockoutTracker { + public: + FakeLockoutTracker() + : mFailedCount(0), + mLastFailedTime(0), + mIsLockoutTimerStarted(false), + mIsLockoutTimerAborted(false) {} + ~FakeLockoutTracker() {} + + enum class LockoutMode : int8_t { kNone = 0, kTimed, kPermanent }; + + bool checkIfLockout(ISessionCallback*); + void addFailedAttempt(ISessionCallback*); + int64_t getLockoutTimeLeft(); + LockoutMode getMode(); + void reset(bool dueToTimerExpire = false); + inline std::string toString() const { + std::ostringstream os; + os << "----- FakeLockoutTracker:: -----" << std::endl; + os << "mFailedCount:" << mFailedCount; + os << ", mCurrentMode:" << (int)mCurrentMode; + os << ", mLastFailedTime:" << (int)(mLastFailedTime / 1000000LL); + os << ", mIsLockoutTimerStarted:" << mIsLockoutTimerStarted; + os << ", mIsLockoutTimerAborted:" << mIsLockoutTimerAborted; + os << std::endl; + return os.str(); + } + + private: + void startLockoutTimer(int64_t timeout, ISessionCallback* cb); + void lockoutTimerExpired(ISessionCallback* cb); + int32_t getTimedLockoutDuration(); + void abortTimer(); + + private: + int32_t mFailedCount; + int32_t mTimedFailedCount; + int64_t mLastFailedTime; + LockoutMode mCurrentMode; + bool mIsLockoutTimerStarted; + bool mIsLockoutTimerAborted; +}; + +} // namespace aidl::android::hardware::biometrics::face diff --git a/biometrics/face/aidl/default/README.md b/biometrics/face/aidl/default/README.md index 16559733c09a568f873e57be4584f51ba11ee5b5..c9a8cfeeaa5761fbd627de2e2a55cf6f31ca3aa6 100644 --- a/biometrics/face/aidl/default/README.md +++ b/biometrics/face/aidl/default/README.md @@ -1,77 +1,127 @@ -# Virtual Face HAL +# Face Virtual HAL (VHAL) -This is a virtual HAL implementation that is backed by system properties -instead of actual hardware. It's intended for testing and UI development -on debuggable builds to allow devices to masquerade as alternative device -types and for emulators. +This is a virtual HAL implementation that is backed by system properties instead +of actual hardware. It's intended for testing and UI development on debuggable +builds to allow devices to masquerade as alternative device types and for +emulators. Note: The virtual face HAL feature development will be done in +phases. Refer to this doc often for the latest supported features -## Device Selection +## Supported Devices -You can either run the FakeFaceEngine on a [real device](#actual-device) or a [virtual device/cuttlefish](#getting-started-on-a-virtual-device-cuttlefish). This document should -help you to get started on either one. +The face virtual hal is automatically built in in all debug builds (userdebug
      +and eng) for the latest pixel devices and CF. The instructions in this doc
      +applies to all -After setting up a device, go ahead and try out [enrolling](#enrolling) & [authenticating](#authenticating) +## Enabling Face Virtual HAL -### Getting started on a Virtual Device (cuttlefish) +On pixel devicse (non-CF), by default (after manufacture reset), Face VHAL is
      +not enabled. Therefore real Face HAL is used. Face VHAL enabling is gated by the
      +following two AND conditions:
      +1. The Face VHAL feature flag (as part ofTrunk-development strategy) must be
      + turned on until the flags life-cycle ends. +2. The Face VHAL must be enabled via sysprop. +See the adb commands below -Note, I'm running this via a cloudtop virtual device. +## Getting Stared -1. Setup cuttlefish on cloudtop, See [this](https://g3doc.corp.google.com/company/teams/android/teampages/acloud/getting_started.md?cl=head) for more details. -2. acloud create --local-image -3. Enter in the shell command to disable hidl +A basic use case for a successful authentication via Face VHAL is given as an +exmple below. + +### Enabling VHAL ```shell $ adb root -$ adb shell settings put secure com.android.server.biometrics.AuthService.hidlDisabled 1 +$ adb shell device_config put biometrics_framework com.android.server.biometrics.face_vhal_feature true +$ adb shell settings put secure biometric_virtual_enabled 1 +$ adb shell setprop persist.vendor.face.virtual.strength strong +$ adb shell setprop persist.vendor.face.virtual.type RGB $ adb reboot ``` -4. You should now be able to do fake enrollments and authentications (as seen down below) -### Actual Device +### Direct Enrollment -1. Modify your real devices make file (I.E. vendor/google/products/{YOUR_DEVICE}.mk) -2. Ensure that there is no other face HAL that is being included by the device -3. Add the following +```shell +$ adb shell locksettings set-pin 0000 +$ adb shell setprop persist.vendor.face.virtual.enrollments 1 +$ adb shell cmd face syncadb shell cmd face sync ``` -PRODUCT_COPY_FILES += \ - frameworks/native/data/etc/android.hardware.biometrics.face.xml:$(TARGET_COPY_OUT_PRODUCT)/etc/permissions/android.hardware.biometrics.face.xml -PRODUCT_PACKAGES += \ - android.hardware.biometrics.face-service.example \ +## Authenticating -``` -4. Now build and flash m -j120 && flash -5. Run the following commands +To authenticate successfully, the captured (hit) must match the enrollment id
      +set above. To trigger authentication failure, set the hit id to a different value. +`shell +$ adb shell setprop vendor.face.virtual.operation_authenticate_duration 800 +$ adb shell setprop vendor.face.virtual.enrollment_hit 1` -```shell -# This is a temporary workaround -$ adb root -$ adb shell setprop persist.vendor.face.virtual.type RGB -$ adb shell setprop persist.vendor.face.virtual.strength strong -$ adb shell locksettings set-pin 0000 -$ adb reboot -``` +### AcquiredInfo -## Enrolling +AcquiredInfo codes can be sent during authentication by specifying the sysprop.
      +The codes is sent in sequence and in the interval of operation_authentication_duration/numberOfAcquiredInfoCode +`shell +$ adb shell setprop vendor.face.virtual.operation_authenticate_acquired 6,9,1013` +Refer to [AcquiredInfo.aidl](https://source.corp.google.com/h/googleplex-android/platform/superproject/main/+/main:hardware/interfaces/biometrics/face/aidl/android/hardware/biometrics/face/AcquiredInfo.aidl) for full face acquiredInfo codes. +Note: For vendor specific acquired info, acquiredInfo = 1000 + vendorCode. -```shell -# authenticar_id,bucket_id:duration:(true|false).... -$ adb shell setprop vendor.face.virtual.next_enrollment 1,0:500:true,5:250:true,10:150:true,15:500:true -$ adb shell am start -n com.android.settings/.biometrics.face.FaceEnrollIntroduction -# If you would like to get rid of the enrollment, run the follwoing command -$ adb shell setprop persist.vendor.face.virtual.enrollments \"\" -``` +### Error Insertion -## Authenticating +Error can be inserted during authentction by specifying the authenticate_error +sysprop. `shell $ adb shell setprop +vendor.face.virtual.operation_authenticate_error 4` Refer to +[Error.aidl](https://source.corp.google.com/h/googleplex-android/platform/superproject/main/+/main:hardware/interfaces/biometrics/face/aidl/android/hardware/biometrics/face/Error.aidl) +for full face error codes + +## Enrollment via Settings + +Enrollment process is specified by sysprop `next_enrollment` in the following +format ```shell -# If enrollment hasn't been setup -$ adb shell setprop persist.vendor.face.virtual.enrollments 1 -$ adb shell cmd face sync -# After enrollment has been setup -$ adb shell setprop vendor.face.virtual.operation_authenticate_duration 800 -$ adb shell setprop vendor.face.virtual.enrollment_hit 1 -# Power button press to simulate auth -$ adb shell input keyevent 26 +Format: : + ----:-----------------------------------:--------- + | | |--->sucess (true/false) + | |--> progress_step(s) + | + |-->enrollment_id + +E.g. +$ adb shell setprop vendor.face.virtual.next_enrollment 1:6000-[21,8,1,1108,1,10,1113,1,1118,1124]:true ``` + +If next_enrollment prop is not set, the following default value is used:
      +  defaultNextEnrollment="1:1000-[21,7,1,1103],1500-[1108,1],2000-[1113,1],2500-[1118,1]:true"
      +Note: Enrollment data and configuration can be supported upon request in case of needs + +## Lockout + +Device lockout is based on the number of consecutive failed authentication attempts. There are a few +flavors of lockout mechanisms that are supported by virtula HAL
      + +### Permanent Lockout + +There are two sysprop to control permanent lockout
      +1. general lockout feature enable
      +2. threshold of failed attempts
      +`shell +$ adb shell setprop persist.vendor.face.virtual.lockout_enable true +$ adb shell setprop persist.vendor.face.virtual.lockout_permanent_threshold 3` + +### Temporary Lockout + +There are a few parameters to control temporary lockout (aka timed lockout):
      +1. enable lockout (general lockout feature enable, and timed lcokout enable)
      +2. threshold of failed attempts
      +3. timeout in ms
      +`shell +$ adb shell setprop persist.vendor.face.virtual.lockout_enable true +$ adb shell setprop persist.vendor.face.virtual.lockout_timed_enable true +$ adb shell setprop persist.vendor.face.virtual.lockout_timed_threshold 5 +$ adb shell setprop persist.vendor.face.virtual.lockout_timed_duration 10000` + +### Forced Lockout + +A permanent lockout can be inserted on next authentication attempt independent of the failed
      +attempt count. This is a feature purely for test purpose. +`shell +$ adb shell setprop persist.vendor.face.virtual.lockout true` diff --git a/biometrics/face/aidl/default/Session.cpp b/biometrics/face/aidl/default/Session.cpp index 1188459f3f3ff9f41403a853b9e1fc9bc46252f7..6f3f2fc22f9912019405af220d50b8c196ac7c89 100644 --- a/biometrics/face/aidl/default/Session.cpp +++ b/biometrics/face/aidl/default/Session.cpp @@ -18,6 +18,9 @@ #include "Session.h" +#undef LOG_TAG +#define LOG_TAG "FaceVirtualHalSession" + namespace aidl::android::hardware::biometrics::face { constexpr size_t MAX_WORKER_QUEUE_SIZE = 5; @@ -172,4 +175,10 @@ ndk::ScopedAStatus Session::onContextChanged(const common::OperationContext& /*c return ndk::ScopedAStatus::ok(); } +ndk::ScopedAStatus Session::enrollWithOptions(const FaceEnrollOptions& options, + std::shared_ptr* out) { + return enroll(options.hardwareAuthToken, options.enrollmentType, options.features, + options.nativeHandlePreview, out); +} + } // namespace aidl::android::hardware::biometrics::face diff --git a/biometrics/face/aidl/default/Session.h b/biometrics/face/aidl/default/Session.h index 7ca6a1f4ffffa464b5bf5366d2e21588b0763b2d..ce6e7f1b888ddfacabe39b0165ca18f5a850cfa6 100644 --- a/biometrics/face/aidl/default/Session.h +++ b/biometrics/face/aidl/default/Session.h @@ -19,6 +19,7 @@ #include #include +#include #include #include "FakeFaceEngine.h" @@ -88,6 +89,10 @@ class Session : public BnSession { ndk::ScopedAStatus onContextChanged(const common::OperationContext& context) override; + ndk::ScopedAStatus enrollWithOptions( + const FaceEnrollOptions& options, + std::shared_ptr* out) override; + private: std::unique_ptr mEngine; std::shared_ptr mCb; diff --git a/biometrics/face/aidl/default/apex/Android.bp b/biometrics/face/aidl/default/apex/Android.bp index 0ae14638c5cd6393abed127539887f4c468787b3..86c4e12435ee4094c4f642c23cc4fd343c0c32ca 100644 --- a/biometrics/face/aidl/default/apex/Android.bp +++ b/biometrics/face/aidl/default/apex/Android.bp @@ -17,7 +17,7 @@ package { } apex { - name: "com.android.hardware.biometrics.face", + name: "com.android.hardware.biometrics.face.virtual", manifest: "manifest.json", file_contexts: "file_contexts", key: "com.android.hardware.key", @@ -31,11 +31,9 @@ apex { ], prebuilts: [ // init_rc - "face-default-apex.rc", + "face-example-apex.rc", // vintf_fragment - "face-default-apex.xml", - // permission - "android.hardware.biometrics.face.prebuilt.xml", + "face-example-apex.xml", ], overrides: [ @@ -44,23 +42,21 @@ apex { } prebuilt_etc { - name: "face-default-apex.rc", - src: ":gen-face-default-apex.rc", - vendor: true, + name: "face-example-apex.rc", + src: ":gen-face-example-apex.rc", installable: false, } genrule { - name: "gen-face-default-apex.rc", - srcs: [":face-default.rc"], - out: ["face-default-apex.rc"], - cmd: "sed -e 's@/vendor/bin/@/apex/com.android.hardware.biometrics.face/bin/@' $(in) > $(out)", + name: "gen-face-example-apex.rc", + srcs: [":face-example.rc"], + out: ["face-example-apex.rc"], + cmd: "sed -e 's@/vendor/bin/@/apex/com.android.hardware.biometrics.face.virtual/bin/@' $(in) > $(out)", } prebuilt_etc { - name: "face-default-apex.xml", - src: ":face-default.xml", + name: "face-example-apex.xml", + src: ":face-example.xml", sub_dir: "vintf", - vendor: true, installable: false, } diff --git a/biometrics/face/aidl/default/apex/manifest.json b/biometrics/face/aidl/default/apex/manifest.json index 4d46896a15c4cb0ca8daaef563b578ecfa767acf..e7d177b0ac2e9e38e70ffbb2eae7e49a23927911 100644 --- a/biometrics/face/aidl/default/apex/manifest.json +++ b/biometrics/face/aidl/default/apex/manifest.json @@ -1,4 +1,4 @@ { - "name": "com.android.hardware.biometrics.face", - "version": 1 + "name": "com.android.hardware.biometrics.face.virtual", + "version": 2 } diff --git a/biometrics/face/aidl/default/face-default.rc b/biometrics/face/aidl/default/face-default.rc deleted file mode 100644 index f6499f0a099f5b8943377dcc3950a7093c10b07e..0000000000000000000000000000000000000000 --- a/biometrics/face/aidl/default/face-default.rc +++ /dev/null @@ -1,5 +0,0 @@ -service vendor.face-default /vendor/bin/hw/android.hardware.biometrics.face-service.example - class hal - user nobody - group nobody - diff --git a/biometrics/face/aidl/default/face-example.rc b/biometrics/face/aidl/default/face-example.rc new file mode 100644 index 0000000000000000000000000000000000000000..b0d82c60c5b8f39dd718bdd5768a11f5b378a9a8 --- /dev/null +++ b/biometrics/face/aidl/default/face-example.rc @@ -0,0 +1,8 @@ +service vendor.face-example /vendor/bin/hw/android.hardware.biometrics.face-service.example + class hal + user nobody + group nobody + interface aidl android.hardware.biometrics.face.IFace/virtual + oneshot + disabled + diff --git a/biometrics/face/aidl/default/face-default.xml b/biometrics/face/aidl/default/face-example.xml similarity index 67% rename from biometrics/face/aidl/default/face-default.xml rename to biometrics/face/aidl/default/face-example.xml index 8f2fbb8defb761004416163433d522c55670f91b..2b39b3d7839f39edbccdf52f594661b68115f156 100644 --- a/biometrics/face/aidl/default/face-default.xml +++ b/biometrics/face/aidl/default/face-example.xml @@ -1,7 +1,7 @@ android.hardware.biometrics.face - 3 - IFace/default + 4 + IFace/virtual diff --git a/biometrics/face/aidl/default/face.sysprop b/biometrics/face/aidl/default/face.sysprop index 6b0f37fec5c9266d4ab98a92cfd4d15f770ef95f..95b0b43ca7df61dd905434f334066761cae3169d 100644 --- a/biometrics/face/aidl/default/face.sysprop +++ b/biometrics/face/aidl/default/face.sysprop @@ -92,7 +92,7 @@ prop { api_name: "challenge" } -# if locked out +# if forced to lock out (Default to false) prop { prop_name: "vendor.face.virtual.lockout" type: Boolean @@ -157,3 +157,66 @@ prop { access: ReadWrite api_name: "operation_authenticate_duration" } + +# insert error for authenticate operations +prop { + prop_name: "vendor.face.virtual.operation_authenticate_error" + type: Integer + scope: Internal + access: ReadWrite + api_name: "operation_authenticate_error" +} + +# acquired info during authentication in format of sequence +prop { + prop_name: "vendor.face.virtual.operation_authenticate_acquired" + type: String + scope: Internal + access: ReadWrite + api_name: "operation_authenticate_acquired" +} + +# whether support lockout based on the failed auth attempts (default: false) +prop { + prop_name: "persist.vendor.face.virtual.lockout_enable" + type: Boolean + scope: Internal + access: ReadWrite + api_name: "lockout_enable" +} + +# whether support timed_lockout based on the failed auth attempts (default: false) +prop { + prop_name: "persist.vendor.face.virtual.lockout_timed_enable" + type: Boolean + scope: Internal + access: ReadWrite + api_name: "lockout_timed_enable" +} + +# temperory lockout threshold in number of consecutive failed auth attempts +prop { + prop_name: "persist.vendor.face.virtual.lockout_timed_threshold" + type: Integer + scope: Internal + access: ReadWrite + api_name: "lockout_timed_threshold" +} + +# temporary lockout duration in ms (default: 10000ms) +prop { + prop_name: "persist.vendor.face.virtual.lockout_timed_duration" + type: Integer + scope: Internal + access: ReadWrite + api_name: "lockout_timed_duration" +} + +# permanently lockout threshold in number of consecutive failed auth attempts +prop { + prop_name: "persist.vendor.face.virtual.lockout_permanent_threshold" + type: Integer + scope: Internal + access: ReadWrite + api_name: "lockout_permanent_threshold" +} diff --git a/biometrics/face/aidl/default/main.cpp b/biometrics/face/aidl/default/main.cpp index b7274e386a5029545d4028921e99fbeab3361fd9..38e1c6311d2d0cddd5cadfd5e7ef0a057285ffc2 100644 --- a/biometrics/face/aidl/default/main.cpp +++ b/biometrics/face/aidl/default/main.cpp @@ -27,9 +27,11 @@ int main() { ABinderProcess_setThreadPoolMaxThreadCount(0); std::shared_ptr hal = ndk::SharedRefBase::make(); - const std::string instance = std::string(Face::descriptor) + "/default"; - binder_status_t status = AServiceManager_addService(hal->asBinder().get(), instance.c_str()); + const std::string instance = std::string(Face::descriptor) + "/virtual"; + binder_status_t status = + AServiceManager_registerLazyService(hal->asBinder().get(), instance.c_str()); CHECK_EQ(status, STATUS_OK); + AServiceManager_forceLazyServicesPersist(true); ABinderProcess_joinThreadPool(); return EXIT_FAILURE; // should not reach diff --git a/biometrics/face/aidl/default/tests/FakeFaceEngineTest.cpp b/biometrics/face/aidl/default/tests/FakeFaceEngineTest.cpp index c8ad6b7dc380abff4896bfe4f9f55b662b396d2a..69c9bf457b2939a3d3af8b56b72a434fe1581daf 100644 --- a/biometrics/face/aidl/default/tests/FakeFaceEngineTest.cpp +++ b/biometrics/face/aidl/default/tests/FakeFaceEngineTest.cpp @@ -45,6 +45,7 @@ class TestSessionCallback : public BnSessionCallback { }; ::ndk::ScopedAStatus onEnrollmentProgress(int32_t enrollmentId, int32_t remaining) override { if (remaining == 0) mLastEnrolled = enrollmentId; + mRemaining = remaining; return ndk::ScopedAStatus::ok(); }; @@ -128,6 +129,7 @@ class TestSessionCallback : public BnSessionCallback { bool mAuthenticatorIdInvalidated = false; bool mLockoutPermanent = false; int mInteractionDetectedCount = 0; + int mRemaining = -1; }; class FakeFaceEngineTest : public ::testing::Test { @@ -193,7 +195,7 @@ TEST_F(FakeFaceEngineTest, AuthenticatorIdInvalidate) { } TEST_F(FakeFaceEngineTest, Enroll) { - FaceHalProperties::next_enrollment("1,0:30:true,1:0:true,2:0:true,3:0:true,4:0:true"); + FaceHalProperties::next_enrollment("1,0:1000-[21,5,6,7,1],1100-[1118,1108,1]:true"); keymaster::HardwareAuthToken hat{.mac = {2, 4}}; mEngine.enrollImpl(mCallback.get(), hat, {} /*enrollmentType*/, {} /*features*/, mCancel.get_future()); @@ -201,10 +203,11 @@ TEST_F(FakeFaceEngineTest, Enroll) { ASSERT_EQ(1, FaceHalProperties::enrollments().size()); ASSERT_EQ(1, FaceHalProperties::enrollments()[0].value()); ASSERT_EQ(1, mCallback->mLastEnrolled); + ASSERT_EQ(0, mCallback->mRemaining); } TEST_F(FakeFaceEngineTest, EnrollFails) { - FaceHalProperties::next_enrollment("1,0:30:true,1:0:true,2:0:true,3:0:true,4:0:false"); + FaceHalProperties::next_enrollment("1,0:1000-[21,5,6,7,1],1100-[1118,1108,1]:false"); keymaster::HardwareAuthToken hat{.mac = {2, 4}}; mEngine.enrollImpl(mCallback.get(), hat, {} /*enrollmentType*/, {} /*features*/, mCancel.get_future()); @@ -213,7 +216,7 @@ TEST_F(FakeFaceEngineTest, EnrollFails) { } TEST_F(FakeFaceEngineTest, EnrollCancel) { - FaceHalProperties::next_enrollment("1,0:30:true,1:0:true,2:0:true,3:0:true,4:0:false"); + FaceHalProperties::next_enrollment("1:2000-[21,8,9],300:false"); keymaster::HardwareAuthToken hat{.mac = {2, 4}}; mCancel.set_value(); mEngine.enrollImpl(mCallback.get(), hat, {} /*enrollmentType*/, {} /*features*/, @@ -221,7 +224,7 @@ TEST_F(FakeFaceEngineTest, EnrollCancel) { ASSERT_EQ(Error::CANCELED, mCallback->mError); ASSERT_EQ(-1, mCallback->mLastEnrolled); ASSERT_EQ(0, FaceHalProperties::enrollments().size()); - ASSERT_FALSE(FaceHalProperties::next_enrollment().has_value()); + ASSERT_TRUE(FaceHalProperties::next_enrollment().has_value()); } TEST_F(FakeFaceEngineTest, Authenticate) { @@ -245,7 +248,7 @@ TEST_F(FakeFaceEngineTest, AuthenticateFailedForUnEnrolled) { FaceHalProperties::enrollments({3}); FaceHalProperties::enrollment_hit(100); mEngine.authenticateImpl(mCallback.get(), 0 /* operationId*/, mCancel.get_future()); - ASSERT_EQ(Error::UNABLE_TO_PROCESS, mCallback->mError); + ASSERT_EQ(Error::TIMEOUT, mCallback->mError); ASSERT_TRUE(mCallback->mAuthenticateFailed); } @@ -380,4 +383,4 @@ TEST_F(FakeFaceEngineTest, ResetLockoutWithAuth) { ASSERT_FALSE(mCallback->mAuthenticateFailed); } -} // namespace aidl::android::hardware::biometrics::face \ No newline at end of file +} // namespace aidl::android::hardware::biometrics::face diff --git a/biometrics/face/aidl/default/tests/FakeLockoutTrackerTest.cpp b/biometrics/face/aidl/default/tests/FakeLockoutTrackerTest.cpp new file mode 100644 index 0000000000000000000000000000000000000000..fa07d1dfeb25deaec7ee28434f70372bd9cce132 --- /dev/null +++ b/biometrics/face/aidl/default/tests/FakeLockoutTrackerTest.cpp @@ -0,0 +1,216 @@ +/* + * Copyright (C) 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include +#include +#include + +#include + +#include "FakeLockoutTracker.h" +#include "util/Util.h" + +using namespace ::android::face::virt; +using namespace ::aidl::android::hardware::biometrics::face; + +namespace aidl::android::hardware::biometrics::face { + +class TestSessionCallback : public BnSessionCallback { + public: + ndk::ScopedAStatus onChallengeGenerated(int64_t /*challenge*/) override { + return ndk::ScopedAStatus::ok(); + }; + ::ndk::ScopedAStatus onChallengeRevoked(int64_t /*challenge*/) override { + return ndk::ScopedAStatus::ok(); + }; + ::ndk::ScopedAStatus onError(face::Error, int32_t /*vendorCode*/) override { + return ndk::ScopedAStatus::ok(); + }; + ::ndk::ScopedAStatus onEnrollmentProgress(int32_t /*enrollmentId*/, + int32_t /*remaining*/) override { + return ndk::ScopedAStatus::ok(); + }; + ::ndk::ScopedAStatus onAuthenticationSucceeded(int32_t /*enrollmentId*/, + const keymaster::HardwareAuthToken&) override { + return ndk::ScopedAStatus::ok(); + }; + ::ndk::ScopedAStatus onAuthenticationFailed() override { return ndk::ScopedAStatus::ok(); }; + ::ndk::ScopedAStatus onInteractionDetected() override { return ndk::ScopedAStatus::ok(); }; + ::ndk::ScopedAStatus onEnrollmentsEnumerated(const std::vector&) override { + return ndk::ScopedAStatus::ok(); + }; + ::ndk::ScopedAStatus onEnrollmentsRemoved( + const std::vector& /*enrollmentIds*/) override { + return ndk::ScopedAStatus::ok(); + }; + ::ndk::ScopedAStatus onAuthenticatorIdRetrieved(int64_t /*authenticatorId*/) override { + return ndk::ScopedAStatus::ok(); + }; + ::ndk::ScopedAStatus onAuthenticatorIdInvalidated(int64_t /*authenticatorId*/) override { + return ndk::ScopedAStatus::ok(); + }; + ::ndk::ScopedAStatus onEnrollmentFrame(const EnrollmentFrame&) override { + return ndk::ScopedAStatus::ok(); + } + ::ndk::ScopedAStatus onFeaturesRetrieved(const std::vector&) { + return ndk::ScopedAStatus::ok(); + }; + ::ndk::ScopedAStatus onFeatureSet(Feature) override { return ndk::ScopedAStatus::ok(); } + ::ndk::ScopedAStatus onSessionClosed() override { return ndk::ScopedAStatus::ok(); } + ::ndk::ScopedAStatus onAuthenticationFrame(const AuthenticationFrame&) override { + return ndk::ScopedAStatus::ok(); + } + + ndk::ScopedAStatus onLockoutTimed(int64_t timeLeft) override { + mLockoutTimed++; + mTimeLeft = timeLeft; + return ndk::ScopedAStatus::ok(); + }; + ::ndk::ScopedAStatus onLockoutPermanent() override { + mLockoutPermanent++; + return ndk::ScopedAStatus::ok(); + }; + ::ndk::ScopedAStatus onLockoutCleared() override { + mTimeLeft = 0; + mLockoutTimed = 0; + mLockoutPermanent = 0; + return ndk::ScopedAStatus::ok(); + }; + + int64_t mTimeLeft = 0; + int mLockoutTimed = 0; + int mLockoutPermanent = 0; +}; + +class FakeLockoutTrackerTest : public ::testing::Test { + protected: + static constexpr int32_t LOCKOUT_TIMED_THRESHOLD = 3; + static constexpr int32_t LOCKOUT_PERMANENT_THRESHOLD = 5; + static constexpr int32_t LOCKOUT_TIMED_DURATION = 100; + + void SetUp() override { + FaceHalProperties::lockout_timed_threshold(LOCKOUT_TIMED_THRESHOLD); + FaceHalProperties::lockout_timed_duration(LOCKOUT_TIMED_DURATION); + FaceHalProperties::lockout_permanent_threshold(LOCKOUT_PERMANENT_THRESHOLD); + mCallback = ndk::SharedRefBase::make(); + } + + void TearDown() override { + // reset to default + FaceHalProperties::lockout_timed_threshold(5); + FaceHalProperties::lockout_timed_duration(20); + FaceHalProperties::lockout_permanent_threshold(10000); + FaceHalProperties::lockout_enable(false); + FaceHalProperties::lockout(false); + } + + FakeLockoutTracker mLockoutTracker; + std::shared_ptr mCallback; +}; + +TEST_F(FakeLockoutTrackerTest, addFailedAttemptDisable) { + FaceHalProperties::lockout_enable(false); + for (int i = 0; i < LOCKOUT_TIMED_THRESHOLD + 1; i++) + mLockoutTracker.addFailedAttempt(mCallback.get()); + ASSERT_EQ(mLockoutTracker.getMode(), FakeLockoutTracker::LockoutMode::kNone); + ASSERT_EQ(0, mCallback->mLockoutTimed); +} + +TEST_F(FakeLockoutTrackerTest, addFailedAttemptPermanent) { + FaceHalProperties::lockout_enable(true); + ASSERT_FALSE(mLockoutTracker.checkIfLockout(mCallback.get())); + for (int i = 0; i < LOCKOUT_PERMANENT_THRESHOLD - 1; i++) + mLockoutTracker.addFailedAttempt(mCallback.get()); + ASSERT_NE(mLockoutTracker.getMode(), FakeLockoutTracker::LockoutMode::kPermanent); + ASSERT_EQ(0, mCallback->mLockoutPermanent); + mLockoutTracker.addFailedAttempt(mCallback.get()); + ASSERT_EQ(mLockoutTracker.getMode(), FakeLockoutTracker::LockoutMode::kPermanent); + ASSERT_EQ(1, mCallback->mLockoutPermanent); + ASSERT_TRUE(mLockoutTracker.checkIfLockout(mCallback.get())); + ASSERT_EQ(2, mCallback->mLockoutPermanent); +} + +TEST_F(FakeLockoutTrackerTest, addFailedAttemptLockoutTimed) { + FaceHalProperties::lockout_enable(true); + FaceHalProperties::lockout_timed_enable(true); + ASSERT_FALSE(mLockoutTracker.checkIfLockout(mCallback.get())); + for (int i = 0; i < LOCKOUT_TIMED_THRESHOLD; i++) + mLockoutTracker.addFailedAttempt(mCallback.get()); + ASSERT_EQ(mLockoutTracker.getMode(), FakeLockoutTracker::LockoutMode::kTimed); + ASSERT_EQ(1, mCallback->mLockoutTimed); + ASSERT_TRUE(mLockoutTracker.checkIfLockout(mCallback.get())); + ASSERT_EQ(2, mCallback->mLockoutTimed); + // time left + int N = 5; + int64_t prevTimeLeft = INT_MAX; + for (int i = 0; i < N; i++) { + SLEEP_MS(LOCKOUT_TIMED_DURATION / N + 1); + int64_t currTimeLeft = mLockoutTracker.getLockoutTimeLeft(); + ASSERT_TRUE(currTimeLeft < prevTimeLeft); + prevTimeLeft = currTimeLeft; + } + SLEEP_MS(LOCKOUT_TIMED_DURATION / N); + ASSERT_EQ(mLockoutTracker.getMode(), FakeLockoutTracker::LockoutMode::kNone); +} + +TEST_F(FakeLockoutTrackerTest, addFailedAttemptLockout_TimedThenPermanent) { + FaceHalProperties::lockout_enable(true); + FaceHalProperties::lockout_timed_enable(true); + ASSERT_FALSE(mLockoutTracker.checkIfLockout(mCallback.get())); + for (int i = 0; i < LOCKOUT_TIMED_THRESHOLD; i++) + mLockoutTracker.addFailedAttempt(mCallback.get()); + ASSERT_EQ(mLockoutTracker.getMode(), FakeLockoutTracker::LockoutMode::kTimed); + SLEEP_MS(LOCKOUT_TIMED_DURATION + 20); + ASSERT_EQ(mLockoutTracker.getMode(), FakeLockoutTracker::LockoutMode::kNone); + for (int i = 0; i < LOCKOUT_PERMANENT_THRESHOLD - LOCKOUT_TIMED_THRESHOLD; i++) + mLockoutTracker.addFailedAttempt(mCallback.get()); + ASSERT_EQ(mLockoutTracker.getMode(), FakeLockoutTracker::LockoutMode::kPermanent); +} + +TEST_F(FakeLockoutTrackerTest, addFailedAttemptLockoutTimedTwice) { + FaceHalProperties::lockout_enable(true); + FaceHalProperties::lockout_timed_enable(true); + ASSERT_FALSE(mLockoutTracker.checkIfLockout(mCallback.get())); + ASSERT_EQ(0, mCallback->mLockoutTimed); + for (int i = 0; i < LOCKOUT_TIMED_THRESHOLD; i++) + mLockoutTracker.addFailedAttempt(mCallback.get()); + SLEEP_MS(LOCKOUT_TIMED_DURATION / 2); + mLockoutTracker.addFailedAttempt(mCallback.get()); + SLEEP_MS(LOCKOUT_TIMED_DURATION); + ASSERT_EQ(2, mCallback->mLockoutTimed); + ASSERT_TRUE(mLockoutTracker.checkIfLockout(mCallback.get())); + SLEEP_MS(LOCKOUT_TIMED_DURATION); + ASSERT_FALSE(mLockoutTracker.checkIfLockout(mCallback.get())); +} + +TEST_F(FakeLockoutTrackerTest, resetLockout) { + FaceHalProperties::lockout_enable(true); + ASSERT_EQ(mLockoutTracker.getMode(), FakeLockoutTracker::LockoutMode::kNone); + for (int i = 0; i < LOCKOUT_PERMANENT_THRESHOLD; i++) + mLockoutTracker.addFailedAttempt(mCallback.get()); + ASSERT_EQ(mLockoutTracker.getMode(), FakeLockoutTracker::LockoutMode::kPermanent); + mLockoutTracker.reset(); + ASSERT_FALSE(mLockoutTracker.checkIfLockout(mCallback.get())); +} + +} // namespace aidl::android::hardware::biometrics::face + +int main(int argc, char** argv) { + testing::InitGoogleTest(&argc, argv); + ABinderProcess_startThreadPool(); + return RUN_ALL_TESTS(); +} diff --git a/biometrics/fingerprint/aidl/Android.bp b/biometrics/fingerprint/aidl/Android.bp index c543a93f087938b70af8cd89d65d06899a58ac43..1a099a54cbe749f82d4a74cd59930827c31da50f 100644 --- a/biometrics/fingerprint/aidl/Android.bp +++ b/biometrics/fingerprint/aidl/Android.bp @@ -14,7 +14,7 @@ aidl_interface { "android/hardware/biometrics/fingerprint/**/*.aidl", ], imports: [ - "android.hardware.biometrics.common-V3", + "android.hardware.biometrics.common-V4", "android.hardware.keymaster-V4", ], stability: "vintf", @@ -50,5 +50,5 @@ aidl_interface { }, ], - frozen: true, + frozen: false, } diff --git a/biometrics/fingerprint/aidl/default/Android.bp b/biometrics/fingerprint/aidl/default/Android.bp index a173a00d12cab90a795957f32eba3a6ee1256198..c3ec4d0f44ccd84f1f721b01e1cf4c3fea45e233 100644 --- a/biometrics/fingerprint/aidl/default/Android.bp +++ b/biometrics/fingerprint/aidl/default/Android.bp @@ -30,8 +30,8 @@ cc_binary { static_libs: [ "libandroid.hardware.biometrics.fingerprint.VirtualProps", "libbase", - "android.hardware.biometrics.fingerprint-V3-ndk", - "android.hardware.biometrics.common-V3-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.keymaster-V4-ndk", @@ -54,8 +54,8 @@ cc_test { ], static_libs: [ "libandroid.hardware.biometrics.fingerprint.VirtualProps", - "android.hardware.biometrics.fingerprint-V3-ndk", - "android.hardware.biometrics.common-V3-ndk", + "android.hardware.biometrics.fingerprint-V4-ndk", + "android.hardware.biometrics.common-V4-ndk", "android.hardware.keymaster-V4-ndk", "android.hardware.biometrics.common.util", ], @@ -80,8 +80,8 @@ cc_test { ], static_libs: [ "libandroid.hardware.biometrics.fingerprint.VirtualProps", - "android.hardware.biometrics.fingerprint-V3-ndk", - "android.hardware.biometrics.common-V3-ndk", + "android.hardware.biometrics.fingerprint-V4-ndk", + "android.hardware.biometrics.common-V4-ndk", "android.hardware.keymaster-V4-ndk", "android.hardware.biometrics.common.util", ], @@ -104,8 +104,8 @@ cc_test { ], static_libs: [ "libandroid.hardware.biometrics.fingerprint.VirtualProps", - "android.hardware.biometrics.fingerprint-V3-ndk", - "android.hardware.biometrics.common-V3-ndk", + "android.hardware.biometrics.fingerprint-V4-ndk", + "android.hardware.biometrics.common-V4-ndk", "android.hardware.keymaster-V4-ndk", "android.hardware.biometrics.common.util", ], @@ -130,8 +130,8 @@ cc_test { ], static_libs: [ "libandroid.hardware.biometrics.fingerprint.VirtualProps", - "android.hardware.biometrics.fingerprint-V3-ndk", - "android.hardware.biometrics.common-V3-ndk", + "android.hardware.biometrics.fingerprint-V4-ndk", + "android.hardware.biometrics.common-V4-ndk", "android.hardware.keymaster-V4-ndk", "android.hardware.biometrics.common.util", ], diff --git a/biometrics/fingerprint/aidl/default/FakeFingerprintEngine.cpp b/biometrics/fingerprint/aidl/default/FakeFingerprintEngine.cpp index 54076c88e3f35bb145eb421797e561924a9bc482..4e8005214e4f747eb77774b97addc535d0d3ddc1 100644 --- a/biometrics/fingerprint/aidl/default/FakeFingerprintEngine.cpp +++ b/biometrics/fingerprint/aidl/default/FakeFingerprintEngine.cpp @@ -32,7 +32,9 @@ using ::android::base::ParseInt; namespace aidl::android::hardware::biometrics::fingerprint { FakeFingerprintEngine::FakeFingerprintEngine() - : mRandom(std::mt19937::default_seed), mWorkMode(WorkMode::kIdle) {} + : mRandom(std::mt19937::default_seed), + mWorkMode(WorkMode::kIdle), + isLockoutTimerSupported(true) {} void FakeFingerprintEngine::generateChallengeImpl(ISessionCallback* cb) { BEGIN_OP(0); @@ -142,7 +144,7 @@ bool FakeFingerprintEngine::onEnrollFingerDown(ISessionCallback* cb, return true; } auto enrollmentId = std::stoi(parts[0]); - auto progress = parseEnrollmentCapture(parts[1]); + auto progress = Util::parseEnrollmentCapture(parts[1]); for (size_t i = 0; i < progress.size(); i += 2) { auto left = (progress.size() - i) / 2 - 1; auto duration = progress[i][0]; @@ -193,7 +195,7 @@ bool FakeFingerprintEngine::onAuthenticateFingerDown(ISessionCallback* cb, int64_t now = Util::getSystemNanoTime(); int64_t duration = FingerprintHalProperties::operation_authenticate_duration().value_or(10); auto acquired = FingerprintHalProperties::operation_authenticate_acquired().value_or("1"); - auto acquiredInfos = parseIntSequence(acquired); + auto acquiredInfos = Util::parseIntSequence(acquired); int N = acquiredInfos.size(); if (N == 0) { @@ -271,7 +273,7 @@ bool FakeFingerprintEngine::onDetectInteractFingerDown(ISessionCallback* cb, FingerprintHalProperties::operation_detect_interaction_duration().value_or(10); auto acquired = FingerprintHalProperties::operation_detect_interaction_acquired().value_or("1"); - auto acquiredInfos = parseIntSequence(acquired); + auto acquiredInfos = Util::parseIntSequence(acquired); int N = acquiredInfos.size(); int64_t now = Util::getSystemNanoTime(); @@ -305,15 +307,6 @@ bool FakeFingerprintEngine::onDetectInteractFingerDown(ISessionCallback* cb, SLEEP_MS(duration / N); } while (!Util::hasElapsed(now, duration)); - auto id = FingerprintHalProperties::enrollment_hit().value_or(0); - auto enrolls = FingerprintHalProperties::enrollments(); - auto isEnrolled = std::find(enrolls.begin(), enrolls.end(), id) != enrolls.end(); - if (id <= 0 || !isEnrolled) { - LOG(ERROR) << "Fail: not enrolled"; - cb->onError(Error::UNABLE_TO_PROCESS, 0 /* vendorError */); - return true; - } - cb->onInteractionDetected(); return true; @@ -386,7 +379,7 @@ void FakeFingerprintEngine::resetLockoutImpl(ISessionCallback* cb, return; } clearLockout(cb); - isLockoutTimerAborted = true; + if (isLockoutTimerStarted) isLockoutTimerAborted = true; } void FakeFingerprintEngine::clearLockout(ISessionCallback* cb) { @@ -450,76 +443,6 @@ SensorLocation FakeFingerprintEngine::defaultSensorLocation() { return SensorLocation(); } -std::vector FakeFingerprintEngine::parseIntSequence(const std::string& str, - const std::string& sep) { - std::vector seqs = Util::split(str, sep); - std::vector res; - - for (const auto& seq : seqs) { - int32_t val; - if (ParseInt(seq, &val)) { - res.push_back(val); - } else { - LOG(WARNING) << "Invalid int sequence:" + str; - res.clear(); - break; - } - } - - return res; -} - -bool FakeFingerprintEngine::parseEnrollmentCaptureSingle(const std::string& str, - std::vector>& res) { - std::vector defaultAcquiredInfo = {(int32_t)AcquiredInfo::GOOD}; - bool aborted = true; - - do { - std::smatch sms; - // Parses strings like "1000-[5,1]" or "500" - std::regex ex("((\\d+)(-\\[([\\d|,]+)\\])?)"); - if (!regex_match(str.cbegin(), str.cend(), sms, ex)) break; - int32_t duration; - if (!ParseInt(sms.str(2), &duration)) break; - res.push_back({duration}); - if (!sms.str(4).empty()) { - auto acqv = parseIntSequence(sms.str(4)); - if (acqv.empty()) break; - res.push_back(acqv); - } else - res.push_back(defaultAcquiredInfo); - aborted = false; - } while (0); - - return !aborted; -} - -std::vector> FakeFingerprintEngine::parseEnrollmentCapture( - const std::string& str) { - std::vector> res; - - std::string s(str); - s.erase(std::remove_if(s.begin(), s.end(), ::isspace), s.end()); - bool aborted = false; - std::smatch sms; - // Parses strings like "1000-[5,1],500,800-[6,5,1]" - // ---------- --- ----------- - // into parts: A B C - while (regex_search(s, sms, std::regex("^(,)?(\\d+(-\\[[\\d|,]+\\])?)"))) { - if (!parseEnrollmentCaptureSingle(sms.str(2), res)) { - aborted = true; - break; - } - s = sms.suffix(); - } - if (aborted || s.length() != 0) { - res.clear(); - LOG(ERROR) << "Failed to parse enrollment captures:" + str; - } - - return res; -} - std::pair FakeFingerprintEngine::convertAcquiredInfo(int32_t code) { std::pair res; if (code > FINGERPRINT_ACQUIRED_VENDOR_BASE) { @@ -603,6 +526,7 @@ void FakeFingerprintEngine::startLockoutTimer(int64_t timeout, ISessionCallback* isLockoutTimerStarted = true; } void FakeFingerprintEngine::lockoutTimerExpired(ISessionCallback* cb) { + BEGIN_OP(0); if (!isLockoutTimerAborted) { clearLockout(cb); } diff --git a/biometrics/fingerprint/aidl/default/FakeFingerprintEngineSide.cpp b/biometrics/fingerprint/aidl/default/FakeFingerprintEngineSide.cpp index a78cdcdbceac22b53864a309fb3451a5f81eda30..acb792de619e110f91cc9d0a1540a47f8567dce7 100644 --- a/biometrics/fingerprint/aidl/default/FakeFingerprintEngineSide.cpp +++ b/biometrics/fingerprint/aidl/default/FakeFingerprintEngineSide.cpp @@ -27,9 +27,7 @@ using namespace ::android::fingerprint::virt; namespace aidl::android::hardware::biometrics::fingerprint { -FakeFingerprintEngineSide::FakeFingerprintEngineSide() : FakeFingerprintEngine() { - isLockoutTimerSupported = true; -} +FakeFingerprintEngineSide::FakeFingerprintEngineSide() : FakeFingerprintEngine() {} SensorLocation FakeFingerprintEngineSide::defaultSensorLocation() { return SensorLocation{.sensorLocationX = defaultSensorLocationX, diff --git a/biometrics/fingerprint/aidl/default/fingerprint-example.xml b/biometrics/fingerprint/aidl/default/fingerprint-example.xml index e977b98a64c8409f73901eb8bd4670f6bbbc0def..827813ffc01b069ffbd7f294cef318cf6c198540 100644 --- a/biometrics/fingerprint/aidl/default/fingerprint-example.xml +++ b/biometrics/fingerprint/aidl/default/fingerprint-example.xml @@ -1,7 +1,7 @@ android.hardware.biometrics.fingerprint - 3 + 4 IFingerprint/virtual diff --git a/biometrics/fingerprint/aidl/default/include/FakeFingerprintEngine.h b/biometrics/fingerprint/aidl/default/include/FakeFingerprintEngine.h index 2450115aaf4d7b38cf1dc03dff20b23fb87ef51c..15d83604d5559a22f5b24213c34f74a8186ac5a9 100644 --- a/biometrics/fingerprint/aidl/default/include/FakeFingerprintEngine.h +++ b/biometrics/fingerprint/aidl/default/include/FakeFingerprintEngine.h @@ -68,10 +68,6 @@ class FakeFingerprintEngine { virtual void fingerDownAction(); - std::vector parseIntSequence(const std::string& str, const std::string& sep = ","); - - std::vector> parseEnrollmentCapture(const std::string& str); - int32_t getLatency(const std::vector>& latencyVec); std::mt19937 mRandom; @@ -110,8 +106,6 @@ class FakeFingerprintEngine { static constexpr int32_t FINGERPRINT_ERROR_VENDOR_BASE = 1000; std::pair convertAcquiredInfo(int32_t code); std::pair convertError(int32_t code); - bool parseEnrollmentCaptureSingle(const std::string& str, - std::vector>& res); int32_t getRandomInRange(int32_t bound1, int32_t bound2); bool checkSensorLockout(ISessionCallback*); void clearLockout(ISessionCallback* cb); diff --git a/biometrics/fingerprint/aidl/default/tests/FakeFingerprintEngineTest.cpp b/biometrics/fingerprint/aidl/default/tests/FakeFingerprintEngineTest.cpp index fe405f4110bc30982fa2187c35df6434feda08fd..eedcae1a3587a70d6e7fdd40d228508a9495753a 100644 --- a/biometrics/fingerprint/aidl/default/tests/FakeFingerprintEngineTest.cpp +++ b/biometrics/fingerprint/aidl/default/tests/FakeFingerprintEngineTest.cpp @@ -357,7 +357,7 @@ TEST_F(FakeFingerprintEngineTest, InteractionDetectNotSet) { FingerprintHalProperties::enrollment_hit({}); mEngine.detectInteractionImpl(mCallback.get(), mCancel.get_future()); mEngine.fingerDownAction(); - ASSERT_EQ(0, mCallback->mInteractionDetectedCount); + ASSERT_EQ(1, mCallback->mInteractionDetectedCount); } TEST_F(FakeFingerprintEngineTest, InteractionDetectNotEnrolled) { @@ -365,7 +365,7 @@ TEST_F(FakeFingerprintEngineTest, InteractionDetectNotEnrolled) { FingerprintHalProperties::enrollment_hit(25); mEngine.detectInteractionImpl(mCallback.get(), mCancel.get_future()); mEngine.fingerDownAction(); - ASSERT_EQ(0, mCallback->mInteractionDetectedCount); + ASSERT_EQ(1, mCallback->mInteractionDetectedCount); } TEST_F(FakeFingerprintEngineTest, InteractionDetectError) { @@ -421,29 +421,29 @@ TEST_F(FakeFingerprintEngineTest, RemoveEnrolled) { TEST_F(FakeFingerprintEngineTest, parseIntSequence) { std::vector seqV; - seqV = mEngine.parseIntSequence(""); + seqV = Util::parseIntSequence(""); ASSERT_EQ(0, seqV.size()); - seqV = mEngine.parseIntSequence("2"); + seqV = Util::parseIntSequence("2"); ASSERT_EQ(1, seqV.size()); ASSERT_EQ(2, seqV[0]); - seqV = mEngine.parseIntSequence("2,3,4"); + seqV = Util::parseIntSequence("2,3,4"); std::vector expV{2, 3, 4}; ASSERT_EQ(expV, seqV); - seqV = mEngine.parseIntSequence("2,3,a"); + seqV = Util::parseIntSequence("2,3,a"); ASSERT_EQ(0, seqV.size()); - seqV = mEngine.parseIntSequence("2, 3, 4"); + seqV = Util::parseIntSequence("2, 3, 4"); ASSERT_EQ(expV, seqV); - seqV = mEngine.parseIntSequence("123,456"); + seqV = Util::parseIntSequence("123,456"); ASSERT_EQ(2, seqV.size()); std::vector expV1{123, 456}; ASSERT_EQ(expV1, seqV); - seqV = mEngine.parseIntSequence("12f3,456"); + seqV = Util::parseIntSequence("12f3,456"); ASSERT_EQ(0, seqV.size()); } TEST_F(FakeFingerprintEngineTest, parseEnrollmentCaptureOk) { std::vector> ecV; - ecV = mEngine.parseEnrollmentCapture("100,200,300"); + ecV = Util::parseEnrollmentCapture("100,200,300"); ASSERT_EQ(6, ecV.size()); std::vector> expE{{100}, {200}, {300}}; std::vector defC{1}; @@ -451,26 +451,26 @@ TEST_F(FakeFingerprintEngineTest, parseEnrollmentCaptureOk) { ASSERT_EQ(expE[i / 2], ecV[i]); ASSERT_EQ(defC, ecV[i + 1]); } - ecV = mEngine.parseEnrollmentCapture("100"); + ecV = Util::parseEnrollmentCapture("100"); ASSERT_EQ(2, ecV.size()); ASSERT_EQ(expE[0], ecV[0]); ASSERT_EQ(defC, ecV[1]); - ecV = mEngine.parseEnrollmentCapture("100-[5,6,7]"); + ecV = Util::parseEnrollmentCapture("100-[5,6,7]"); std::vector expC{5, 6, 7}; ASSERT_EQ(2, ecV.size()); for (int i = 0; i < ecV.size(); i += 2) { ASSERT_EQ(expE[i / 2], ecV[i]); ASSERT_EQ(expC, ecV[i + 1]); } - ecV = mEngine.parseEnrollmentCapture("100-[5,6,7], 200, 300-[9,10]"); + ecV = Util::parseEnrollmentCapture("100-[5,6,7], 200, 300-[9,10]"); std::vector> expC1{{5, 6, 7}, {1}, {9, 10}}; ASSERT_EQ(6, ecV.size()); for (int i = 0; i < ecV.size(); i += 2) { ASSERT_EQ(expE[i / 2], ecV[i]); ASSERT_EQ(expC1[i / 2], ecV[i + 1]); } - ecV = mEngine.parseEnrollmentCapture("100-[5,6,7], 200-[2,1], 300-[9]"); + ecV = Util::parseEnrollmentCapture("100-[5,6,7], 200-[2,1], 300-[9]"); std::vector> expC2{{5, 6, 7}, {2, 1}, {9}}; ASSERT_EQ(ecV.size(), 6); for (int i = 0; i < ecV.size(); i += 2) { @@ -484,7 +484,7 @@ TEST_F(FakeFingerprintEngineTest, parseEnrollmentCaptureFail) { "100,2x0,300", "200-[f]", "a,b"}; std::vector> ecV; for (const auto& s : badStr) { - ecV = mEngine.parseEnrollmentCapture(s); + ecV = Util::parseEnrollmentCapture(s); ASSERT_EQ(ecV.size(), 0); } } @@ -508,7 +508,7 @@ TEST_F(FakeFingerprintEngineTest, randomLatency) { TEST_F(FakeFingerprintEngineTest, lockoutTimer) { mEngine.startLockoutTimer(200, mCallback.get()); ASSERT_TRUE(mEngine.getLockoutTimerStarted()); - std::this_thread::sleep_for(std::chrono::milliseconds(210)); + std::this_thread::sleep_for(std::chrono::milliseconds(250)); ASSERT_FALSE(mEngine.getLockoutTimerStarted()); ASSERT_TRUE(mCallback->mLockoutCleared); } diff --git a/broadcastradio/aidl/Android.bp b/broadcastradio/aidl/Android.bp index 3f8902923299da5c3033cf694b2b591b85a30387..e8bc5eb6d8225b04be43e87274fd92dd3b9e1878 100644 --- a/broadcastradio/aidl/Android.bp +++ b/broadcastradio/aidl/Android.bp @@ -43,6 +43,6 @@ aidl_interface { imports: [], }, ], - frozen: true, + frozen: false, } diff --git a/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/AmFmRegionConfig.aidl b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/AmFmRegionConfig.aidl index fe8489c69dbdca669c7621815f6f7a9ea05ed96e..b96def32f80fb080606dea723dc48e4b7da601f4 100644 --- a/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/AmFmRegionConfig.aidl +++ b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/AmFmRegionConfig.aidl @@ -37,8 +37,8 @@ parcelable AmFmRegionConfig { android.hardware.broadcastradio.AmFmBandRange[] ranges; int fmDeemphasis; int fmRds; - const int DEEMPHASIS_D50 = (1 << 0); - const int DEEMPHASIS_D75 = (1 << 1); - const int RDS = (1 << 0); - const int RBDS = (1 << 1); + const int DEEMPHASIS_D50 = (1 << 0) /* 1 */; + const int DEEMPHASIS_D75 = (1 << 1) /* 2 */; + const int RDS = (1 << 0) /* 1 */; + const int RBDS = (1 << 1) /* 2 */; } diff --git a/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/ConfigFlag.aidl b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/ConfigFlag.aidl index 98af4372661f8eefdbfb2252694accb3023976f5..d6d33bca50ce219b3e4e62904e14ba0adb7e1319 100644 --- a/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/ConfigFlag.aidl +++ b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/ConfigFlag.aidl @@ -35,6 +35,9 @@ package android.hardware.broadcastradio; @Backing(type="int") @JavaDerive(equals=true, toString=true) @VintfStability enum ConfigFlag { FORCE_MONO = 1, + /** + * @deprecated Use {link #FORCE_ANALOG_FM} instead + */ FORCE_ANALOG, FORCE_DIGITAL, RDS_AF, @@ -43,4 +46,6 @@ enum ConfigFlag { DAB_FM_LINKING, DAB_DAB_SOFT_LINKING, DAB_FM_SOFT_LINKING, + FORCE_ANALOG_FM, + FORCE_ANALOG_AM, } diff --git a/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/HdSubChannel.aidl b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/HdSubChannel.aidl new file mode 100644 index 0000000000000000000000000000000000000000..dd0613459ce6d1e49cf1d359a60bb7b98f64c690 --- /dev/null +++ b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/HdSubChannel.aidl @@ -0,0 +1,45 @@ +/* + * Copyright (C) 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/////////////////////////////////////////////////////////////////////////////// +// THIS 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 -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.broadcastradio; +@Backing(type="int") @JavaDerive(equals=true, toString=true) @VintfStability +enum HdSubChannel { + HD1 = 0, + HD2 = 1, + HD3 = 2, + HD4 = 3, + HD5 = 4, + HD6 = 5, + HD7 = 6, + HD8 = 7, +} diff --git a/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/IdentifierType.aidl b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/IdentifierType.aidl index 4df272c3c3cc11835d51f14ff45b79e798edbab8..ed41af00bc84e51626d75d1656fb6c3fc9431e7e 100644 --- a/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/IdentifierType.aidl +++ b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/IdentifierType.aidl @@ -47,6 +47,13 @@ enum IdentifierType { DAB_FREQUENCY_KHZ, DRMO_SERVICE_ID, DRMO_FREQUENCY_KHZ, - SXM_SERVICE_ID = (DRMO_FREQUENCY_KHZ + 2), + /** + * @deprecated SiriusXM Satellite Radio is not supported. + */ + SXM_SERVICE_ID = (DRMO_FREQUENCY_KHZ + 2) /* 12 */, + /** + * @deprecated SiriusXM Satellite Radio is not supported. + */ SXM_CHANNEL, + HD_STATION_LOCATION, } diff --git a/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/Metadata.aidl b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/Metadata.aidl index e02b6b1bd03f5802a43fb0bdfc6ac6a043627801..b4a1efa488bda78298cd08326fea26ccb13b0f1d 100644 --- a/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/Metadata.aidl +++ b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/Metadata.aidl @@ -50,4 +50,12 @@ union Metadata { String dabServiceNameShort; String dabComponentName; String dabComponentNameShort; + String genre; + String commentShortDescription; + String commentActualText; + String commercial; + String[] ufids; + String hdStationNameShort; + String hdStationNameLong; + int hdSubChannelsAvailable; } diff --git a/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/ProgramInfo.aidl b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/ProgramInfo.aidl index b14023a3c08afcd27a62185df9f5a272d39ee6b5..997cdd7dd0ddf63b49840d84184277d24a9a35b9 100644 --- a/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/ProgramInfo.aidl +++ b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/ProgramInfo.aidl @@ -42,10 +42,13 @@ parcelable ProgramInfo { int signalQuality; android.hardware.broadcastradio.Metadata[] metadata; android.hardware.broadcastradio.VendorKeyValue[] vendorInfo; - const int FLAG_LIVE = (1 << 0); - const int FLAG_MUTED = (1 << 1); - const int FLAG_TRAFFIC_PROGRAM = (1 << 2); - const int FLAG_TRAFFIC_ANNOUNCEMENT = (1 << 3); - const int FLAG_TUNABLE = (1 << 4); - const int FLAG_STEREO = (1 << 5); + const int FLAG_LIVE = (1 << 0) /* 1 */; + const int FLAG_MUTED = (1 << 1) /* 2 */; + const int FLAG_TRAFFIC_PROGRAM = (1 << 2) /* 4 */; + const int FLAG_TRAFFIC_ANNOUNCEMENT = (1 << 3) /* 8 */; + const int FLAG_TUNABLE = (1 << 4) /* 16 */; + const int FLAG_STEREO = (1 << 5) /* 32 */; + const int FLAG_SIGNAL_ACQUISITION = (1 << 6) /* 64 */; + const int FLAG_HD_SIS_ACQUISITION = (1 << 7) /* 128 */; + const int FLAG_HD_AUDIO_ACQUISITION = (1 << 8) /* 256 */; } diff --git a/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/Result.aidl b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/Result.aidl index 8af74c74fb18e06728d3ebc08d3743a3f2a13ea4..b0fc018cb74e3ae0881ade9e6a364d4ce551dbbc 100644 --- a/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/Result.aidl +++ b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/Result.aidl @@ -34,7 +34,7 @@ package android.hardware.broadcastradio; @Backing(type="int") @JavaDerive(equals=true, toString=true) @VintfStability enum Result { - OK, + OK = 0, INTERNAL_ERROR, INVALID_ARGUMENTS, INVALID_STATE, diff --git a/broadcastradio/aidl/android/hardware/broadcastradio/ConfigFlag.aidl b/broadcastradio/aidl/android/hardware/broadcastradio/ConfigFlag.aidl index 11da39c02b32ba30e7858b3740044f1006cdcb52..ddf60e0a88f9e1b693c8516a0d38c6bcbe32afc4 100644 --- a/broadcastradio/aidl/android/hardware/broadcastradio/ConfigFlag.aidl +++ b/broadcastradio/aidl/android/hardware/broadcastradio/ConfigFlag.aidl @@ -36,10 +36,12 @@ enum ConfigFlag { * Forces the analog playback for the supporting radio technology. * * User may disable digital playback for FM HD Radio or hybrid FM/DAB with - * this option. This is purely user choice, ie. does not reflect digital- + * this option. This is purely user choice, i.e. does not reflect digital- * analog handover state managed from the HAL implementation side. * - * Some radio technologies may not support this, ie. DAB. + * Some radio technologies may not support this, i.e. DAB. + * + * @deprecated Use {link #FORCE_ANALOG_FM} instead */ FORCE_ANALOG, @@ -89,4 +91,26 @@ enum ConfigFlag { * Enables DAB-FM soft-linking (related content). */ DAB_FM_SOFT_LINKING, + + /** + * Forces the FM analog playback for the supporting radio technology. + * + * User may disable FM digital playback for FM HD Radio or hybrid FM/DAB + * with this option. This is purely user choice, i.e. does not reflect + * digital-analog handover state managed from the HAL implementation side. + * + * Some radio technologies may not support this, i.e. DAB. + */ + FORCE_ANALOG_FM, + + /** + * Forces the AM analog playback for the supporting radio technology. + * + * User may disable AM digital playback for AM HD Radio or hybrid AM/DAB + * with this option. This is purely user choice, i.e. does not reflect + * digital-analog handover state managed from the HAL implementation side. + * + * Some radio technologies may not support this, i.e. DAB. + */ + FORCE_ANALOG_AM, } diff --git a/broadcastradio/aidl/android/hardware/broadcastradio/HdSubChannel.aidl b/broadcastradio/aidl/android/hardware/broadcastradio/HdSubChannel.aidl new file mode 100644 index 0000000000000000000000000000000000000000..46a3e0cf9e9984cef5bc3f9ac53a0ab1e3ac5831 --- /dev/null +++ b/broadcastradio/aidl/android/hardware/broadcastradio/HdSubChannel.aidl @@ -0,0 +1,62 @@ +/* + * Copyright (C) 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.hardware.broadcastradio; + +/** + * Index of HD radio subchannel. + */ +@VintfStability +@Backing(type="int") +@JavaDerive(equals=true, toString=true) +enum HdSubChannel { + /** + * Index of HD radio subchannel 1. + * + *

      There are at most 8 HD radio subchannels of 1-based om HD radio standard. It is + * converted to 0-based index. 0 is the index of main program service (MPS). 1 to 7 + * are indexes of additional supplemental program services (SPS). + */ + HD1 = 0, + /** + * {@see HD1} + */ + HD2 = 1, + /** + * {@see HD1} + */ + HD3 = 2, + /** + * {@see HD1} + */ + HD4 = 3, + /** + * {@see HD1} + */ + HD5 = 4, + /** + * {@see HD1} + */ + HD6 = 5, + /** + * {@see HD1} + */ + HD7 = 6, + /** + * {@see HD1} + */ + HD8 = 7, +} diff --git a/broadcastradio/aidl/android/hardware/broadcastradio/IdentifierType.aidl b/broadcastradio/aidl/android/hardware/broadcastradio/IdentifierType.aidl index 646c5026602c2b0171f4570c101626c978db6944..4a95a41c94817e455f00dd8b1c2e3d9fa2f77dcd 100644 --- a/broadcastradio/aidl/android/hardware/broadcastradio/IdentifierType.aidl +++ b/broadcastradio/aidl/android/hardware/broadcastradio/IdentifierType.aidl @@ -154,11 +154,42 @@ enum IdentifierType { /** * 32bit primary identifier for SiriusXM Satellite Radio. + * + * @deprecated SiriusXM Satellite Radio is not supported. */ SXM_SERVICE_ID = DRMO_FREQUENCY_KHZ + 2, /** * 0-999 range + * + * @deprecated SiriusXM Satellite Radio is not supported. */ SXM_CHANNEL, + + /** + * 64bit additional identifier for HD Radio representing station location. + * + * Consists of (from the LSB): + * - 4 bit: Bits 0:3 of altitude + * - 13 bit: Fractional bits of longitude + * - 8 bit: Integer bits of longitude + * - 1 bit: 0 for east and 1 for west for longitude + * - 1 bit: 0, representing latitude + * - 5 bit: pad of zeros separating longitude and latitude + * - 4 bit: Bits 4:7 of altitude + * - 13 bit: Fractional bits of latitude + * - 8 bit: Integer bits of latitude + * - 1 bit: 0 for north and 1 for south for latitude + * - 1 bit: 1, representing latitude + * - 5 bit: pad of zeros + * + * This format is defined in NRSC-5-C document: SY_IDD_1020s. + * + * Due to Station ID abuse, some HD_STATION_ID_EXT identifiers may be not + * globally unique. To provide a best-effort solution, the station’s + * broadcast antenna containing the latitude and longitude may be carried + * as additional identifier and may be used by the tuner hardware to + * double-check tuning. + */ + HD_STATION_LOCATION, } diff --git a/broadcastradio/aidl/android/hardware/broadcastradio/Metadata.aidl b/broadcastradio/aidl/android/hardware/broadcastradio/Metadata.aidl index 7769b8c373ce3fed0c17004ed4cdf70d0d832128..0ce967f0090a647a35e350f03a2641fb8a356dbd 100644 --- a/broadcastradio/aidl/android/hardware/broadcastradio/Metadata.aidl +++ b/broadcastradio/aidl/android/hardware/broadcastradio/Metadata.aidl @@ -116,4 +116,70 @@ union Metadata { *

      Note: The string must be up to 8 characters long. */ String dabComponentNameShort; + + /** + * Genre of the current audio piece (string) + * + *

      (see NRSC-G200-A and id3v2.3.0 for more info) + */ + String genre; + + /** + * Short context description of comment (string) + * + *

      Comment could relate to the current audio program content, or it might + * be unrelated information that the station chooses to send. It is + * composed of short content description and actual text (see NRSC-G200-A + * and id3v2.3.0 for more info). + */ + String commentShortDescription; + + /** + * Actual text of comment (string) + * + * @see #commentShortDescription + */ + String commentActualText; + + /** + * Commercial (string) + * + *

      Commercial is application specific and generally used to facilitate the + * sale of products and services (see NRSC-G200-A and id3v2.3.0 for more info). + */ + String commercial; + + /** + * HD Unique File Identifiers (Array of strings) + * + *

      Unique File Identifier (UFID) can be used to transmit an alphanumeric + * identifier of the current content, or of an advertised product or service + * (see NRSC-G200-A and id3v2.3.0 for more info). + */ + String[] ufids; + + /** + * HD short station name or HD universal short station name + * + *

      It can be up to 12 characters (see SY_IDD_1020s for more info). + */ + String hdStationNameShort; + + /** + * HD long station name, HD station slogan or HD station message + * + *

      (see SY_IDD_1020s for more info) + */ + String hdStationNameLong; + + /** + * Bit mask of all HD Radio subchannels available (uint8_t) + * + *

      Bit {@link HdSubChannel#HD1} from LSB represents the availability + * of HD-1 subchannel (main program service, MPS). Bits + * {@link HdSubChannel#HD2} to {@link HdSubChannel#HD8} from LSB represent + * HD-2 to HD-8 subchannel (supplemental program services, SPS) + * respectively. + */ + int hdSubChannelsAvailable; } diff --git a/broadcastradio/aidl/android/hardware/broadcastradio/ProgramInfo.aidl b/broadcastradio/aidl/android/hardware/broadcastradio/ProgramInfo.aidl index 7632c81e1d87148d3679de5ae889ba64efd5d6b5..d4ccd01bc3ca4dc13400b968dee4f2f8de8044fe 100644 --- a/broadcastradio/aidl/android/hardware/broadcastradio/ProgramInfo.aidl +++ b/broadcastradio/aidl/android/hardware/broadcastradio/ProgramInfo.aidl @@ -70,6 +70,23 @@ parcelable ProgramInfo { */ const int FLAG_STEREO = 1 << 5; + /** + * A signal has been acquired if this bit is set. + */ + + const int FLAG_SIGNAL_ACQUISITION = 1 << 6; + /** + * An HD Station Information Service (SIS) information is available if this + * bit is set. + */ + + const int FLAG_HD_SIS_ACQUISITION = 1 << 7; + + /** + * An HD digital audio is available if this bit is set. + */ + const int FLAG_HD_AUDIO_ACQUISITION = 1 << 8; + /** * An identifier used to point at the program (primarily to tune to it). * @@ -153,7 +170,8 @@ parcelable ProgramInfo { * * It can be a combination of {@link #FLAG_LIVE}, {@link #FLAG_MUTED}, * {@link #FLAG_TRAFFIC_PROGRAM}, {@link #FLAG_TRAFFIC_ANNOUNCEMENT}, - * {@link #FLAG_TUNABLE}, and {@link #FLAG_STEREO}. + * {@link #FLAG_TUNABLE}, {@link #FLAG_STEREO}, {@link #FLAG_SIGNAL_ACQUISITION}, + * {@link #FLAG_HD_SIS_ACQUISITION}, and {@link #FLAG_HD_AUDIO_ACQUISITION}. */ int infoFlags; diff --git a/broadcastradio/aidl/default/Android.bp b/broadcastradio/aidl/default/Android.bp index 720aa8a6fdb1fa5902c7b3fffba5cbb26aa3c3e2..743365a07349f90da48906262a4b1f061632646b 100644 --- a/broadcastradio/aidl/default/Android.bp +++ b/broadcastradio/aidl/default/Android.bp @@ -23,32 +23,75 @@ package { default_applicable_licenses: ["hardware_interfaces_license"], } +cc_defaults { + name: "BroadcastRadioHalDefaults", + static_libs: [ + "android.hardware.broadcastradio@common-utils-aidl-lib-V2", + "android.hardware.broadcastradio@common-utils-lib", + ], + shared_libs: [ + "android.hardware.broadcastradio-V2-ndk", + "libbase", + "libbinder_ndk", + "liblog", + "libcutils", + ], + cflags: [ + "-Wall", + "-Wextra", + "-Werror", + ], +} + cc_binary { name: "android.hardware.broadcastradio-service.default", relative_install_path: "hw", init_rc: ["broadcastradio-default.rc"], vintf_fragments: ["broadcastradio-default.xml"], vendor: true, - cflags: [ - "-Wall", - "-Wextra", - "-Werror", + defaults: [ + "BroadcastRadioHalDefaults", ], srcs: [ - "BroadcastRadio.cpp", "main.cpp", + ], + static_libs: [ + "DefaultBroadcastRadioHal", + ], +} + +cc_library { + name: "DefaultBroadcastRadioHal", + vendor_available: true, + export_include_dirs: ["."], + defaults: [ + "BroadcastRadioHalDefaults", + ], + srcs: [ + "BroadcastRadio.cpp", "VirtualProgram.cpp", "VirtualRadio.cpp", ], +} + +cc_fuzz { + name: "android.hardware.broadcastradio-service.default_fuzzer", + // TODO(b/307611931): avoid fuzzing on vendor until hermiticity issue is fixed + // vendor: true, + defaults: [ + "BroadcastRadioHalDefaults", + "service_fuzzer_defaults", + ], static_libs: [ - "android.hardware.broadcastradio@common-utils-aidl-lib", - "android.hardware.broadcastradio@common-utils-lib", + "DefaultBroadcastRadioHal", + "android.hardware.broadcastradio-V2-ndk", ], - shared_libs: [ - "android.hardware.broadcastradio-V1-ndk", - "libbase", - "libbinder_ndk", - "liblog", - "libcutils", + srcs: [ + "fuzzer.cpp", ], + fuzz_config: { + cc: [ + "xuweilin@google.com", + ], + }, } diff --git a/broadcastradio/aidl/default/BroadcastRadio.cpp b/broadcastradio/aidl/default/BroadcastRadio.cpp index c0c475a53231e8f94043618b33e72c3d3ec2cff2..4d6d81dc1d4582a1d34e215951c0656bfa9683a5 100644 --- a/broadcastradio/aidl/default/BroadcastRadio.cpp +++ b/broadcastradio/aidl/default/BroadcastRadio.cpp @@ -16,6 +16,7 @@ #include "BroadcastRadio.h" #include +#include #include "resources.h" #include @@ -47,6 +48,8 @@ inline constexpr std::chrono::milliseconds kTuneDelayTimeMs = 150ms; inline constexpr std::chrono::seconds kListDelayTimeS = 1s; // clang-format off +const AmFmBandRange kFmFullBandRange = {65000, 108000, 10, 0}; +const AmFmBandRange kAmFullBandRange = {150, 30000, 1, 0}; const AmFmRegionConfig kDefaultAmFmConfig = { { {87500, 108000, 100, 100}, // FM @@ -63,12 +66,7 @@ Properties initProperties(const VirtualRadio& virtualRadio) { prop.maker = "Android"; prop.product = virtualRadio.getName(); - prop.supportedIdentifierTypes = vector({ - IdentifierType::AMFM_FREQUENCY_KHZ, - IdentifierType::RDS_PI, - IdentifierType::HD_STATION_ID_EXT, - IdentifierType::DAB_SID_EXT, - }); + prop.supportedIdentifierTypes = virtualRadio.getSupportedIdentifierTypes(); prop.vendorInfo = vector({ {"com.android.sample", "sample"}, }); @@ -76,14 +74,71 @@ Properties initProperties(const VirtualRadio& virtualRadio) { return prop; } +bool isDigitalProgramAllowed(const ProgramSelector& sel, bool forceAnalogFm, bool forceAnalogAm) { + if (sel.primaryId.type != IdentifierType::HD_STATION_ID_EXT) { + return true; + } + int32_t freq = static_cast(utils::getAmFmFrequency(sel)); + bool isFm = freq >= kFmFullBandRange.lowerBound && freq <= kFmFullBandRange.upperBound; + return isFm ? !forceAnalogFm : !forceAnalogAm; +} + +/** + * Checks whether a program selector is in the current band. + * + *

      For an AM/FM program, this method checks whether it is in the current AM/FM band. For a + * program selector is also an HD program, it is also checked whether HD radio is enabled in the + * current AM/FM band. For a non-AM/FM program, the method will returns {@code true} directly. + * @param sel Program selector to be checked + * @param currentAmFmBandRange the current AM/FM band + * @param forceAnalogFm whether FM band is forced to be analog + * @param forceAnalogAm whether AM band is forced to be analog + * @return whether the program selector is in the current band if it is an AM/FM (including HD) + * selector, {@code true} otherwise + */ +bool isProgramInBand(const ProgramSelector& sel, + const std::optional& currentAmFmBandRange, bool forceAnalogFm, + bool forceAnalogAm) { + if (!utils::hasAmFmFrequency(sel)) { + return true; + } + if (!currentAmFmBandRange.has_value()) { + return false; + } + int32_t freq = static_cast(utils::getAmFmFrequency(sel)); + if (freq < currentAmFmBandRange->lowerBound || freq > currentAmFmBandRange->upperBound) { + return false; + } + return isDigitalProgramAllowed(sel, forceAnalogFm, forceAnalogAm); +} + // Makes ProgramInfo that does not point to any particular program ProgramInfo makeSampleProgramInfo(const ProgramSelector& selector) { ProgramInfo info = {}; info.selector = selector; - info.logicallyTunedTo = - utils::makeIdentifier(IdentifierType::AMFM_FREQUENCY_KHZ, - utils::getId(selector, IdentifierType::AMFM_FREQUENCY_KHZ)); - info.physicallyTunedTo = info.logicallyTunedTo; + switch (info.selector.primaryId.type) { + case IdentifierType::AMFM_FREQUENCY_KHZ: + info.logicallyTunedTo = utils::makeIdentifier( + IdentifierType::AMFM_FREQUENCY_KHZ, + utils::getId(selector, IdentifierType::AMFM_FREQUENCY_KHZ)); + info.physicallyTunedTo = info.logicallyTunedTo; + break; + case IdentifierType::HD_STATION_ID_EXT: + info.logicallyTunedTo = utils::makeIdentifier(IdentifierType::AMFM_FREQUENCY_KHZ, + utils::getAmFmFrequency(info.selector)); + info.physicallyTunedTo = info.logicallyTunedTo; + break; + case IdentifierType::DAB_SID_EXT: + info.logicallyTunedTo = info.selector.primaryId; + info.physicallyTunedTo = utils::makeIdentifier( + IdentifierType::DAB_FREQUENCY_KHZ, + utils::getId(selector, IdentifierType::DAB_FREQUENCY_KHZ)); + break; + default: + info.logicallyTunedTo = info.selector.primaryId; + info.physicallyTunedTo = info.logicallyTunedTo; + break; + } return info; } @@ -111,19 +166,21 @@ BroadcastRadio::BroadcastRadio(const VirtualRadio& virtualRadio) } else { mCurrentProgram = sel; } + adjustAmFmRangeLocked(); } } BroadcastRadio::~BroadcastRadio() { - mThread.reset(); + mTuningThread.reset(); + mProgramListThread.reset(); } ScopedAStatus BroadcastRadio::getAmFmRegionConfig(bool full, AmFmRegionConfig* returnConfigs) { if (full) { *returnConfigs = {}; returnConfigs->ranges = vector({ - {65000, 108000, 10, 0}, // FM - {150, 30000, 1, 0}, // AM + kFmFullBandRange, + kAmFullBandRange, }); returnConfigs->fmDeemphasis = AmFmRegionConfig::DEEMPHASIS_D50 | AmFmRegionConfig::DEEMPHASIS_D75; @@ -169,14 +226,27 @@ ProgramInfo BroadcastRadio::tuneInternalLocked(const ProgramSelector& sel) { VirtualProgram virtualProgram = {}; ProgramInfo programInfo; - if (mVirtualRadio.getProgram(sel, &virtualProgram)) { + bool isProgramAllowed = + isDigitalProgramAllowed(sel, isConfigFlagSetLocked(ConfigFlag::FORCE_ANALOG_FM), + isConfigFlagSetLocked(ConfigFlag::FORCE_ANALOG_AM)); + if (isProgramAllowed && mVirtualRadio.getProgram(sel, &virtualProgram)) { mCurrentProgram = virtualProgram.selector; programInfo = virtualProgram; } else { - mCurrentProgram = sel; + if (!isProgramAllowed) { + mCurrentProgram = utils::makeSelectorAmfm(utils::getAmFmFrequency(sel)); + } else { + mCurrentProgram = sel; + } programInfo = makeSampleProgramInfo(sel); } - mIsTuneCompleted = true; + programInfo.infoFlags |= ProgramInfo::FLAG_SIGNAL_ACQUISITION; + if (programInfo.selector.primaryId.type != IdentifierType::HD_STATION_ID_EXT) { + mIsTuneCompleted = true; + } + if (adjustAmFmRangeLocked()) { + startProgramListUpdatesLocked({}); + } return programInfo; } @@ -204,6 +274,32 @@ ScopedAStatus BroadcastRadio::unsetTunerCallback() { return ScopedAStatus::ok(); } +void BroadcastRadio::handleProgramInfoUpdateRadioCallback( + ProgramInfo programInfo, const std::shared_ptr& callback) { + callback->onCurrentProgramInfoChanged(programInfo); + if (programInfo.selector.primaryId.type != IdentifierType::HD_STATION_ID_EXT) { + return; + } + ProgramSelector sel = programInfo.selector; + auto cancelTask = [sel, callback]() { callback->onTuneFailed(Result::CANCELED, sel); }; + programInfo.infoFlags |= ProgramInfo::FLAG_HD_SIS_ACQUISITION; + auto sisAcquiredTask = [this, callback, programInfo, cancelTask]() { + callback->onCurrentProgramInfoChanged(programInfo); + auto audioAcquiredTask = [this, callback, programInfo]() { + ProgramInfo hdProgramInfoWithAudio = programInfo; + hdProgramInfoWithAudio.infoFlags |= ProgramInfo::FLAG_HD_AUDIO_ACQUISITION; + callback->onCurrentProgramInfoChanged(hdProgramInfoWithAudio); + lock_guard lk(mMutex); + mIsTuneCompleted = true; + }; + lock_guard lk(mMutex); + mTuningThread->schedule(audioAcquiredTask, cancelTask, kTuneDelayTimeMs); + }; + + lock_guard lk(mMutex); + mTuningThread->schedule(sisAcquiredTask, cancelTask, kTuneDelayTimeMs); +} + ScopedAStatus BroadcastRadio::tune(const ProgramSelector& program) { LOG(DEBUG) << __func__ << ": tune to " << program.toString() << "..."; @@ -220,7 +316,7 @@ ScopedAStatus BroadcastRadio::tune(const ProgramSelector& program) { resultToInt(Result::NOT_SUPPORTED), "selector is not supported"); } - if (!utils::isValid(program)) { + if (!utils::isValidV2(program)) { LOG(ERROR) << __func__ << ": selector is not valid: " << program.toString(); return ScopedAStatus::fromServiceSpecificErrorWithMessage( resultToInt(Result::INVALID_ARGUMENTS), "selector is not valid"); @@ -236,14 +332,130 @@ ScopedAStatus BroadcastRadio::tune(const ProgramSelector& program) { lock_guard lk(mMutex); programInfo = tuneInternalLocked(program); } - callback->onCurrentProgramInfoChanged(programInfo); + handleProgramInfoUpdateRadioCallback(programInfo, callback); }; auto cancelTask = [program, callback]() { callback->onTuneFailed(Result::CANCELED, program); }; - mThread->schedule(task, cancelTask, kTuneDelayTimeMs); + mTuningThread->schedule(task, cancelTask, kTuneDelayTimeMs); return ScopedAStatus::ok(); } +bool BroadcastRadio::findNextLocked(const ProgramSelector& current, bool directionUp, + bool skipSubChannel, VirtualProgram* nextProgram) const { + if (mProgramList.empty()) { + return false; + } + // The list is not sorted here since it has already stored in VirtualRadio. + bool hasAmFmFrequency = utils::hasAmFmFrequency(current); + bool hasDabSId = utils::hasId(current, IdentifierType::DAB_SID_EXT); + uint32_t currentChannel = + hasAmFmFrequency ? utils::getAmFmFrequency(current) : utils::getDabSId(current); + auto found = + std::lower_bound(mProgramList.begin(), mProgramList.end(), VirtualProgram({current})); + if (directionUp) { + if (found < mProgramList.end() - 1) { + // When seeking up, tuner will jump to the first selector which is main program service + // greater than and of the same band as the current program selector in the program + // list (if not exist, jump to the first selector in the same band) for skipping + // sub-channels case or AM/FM without HD radio enabled case. Otherwise, the tuner will + // jump to the first selector which is greater than and of the same band as the current + // program selector. + if (utils::tunesTo(current, found->selector)) found++; + if (skipSubChannel) { + if (hasAmFmFrequency || hasDabSId) { + auto firstFound = found; + while ((hasAmFmFrequency && + utils::getAmFmFrequency(found->selector) == currentChannel) || + (hasDabSId && utils::getDabSId(found->selector) == currentChannel)) { + if (found < mProgramList.end() - 1) { + found++; + } else { + found = mProgramList.begin(); + } + if (found == firstFound) { + // Only one main channel exists in the program list, the tuner cannot + // skip sub-channel to the next program selector. + return false; + } + } + } + } + } else { + // If the selector of current program is no less than all selectors of the same band or + // not found in the program list, seeking up should wrap the tuner to the first program + // selector of the same band in the program list. + found = mProgramList.begin(); + } + } else { + if (found > mProgramList.begin() && found != mProgramList.end()) { + // When seeking down, tuner will jump to the first selector which is main program + // service less than and of the same band as the current program selector in the + // program list (if not exist, jump to the last main program service selector of the + // same band) for skipping sub-channels case or AM/FM without HD radio enabled case. + // Otherwise, the tuner will jump to the first selector less than and of the same band + // as the current program selector. + found--; + if ((hasAmFmFrequency && utils::hasAmFmFrequency(found->selector)) || + (hasDabSId && utils::hasId(found->selector, IdentifierType::DAB_SID_EXT))) { + uint32_t nextChannel = hasAmFmFrequency ? utils::getAmFmFrequency(found->selector) + : utils::getDabSId(found->selector); + if (nextChannel != currentChannel) { + jumpToFirstSubChannelLocked(found); + } else if (skipSubChannel) { + jumpToFirstSubChannelLocked(found); + auto firstFound = found; + if (found > mProgramList.begin()) { + found--; + } else { + found = mProgramList.end() - 1; + } + jumpToFirstSubChannelLocked(found); + if (found == firstFound) { + // Only one main channel exists in the program list, the tuner cannot skip + // sub-channel to the next program selector. + return false; + } + } + } + } else { + // If the selector of current program is no greater than all selectors of the same band + // or not found in the program list, seeking down should wrap the tuner to the last + // selector of the same band in the program list. If the last program selector in the + // program list is sub-channel and skipping sub-channels is needed, the tuner will jump + // to the last main program service of the same band in the program list. + found = mProgramList.end() - 1; + jumpToFirstSubChannelLocked(found); + } + } + *nextProgram = *found; + return true; +} + +void BroadcastRadio::jumpToFirstSubChannelLocked(vector::const_iterator& it) const { + if (it == mProgramList.begin()) { + return; + } + bool hasAmFmFrequency = utils::hasAmFmFrequency(it->selector); + bool hasDabSId = utils::hasId(it->selector, IdentifierType::DAB_SID_EXT); + if (hasAmFmFrequency || hasDabSId) { + uint32_t currentChannel = hasAmFmFrequency ? utils::getAmFmFrequency(it->selector) + : utils::getDabSId(it->selector); + it--; + while (it != mProgramList.begin()) { + if (hasAmFmFrequency && utils::hasAmFmFrequency(it->selector) && + utils::getAmFmFrequency(it->selector) == currentChannel) { + it--; + } else if (hasDabSId && utils::hasId(it->selector, IdentifierType::DAB_SID_EXT) && + utils::getDabSId(it->selector) == currentChannel) { + it--; + } else { + break; + } + } + it++; + } +} + ScopedAStatus BroadcastRadio::seek(bool directionUp, bool skipSubChannel) { LOG(DEBUG) << __func__ << ": seek " << (directionUp ? "up" : "down") << " with skipSubChannel? " << (skipSubChannel ? "yes" : "no") << "..."; @@ -257,50 +469,40 @@ ScopedAStatus BroadcastRadio::seek(bool directionUp, bool skipSubChannel) { cancelLocked(); + auto filterCb = [this](const VirtualProgram& program) { + return isProgramInBand(program.selector, mCurrentAmFmBandRange, + isConfigFlagSetLocked(ConfigFlag::FORCE_ANALOG_FM), + isConfigFlagSetLocked(ConfigFlag::FORCE_ANALOG_AM)); + }; const auto& list = mVirtualRadio.getProgramList(); + mProgramList.clear(); + std::copy_if(list.begin(), list.end(), std::back_inserter(mProgramList), filterCb); std::shared_ptr callback = mCallback; auto cancelTask = [callback]() { callback->onTuneFailed(Result::CANCELED, {}); }; - if (list.empty()) { - mIsTuneCompleted = false; + + VirtualProgram nextProgram = {}; + bool foundNext = findNextLocked(mCurrentProgram, directionUp, skipSubChannel, &nextProgram); + mIsTuneCompleted = false; + if (!foundNext) { auto task = [callback]() { LOG(DEBUG) << "seek: program list is empty, seek couldn't stop"; callback->onTuneFailed(Result::TIMEOUT, {}); }; - mThread->schedule(task, cancelTask, kSeekDelayTimeMs); + mTuningThread->schedule(task, cancelTask, kSeekDelayTimeMs); return ScopedAStatus::ok(); } - // The list is not sorted here since it has already stored in VirtualRadio. - // If the list is not sorted in advance, it should be sorted here. - const auto& current = mCurrentProgram; - auto found = std::lower_bound(list.begin(), list.end(), VirtualProgram({current})); - if (directionUp) { - if (found < list.end() - 1) { - if (tunesTo(current, found->selector)) found++; - } else { - found = list.begin(); - } - } else { - if (found > list.begin() && found != list.end()) { - found--; - } else { - found = list.end() - 1; - } - } - const ProgramSelector tuneTo = found->selector; - - mIsTuneCompleted = false; - auto task = [this, tuneTo, callback]() { + auto task = [this, nextProgram, callback]() { ProgramInfo programInfo = {}; { lock_guard lk(mMutex); - programInfo = tuneInternalLocked(tuneTo); + programInfo = tuneInternalLocked(nextProgram.selector); } - callback->onCurrentProgramInfoChanged(programInfo); + handleProgramInfoUpdateRadioCallback(programInfo, callback); }; - mThread->schedule(task, cancelTask, kSeekDelayTimeMs); + mTuningThread->schedule(task, cancelTask, kSeekDelayTimeMs); return ScopedAStatus::ok(); } @@ -317,31 +519,33 @@ ScopedAStatus BroadcastRadio::step(bool directionUp) { cancelLocked(); - if (!utils::hasId(mCurrentProgram, IdentifierType::AMFM_FREQUENCY_KHZ)) { + int64_t stepTo; + if (utils::hasId(mCurrentProgram, IdentifierType::AMFM_FREQUENCY_KHZ)) { + stepTo = utils::getId(mCurrentProgram, IdentifierType::AMFM_FREQUENCY_KHZ); + } else if (mCurrentProgram.primaryId.type == IdentifierType::HD_STATION_ID_EXT) { + stepTo = utils::getHdFrequency(mCurrentProgram); + } else { LOG(WARNING) << __func__ << ": can't step in anything else than AM/FM"; return ScopedAStatus::fromServiceSpecificErrorWithMessage( resultToInt(Result::NOT_SUPPORTED), "cannot step in anything else than AM/FM"); } - int64_t stepTo = utils::getId(mCurrentProgram, IdentifierType::AMFM_FREQUENCY_KHZ); - std::optional range = getAmFmRangeLocked(); - if (!range) { - LOG(ERROR) << __func__ << ": can't find current band or tune operation is in process"; - ScopedAStatus::fromServiceSpecificErrorWithMessage( - resultToInt(Result::INTERNAL_ERROR), - "can't find current band or tune operation is in process"); + if (!mCurrentAmFmBandRange.has_value()) { + LOG(ERROR) << __func__ << ": can't find current band"; + return ScopedAStatus::fromServiceSpecificErrorWithMessage( + resultToInt(Result::INTERNAL_ERROR), "can't find current band"); } if (directionUp) { - stepTo += range->spacing; + stepTo += mCurrentAmFmBandRange->spacing; } else { - stepTo -= range->spacing; + stepTo -= mCurrentAmFmBandRange->spacing; } - if (stepTo > range->upperBound) { - stepTo = range->lowerBound; + if (stepTo > mCurrentAmFmBandRange->upperBound) { + stepTo = mCurrentAmFmBandRange->lowerBound; } - if (stepTo < range->lowerBound) { - stepTo = range->upperBound; + if (stepTo < mCurrentAmFmBandRange->lowerBound) { + stepTo = mCurrentAmFmBandRange->upperBound; } mIsTuneCompleted = false; @@ -352,18 +556,18 @@ ScopedAStatus BroadcastRadio::step(bool directionUp) { lock_guard lk(mMutex); programInfo = tuneInternalLocked(utils::makeSelectorAmfm(stepTo)); } - callback->onCurrentProgramInfoChanged(programInfo); + handleProgramInfoUpdateRadioCallback(programInfo, callback); }; auto cancelTask = [callback]() { callback->onTuneFailed(Result::CANCELED, {}); }; - mThread->schedule(task, cancelTask, kStepDelayTimeMs); + mTuningThread->schedule(task, cancelTask, kStepDelayTimeMs); return ScopedAStatus::ok(); } void BroadcastRadio::cancelLocked() { - LOG(DEBUG) << __func__ << ": cancelling current operations..."; + LOG(DEBUG) << __func__ << ": cancelling current tuning operations..."; - mThread->cancelAll(); + mTuningThread->cancelAll(); if (mCurrentProgram.primaryId.type != IdentifierType::INVALID) { mIsTuneCompleted = true; } @@ -378,15 +582,15 @@ ScopedAStatus BroadcastRadio::cancel() { return ScopedAStatus::ok(); } -ScopedAStatus BroadcastRadio::startProgramListUpdates(const ProgramFilter& filter) { - LOG(DEBUG) << __func__ << ": requested program list updates, filter = " << filter.toString() - << "..."; - - auto filterCb = [&filter](const VirtualProgram& program) { - return utils::satisfies(filter, program.selector); +void BroadcastRadio::startProgramListUpdatesLocked(const ProgramFilter& filter) { + auto filterCb = [&filter, this](const VirtualProgram& program) { + return utils::satisfies(filter, program.selector) && + isProgramInBand(program.selector, mCurrentAmFmBandRange, + isConfigFlagSetLocked(ConfigFlag::FORCE_ANALOG_FM), + isConfigFlagSetLocked(ConfigFlag::FORCE_ANALOG_AM)); }; - lock_guard lk(mMutex); + cancelProgramListUpdateLocked(); const auto& list = mVirtualRadio.getProgramList(); vector filteredList; @@ -410,31 +614,65 @@ ScopedAStatus BroadcastRadio::startProgramListUpdates(const ProgramFilter& filte callback->onProgramListUpdated(chunk); }; - mThread->schedule(task, kListDelayTimeS); + mProgramListThread->schedule(task, kListDelayTimeS); +} + +ScopedAStatus BroadcastRadio::startProgramListUpdates(const ProgramFilter& filter) { + LOG(DEBUG) << __func__ << ": requested program list updates, filter = " << filter.toString() + << "..."; + + lock_guard lk(mMutex); + + startProgramListUpdatesLocked(filter); return ScopedAStatus::ok(); } +void BroadcastRadio::cancelProgramListUpdateLocked() { + LOG(DEBUG) << __func__ << ": cancelling current program list update operations..."; + mProgramListThread->cancelAll(); +} + ScopedAStatus BroadcastRadio::stopProgramListUpdates() { LOG(DEBUG) << __func__ << ": requested program list updates to stop..."; - // TODO(b/243681584) Implement stop program list updates method + lock_guard lk(mMutex); + cancelProgramListUpdateLocked(); return ScopedAStatus::ok(); } -ScopedAStatus BroadcastRadio::isConfigFlagSet(ConfigFlag flag, [[maybe_unused]] bool* returnIsSet) { +bool BroadcastRadio::isConfigFlagSetLocked(ConfigFlag flag) const { + int flagBit = static_cast(flag); + return ((mConfigFlagValues >> flagBit) & 1) == 1; +} + +ScopedAStatus BroadcastRadio::isConfigFlagSet(ConfigFlag flag, bool* returnIsSet) { LOG(DEBUG) << __func__ << ": flag = " << toString(flag); - LOG(INFO) << __func__ << ": getting ConfigFlag is not supported"; - return ScopedAStatus::fromServiceSpecificErrorWithMessage( - resultToInt(Result::NOT_SUPPORTED), "getting ConfigFlag is not supported"); + if (flag == ConfigFlag::FORCE_ANALOG) { + flag = ConfigFlag::FORCE_ANALOG_FM; + } + lock_guard lk(mMutex); + *returnIsSet = isConfigFlagSetLocked(flag); + return ScopedAStatus::ok(); } ScopedAStatus BroadcastRadio::setConfigFlag(ConfigFlag flag, bool value) { LOG(DEBUG) << __func__ << ": flag = " << toString(flag) << ", value = " << value; - LOG(INFO) << __func__ << ": setting ConfigFlag is not supported"; - return ScopedAStatus::fromServiceSpecificErrorWithMessage( - resultToInt(Result::NOT_SUPPORTED), "setting ConfigFlag is not supported"); + if (flag == ConfigFlag::FORCE_ANALOG) { + flag = ConfigFlag::FORCE_ANALOG_FM; + } + int flagBitMask = 1 << (static_cast(flag)); + lock_guard lk(mMutex); + if (value) { + mConfigFlagValues |= flagBitMask; + } else { + mConfigFlagValues &= ~flagBitMask; + } + if (flag == ConfigFlag::FORCE_ANALOG_AM || flag == ConfigFlag::FORCE_ANALOG_FM) { + startProgramListUpdatesLocked({}); + } + return ScopedAStatus::ok(); } ScopedAStatus BroadcastRadio::setParameters( @@ -452,24 +690,25 @@ ScopedAStatus BroadcastRadio::getParameters([[maybe_unused]] const vector BroadcastRadio::getAmFmRangeLocked() const { - if (!mIsTuneCompleted) { - LOG(WARNING) << __func__ << ": tune operation is in process"; - return {}; - } - if (!utils::hasId(mCurrentProgram, IdentifierType::AMFM_FREQUENCY_KHZ)) { +bool BroadcastRadio::adjustAmFmRangeLocked() { + bool hasBandBefore = mCurrentAmFmBandRange.has_value(); + if (!utils::hasAmFmFrequency(mCurrentProgram)) { LOG(WARNING) << __func__ << ": current program does not has AMFM_FREQUENCY_KHZ identifier"; - return {}; + mCurrentAmFmBandRange.reset(); + return hasBandBefore; } - int64_t freq = utils::getId(mCurrentProgram, IdentifierType::AMFM_FREQUENCY_KHZ); + int32_t freq = static_cast(utils::getAmFmFrequency(mCurrentProgram)); for (const auto& range : mAmFmConfig.ranges) { if (range.lowerBound <= freq && range.upperBound >= freq) { - return range; + bool isBandChanged = hasBandBefore ? *mCurrentAmFmBandRange != range : true; + mCurrentAmFmBandRange = range; + return isBandChanged; } } - return {}; + mCurrentAmFmBandRange.reset(); + return !hasBandBefore; } ScopedAStatus BroadcastRadio::registerAnnouncementListener( diff --git a/broadcastradio/aidl/default/BroadcastRadio.h b/broadcastradio/aidl/default/BroadcastRadio.h index 1c85ddc51d23429b6ad6ce361095ba43723f5175..60ea90743ae14d0f18ea815338cc5d3007e9d63e 100644 --- a/broadcastradio/aidl/default/BroadcastRadio.h +++ b/broadcastradio/aidl/default/BroadcastRadio.h @@ -39,21 +39,25 @@ class BroadcastRadio final : public BnBroadcastRadio { public: explicit BroadcastRadio(const VirtualRadio& virtualRadio); ~BroadcastRadio(); - ndk::ScopedAStatus getAmFmRegionConfig(bool full, AmFmRegionConfig* returnConfigs) override; + ndk::ScopedAStatus getAmFmRegionConfig(bool full, AmFmRegionConfig* returnConfigs) + EXCLUDES(mMutex) override; ndk::ScopedAStatus getDabRegionConfig(std::vector* returnConfigs) override; ndk::ScopedAStatus getImage(int32_t id, std::vector* returnImage) override; - ndk::ScopedAStatus getProperties(Properties* returnProperties) override; + ndk::ScopedAStatus getProperties(Properties* returnProperties) EXCLUDES(mMutex) override; - ndk::ScopedAStatus setTunerCallback(const std::shared_ptr& callback) override; - ndk::ScopedAStatus unsetTunerCallback() override; - ndk::ScopedAStatus tune(const ProgramSelector& program) override; - ndk::ScopedAStatus seek(bool directionUp, bool skipSubChannel) override; - ndk::ScopedAStatus step(bool directionUp) override; - ndk::ScopedAStatus cancel() override; - ndk::ScopedAStatus startProgramListUpdates(const ProgramFilter& filter) override; - ndk::ScopedAStatus stopProgramListUpdates() override; - ndk::ScopedAStatus isConfigFlagSet(ConfigFlag flag, bool* returnIsSet) override; - ndk::ScopedAStatus setConfigFlag(ConfigFlag flag, bool in_value) override; + ndk::ScopedAStatus setTunerCallback(const std::shared_ptr& callback) + EXCLUDES(mMutex) override; + ndk::ScopedAStatus unsetTunerCallback() EXCLUDES(mMutex) override; + ndk::ScopedAStatus tune(const ProgramSelector& program) EXCLUDES(mMutex) override; + ndk::ScopedAStatus seek(bool directionUp, bool skipSubChannel) EXCLUDES(mMutex) override; + ndk::ScopedAStatus step(bool directionUp) EXCLUDES(mMutex) override; + ndk::ScopedAStatus cancel() EXCLUDES(mMutex) override; + ndk::ScopedAStatus startProgramListUpdates(const ProgramFilter& filter) + EXCLUDES(mMutex) override; + ndk::ScopedAStatus stopProgramListUpdates() EXCLUDES(mMutex) override; + ndk::ScopedAStatus isConfigFlagSet(ConfigFlag flag, bool* returnIsSet) + EXCLUDES(mMutex) override; + ndk::ScopedAStatus setConfigFlag(ConfigFlag flag, bool in_value) EXCLUDES(mMutex) override; ndk::ScopedAStatus setParameters(const std::vector& parameters, std::vector* returnParameters) override; ndk::ScopedAStatus getParameters(const std::vector& keys, @@ -62,22 +66,39 @@ class BroadcastRadio final : public BnBroadcastRadio { const std::shared_ptr& listener, const std::vector& enabled, std::shared_ptr* returnCloseHandle) override; - binder_status_t dump(int fd, const char** args, uint32_t numArgs) override; + binder_status_t dump(int fd, const char** args, uint32_t numArgs) EXCLUDES(mMutex) override; private: const VirtualRadio& mVirtualRadio; std::mutex mMutex; AmFmRegionConfig mAmFmConfig GUARDED_BY(mMutex); - std::unique_ptr<::android::WorkerThread> mThread GUARDED_BY(mMutex) = + std::unique_ptr<::android::WorkerThread> mTuningThread GUARDED_BY(mMutex) = + std::unique_ptr<::android::WorkerThread>(new ::android::WorkerThread()); + std::unique_ptr<::android::WorkerThread> mProgramListThread GUARDED_BY(mMutex) = std::unique_ptr<::android::WorkerThread>(new ::android::WorkerThread()); bool mIsTuneCompleted GUARDED_BY(mMutex) = true; Properties mProperties GUARDED_BY(mMutex); ProgramSelector mCurrentProgram GUARDED_BY(mMutex) = {}; + std::vector mProgramList GUARDED_BY(mMutex) = {}; + std::optional mCurrentAmFmBandRange GUARDED_BY(mMutex); std::shared_ptr mCallback GUARDED_BY(mMutex); - std::optional getAmFmRangeLocked() const; - void cancelLocked(); - ProgramInfo tuneInternalLocked(const ProgramSelector& sel); + // Bitmap for all ConfigFlag values + int mConfigFlagValues GUARDED_BY(mMutex) = 0; + + bool adjustAmFmRangeLocked() REQUIRES(mMutex); + void cancelLocked() REQUIRES(mMutex); + ProgramInfo tuneInternalLocked(const ProgramSelector& sel) REQUIRES(mMutex); + void startProgramListUpdatesLocked(const ProgramFilter& filter) REQUIRES(mMutex); + void cancelProgramListUpdateLocked() REQUIRES(mMutex); + void handleProgramInfoUpdateRadioCallback(ProgramInfo programInfo, + const std::shared_ptr& callback) + EXCLUDES(mMutex); + bool findNextLocked(const ProgramSelector& current, bool directionUp, bool skipSubChannel, + VirtualProgram* nextProgram) const REQUIRES(mMutex); + void jumpToFirstSubChannelLocked(std::vector::const_iterator& it) const + REQUIRES(mMutex); + bool isConfigFlagSetLocked(ConfigFlag flag) const REQUIRES(mMutex); binder_status_t cmdHelp(int fd) const; binder_status_t cmdTune(int fd, const char** args, uint32_t numArgs); @@ -87,7 +108,7 @@ class BroadcastRadio final : public BnBroadcastRadio { binder_status_t cmdStartProgramListUpdates(int fd, const char** args, uint32_t numArgs); binder_status_t cmdStopProgramListUpdates(int fd, uint32_t numArgs); - binder_status_t dumpsys(int fd); + binder_status_t dumpsys(int fd) EXCLUDES(mMutex); }; } // namespace aidl::android::hardware::broadcastradio diff --git a/broadcastradio/aidl/default/VirtualProgram.cpp b/broadcastradio/aidl/default/VirtualProgram.cpp index 4fe6567d1757b41c3ef0cec3de568677f2ec71da..fab4a49450be0dbc2b7ace485bd7be4eeddf84c1 100644 --- a/broadcastradio/aidl/default/VirtualProgram.cpp +++ b/broadcastradio/aidl/default/VirtualProgram.cpp @@ -49,7 +49,12 @@ VirtualProgram::operator ProgramInfo() const { break; case IdentifierType::HD_STATION_ID_EXT: info.logicallyTunedTo = selectId(IdentifierType::HD_STATION_ID_EXT); - info.physicallyTunedTo = selectId(IdentifierType::AMFM_FREQUENCY_KHZ); + if (utils::hasId(info.selector, IdentifierType::AMFM_FREQUENCY_KHZ)) { + info.physicallyTunedTo = selectId(IdentifierType::AMFM_FREQUENCY_KHZ); + } else { + info.physicallyTunedTo = utils::makeIdentifier( + IdentifierType::AMFM_FREQUENCY_KHZ, utils::getHdFrequency(info.selector)); + } break; case IdentifierType::DAB_SID_EXT: info.logicallyTunedTo = selectId(IdentifierType::DAB_SID_EXT); @@ -88,13 +93,7 @@ VirtualProgram::operator ProgramInfo() const { } bool operator<(const VirtualProgram& lhs, const VirtualProgram& rhs) { - auto& l = lhs.selector; - auto& r = rhs.selector; - - // Two programs with the same primaryId are considered the same. - if (l.primaryId.type != r.primaryId.type) return l.primaryId.type < r.primaryId.type; - - return l.primaryId.value < r.primaryId.value; + return utils::ProgramSelectorComparator()(lhs.selector, rhs.selector); } } // namespace aidl::android::hardware::broadcastradio diff --git a/broadcastradio/aidl/default/VirtualRadio.cpp b/broadcastradio/aidl/default/VirtualRadio.cpp index 86c5a962bc67440346373a800dff446ef9cb889f..d6e58cd649fe243bc52350cbaa2f61b9e4285067 100644 --- a/broadcastradio/aidl/default/VirtualRadio.cpp +++ b/broadcastradio/aidl/default/VirtualRadio.cpp @@ -16,12 +16,15 @@ #include "VirtualRadio.h" #include +#include namespace aidl::android::hardware::broadcastradio { using ::aidl::android::hardware::broadcastradio::utils::makeSelectorAmfm; using ::aidl::android::hardware::broadcastradio::utils::makeSelectorDab; +using ::aidl::android::hardware::broadcastradio::utils::makeSelectorHd; using ::std::string; +using ::std::unordered_set; using ::std::vector; VirtualRadio::VirtualRadio(const string& name, const vector& initialList) @@ -38,15 +41,43 @@ const vector& VirtualRadio::getProgramList() const { } bool VirtualRadio::getProgram(const ProgramSelector& selector, VirtualProgram* programOut) const { - for (const auto& program : mPrograms) { - if (utils::tunesTo(selector, program.selector)) { - *programOut = program; - return true; + for (auto it = mPrograms.begin(); it != mPrograms.end(); it++) { + if (!utils::tunesTo(selector, it->selector)) { + continue; + } + auto firstMatchIt = it; + if (utils::hasAmFmFrequency(it->selector)) { + uint32_t channelFreq = utils::getAmFmFrequency(it->selector); + it++; + while (it != mPrograms.end() && utils::hasAmFmFrequency(it->selector) && + utils::getAmFmFrequency(it->selector) == channelFreq) { + if (it->selector == selector) { + *programOut = *it; + return true; + } + it++; + } } + *programOut = *firstMatchIt; + return true; } return false; } +vector VirtualRadio::getSupportedIdentifierTypes() const { + unordered_set supportedIdentifierTypeSet; + for (const auto& program : mPrograms) { + IdentifierType type = program.selector.primaryId.type; + if (supportedIdentifierTypeSet.count(type)) { + continue; + } + supportedIdentifierTypeSet.insert(type); + } + vector supportedIdentifierTypes(supportedIdentifierTypeSet.begin(), + supportedIdentifierTypeSet.end()); + return supportedIdentifierTypes; +} + // get singleton of AMFM Virtual Radio const VirtualRadio& VirtualRadio::getAmFmRadio() { // clang-format off @@ -56,15 +87,27 @@ const VirtualRadio& VirtualRadio::getAmFmRadio() { {makeSelectorAmfm(/* frequency= */ 94900u), "Wild 94.9", "Drake ft. Rihanna", "Too Good"}, {makeSelectorAmfm(/* frequency= */ 96500u), "KOIT", "Celine Dion", "All By Myself"}, - {makeSelectorAmfm(/* frequency= */ 97300u), "Alice@97.3", "Drops of Jupiter", "Train"}, - {makeSelectorAmfm(/* frequency= */ 99700u), "99.7 Now!", "The Chainsmokers", "Closer"}, {makeSelectorAmfm(/* frequency= */ 101300u), "101-3 KISS-FM", "Justin Timberlake", "Rock Your Body"}, {makeSelectorAmfm(/* frequency= */ 103700u), "iHeart80s @ 103.7", "Michael Jackson", "Billie Jean"}, {makeSelectorAmfm(/* frequency= */ 106100u), "106 KMEL", "Drake", "Marvins Room"}, - {makeSelectorAmfm(/* frequency= */ 700u), "700 AM", "Artist700", "Title700"}, - {makeSelectorAmfm(/* frequency= */ 1700u), "1700 AM", "Artist1700", "Title1700"}, + {makeSelectorAmfm(/* frequency= */ 560u), "Talk Radio 560 KSFO", "Artist560", "Title560"}, + {makeSelectorAmfm(/* frequency= */ 680u), "KNBR 680", "Artist680", "Title680"}, + {makeSelectorAmfm(/* frequency= */ 97300u), "Alice@97.3", "Drops of Jupiter", "Train"}, + {makeSelectorAmfm(/* frequency= */ 99700u), "99.7 Now!", "The Chainsmokers", "Closer"}, + {makeSelectorHd(/* stationId= */ 0xA0000001u, /* subChannel= */ 0u, /* frequency= */ 97700u), + "K-LOVE", "ArtistHd0", "TitleHd0"}, + {makeSelectorHd(/* stationId= */ 0xA0000001u, /* subChannel= */ 1u, /* frequency= */ 97700u), + "Air1", "ArtistHd1", "TitleHd1"}, + {makeSelectorHd(/* stationId= */ 0xA0000001u, /* subChannel= */ 2u, /* frequency= */ 97700u), + "K-LOVE Classics", "ArtistHd2", "TitleHd2"}, + {makeSelectorHd(/* stationId= */ 0xA0000001u, /* subChannel= */ 0u, /* frequency= */ 98500u), + "98.5-1 South Bay's Classic Rock", "ArtistHd0", "TitleHd0"}, + {makeSelectorHd(/* stationId= */ 0xA0000001u, /* subChannel= */ 1u, /* frequency= */ 98500u), + "Highway 1 - Different", "ArtistHd1", "TitleHd1"}, + {makeSelectorHd(/* stationId= */ 0xB0000001u, /* subChannel= */ 0u, /* frequency= */ 1170u), + "KLOK", "ArtistHd1", "TitleHd1"}, }); // clang-format on return amFmRadioMock; @@ -76,14 +119,24 @@ const VirtualRadio& VirtualRadio::getDabRadio() { static VirtualRadio dabRadioMock( "DAB radio mock", { - {makeSelectorDab(/* sidExt= */ 0xA000000001u, /* ensemble= */ 0x0001u, + {makeSelectorDab(/* sidExt= */ 0x0E10000C221u, /* ensemble= */ 0xCE15u, /* freq= */ 225648u), "BBC Radio 1", "Khalid", "Talk"}, - {makeSelectorDab(/* sidExt= */ 0xB000000001u, /* ensemble= */ 0x1001u, + {makeSelectorDab(/* sidExt= */ 0x0E10000C222u, /* ensemble= */ 0xCE15u, + /* freq= */ 225648u), "BBC Radio 2", "Khalid", "Talk"}, + {makeSelectorDab(/* sidExt= */ 0xE10000C224u, /* ensemble= */ 0xCE15u, + /* freq= */ 225648u), "BBC Radio 4", "ArtistBBC1", "TitleCountry1"}, + {makeSelectorDab(/* sidExt= */ 0x1E10000C224u, /* ensemble= */ 0xCE15u, + /* freq= */ 225648u), "BBC Radio 4 LW", "ArtistBBC2", "TitleCountry2"}, + {makeSelectorDab(/* sidExt= */ 0x0E10000C21Au, /* ensemble= */ 0xC181u, /* freq= */ 222064u), "Classic FM", "Jean Sibelius", "Andante Festivo"}, - {makeSelectorDab(/* sidExt= */ 0xB000000002u, /* ensemble= */ 0x1002u, - /* freq= */ 227360u), "Absolute Radio", "Coldplay", "Clocks"}, - {makeSelectorDab(/* sidExt= */ 0xB000000002u, /* ensemble= */ 0x1002u, + {makeSelectorDab(/* sidExt= */ 0x0E10000C1C0u, /* ensemble= */ 0xC181u, + /* freq= */ 223936u), "Absolute Radio", "Coldplay", "Clocks"}, + {makeSelectorDab(/* sidExt= */ 0x0E10000C1C0u, /* ensemble= */ 0xC181u, /* freq= */ 222064u), "Absolute Radio", "Coldplay", "Clocks"}, + {makeSelectorDab(/* sidExt= */ 0x0E10000CCE7u, /* ensemble= */ 0xC19Du, + /* freq= */ 218640u), "Absolute Radio Country", "ArtistCountry1", "TitleCountry1"}, + {makeSelectorDab(/* sidExt= */ 0x0E10000CCE7u, /* ensemble= */ 0xC1A0u, + /* freq= */ 218640u), "Absolute Radio Country", "ArtistCountry2", "TitleCountry2"}, }); // clang-format on return dabRadioMock; diff --git a/broadcastradio/aidl/default/VirtualRadio.h b/broadcastradio/aidl/default/VirtualRadio.h index ae039c463c5885b822d05c6c7d3f6b9ffb2a9143..0d70aefa57636d15368feb650d68ccc6229ca5ec 100644 --- a/broadcastradio/aidl/default/VirtualRadio.h +++ b/broadcastradio/aidl/default/VirtualRadio.h @@ -36,6 +36,7 @@ class VirtualRadio final { std::string getName() const; const std::vector& getProgramList() const; bool getProgram(const ProgramSelector& selector, VirtualProgram* program) const; + std::vector getSupportedIdentifierTypes() const; static const VirtualRadio& getAmFmRadio(); static const VirtualRadio& getDabRadio(); diff --git a/broadcastradio/aidl/default/broadcastradio-default.xml b/broadcastradio/aidl/default/broadcastradio-default.xml index 1555822e075d6880f074ee57527e7f3a02580130..a57b7247c8c99b135788b5ed526e83fe6778fb32 100644 --- a/broadcastradio/aidl/default/broadcastradio-default.xml +++ b/broadcastradio/aidl/default/broadcastradio-default.xml @@ -1,6 +1,7 @@ android.hardware.broadcastradio + 2 IBroadcastRadio/amfm IBroadcastRadio/dab diff --git a/broadcastradio/aidl/default/fuzzer.cpp b/broadcastradio/aidl/default/fuzzer.cpp new file mode 100644 index 0000000000000000000000000000000000000000..d5354329d29036ec6b444e4817c4e253ce0bdef9 --- /dev/null +++ b/broadcastradio/aidl/default/fuzzer.cpp @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include +#include "BroadcastRadio.h" +#include "VirtualRadio.h" + +using ::aidl::android::hardware::broadcastradio::BroadcastRadio; +using ::aidl::android::hardware::broadcastradio::VirtualRadio; +using ::android::fuzzService; + +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { + const VirtualRadio& amFmRadioMock = VirtualRadio::getAmFmRadio(); + std::shared_ptr amFmRadio = + ::ndk::SharedRefBase::make(amFmRadioMock); + const VirtualRadio& dabRadioMock = VirtualRadio::getDabRadio(); + std::shared_ptr dabRadio = + ::ndk::SharedRefBase::make(dabRadioMock); + + std::vector binder_services = {amFmRadio->asBinder(), dabRadio->asBinder()}; + + fuzzService(binder_services, FuzzedDataProvider(data, size)); + + return 0; +} diff --git a/broadcastradio/aidl/vts/Android.bp b/broadcastradio/aidl/vts/Android.bp index b60387ef4944be92de69af295bcff10098733582..87e48a9ebe89fb40df1fba868c38b7d8e1b4e00f 100644 --- a/broadcastradio/aidl/vts/Android.bp +++ b/broadcastradio/aidl/vts/Android.bp @@ -35,8 +35,8 @@ cc_test { "libxml2", ], static_libs: [ - "android.hardware.broadcastradio-V1-ndk", - "android.hardware.broadcastradio@common-utils-aidl-lib", + "android.hardware.broadcastradio-V2-ndk", + "android.hardware.broadcastradio@common-utils-aidl-lib-V2", "android.hardware.broadcastradio@vts-utils-lib", "libgmock", ], diff --git a/broadcastradio/aidl/vts/src/VtsHalBroadcastradioAidlTargetTest.cpp b/broadcastradio/aidl/vts/src/VtsHalBroadcastradioAidlTargetTest.cpp index 790d60b252c716ef124f64a01701a04e55eb5001..2668a97c4f405e687426e9c8d31bc0c0214b5221 100644 --- a/broadcastradio/aidl/vts/src/VtsHalBroadcastradioAidlTargetTest.cpp +++ b/broadcastradio/aidl/vts/src/VtsHalBroadcastradioAidlTargetTest.cpp @@ -32,6 +32,7 @@ #include #include #include +#include #include #include @@ -50,7 +51,6 @@ using ::aidl::android::hardware::broadcastradio::utils::makeSelectorDab; using ::aidl::android::hardware::broadcastradio::utils::resultToInt; using ::ndk::ScopedAStatus; using ::ndk::SharedRefBase; -using ::std::string; using ::std::vector; using ::testing::_; using ::testing::AnyNumber; @@ -73,20 +73,29 @@ const ConfigFlag kConfigFlagValues[] = { ConfigFlag::DAB_FM_SOFT_LINKING, }; -void printSkipped(const string& msg) { +constexpr int32_t kAidlVersion1 = 1; +constexpr int32_t kAidlVersion2 = 2; + +void printSkipped(const std::string& msg) { const auto testInfo = testing::UnitTest::GetInstance()->current_test_info(); LOG(INFO) << "[ SKIPPED ] " << testInfo->test_case_name() << "." << testInfo->name() << " with message: " << msg; } -bool isValidAmFmFreq(int64_t freq) { +bool isValidAmFmFreq(int64_t freq, int aidlVersion) { ProgramIdentifier id = bcutils::makeIdentifier(IdentifierType::AMFM_FREQUENCY_KHZ, freq); - return bcutils::isValid(id); + if (aidlVersion == kAidlVersion1) { + return bcutils::isValid(id); + } else if (aidlVersion == kAidlVersion2) { + return bcutils::isValidV2(id); + } + LOG(ERROR) << "Unknown AIDL version " << aidlVersion; + return false; } -void validateRange(const AmFmBandRange& range) { - EXPECT_TRUE(isValidAmFmFreq(range.lowerBound)); - EXPECT_TRUE(isValidAmFmFreq(range.upperBound)); +void validateRange(const AmFmBandRange& range, int aidlVersion) { + EXPECT_TRUE(isValidAmFmFreq(range.lowerBound, aidlVersion)); + EXPECT_TRUE(isValidAmFmFreq(range.upperBound, aidlVersion)); EXPECT_LT(range.lowerBound, range.upperBound); EXPECT_GT(range.spacing, 0u); EXPECT_EQ((range.upperBound - range.lowerBound) % range.spacing, 0u); @@ -142,7 +151,7 @@ class CallbackFlag final { class TunerCallbackImpl final : public BnTunerCallback { public: - TunerCallbackImpl(); + explicit TunerCallbackImpl(int32_t aidlVersion); ScopedAStatus onTuneFailed(Result result, const ProgramSelector& selector) override; ScopedAStatus onCurrentProgramInfoChanged(const ProgramInfo& info) override; ScopedAStatus onProgramListUpdated(const ProgramListChunk& chunk) override; @@ -160,6 +169,7 @@ class TunerCallbackImpl final : public BnTunerCallback { private: std::mutex mLock; + int32_t mCallbackAidlVersion; bool mAntennaConnectionState GUARDED_BY(mLock); ProgramInfo mCurrentProgramInfo GUARDED_BY(mLock); bcutils::ProgramInfoSet mProgramList GUARDED_BY(mLock); @@ -171,7 +181,7 @@ struct AnnouncementListenerMock : public BnAnnouncementListener { MOCK_METHOD1(onListUpdated, ScopedAStatus(const vector&)); }; -class BroadcastRadioHalTest : public testing::TestWithParam { +class BroadcastRadioHalTest : public testing::TestWithParam { protected: void SetUp() override; void TearDown() override; @@ -183,14 +193,17 @@ class BroadcastRadioHalTest : public testing::TestWithParam { std::shared_ptr mModule; Properties mProperties; std::shared_ptr mCallback; + int32_t mAidlVersion; }; -MATCHER_P(InfoHasId, id, string(negation ? "does not contain" : "contains") + " " + id.toString()) { +MATCHER_P(InfoHasId, id, + std::string(negation ? "does not contain" : "contains") + " " + id.toString()) { vector ids = bcutils::getAllIds(arg.selector, id.type); return ids.end() != find(ids.begin(), ids.end(), id.value); } -TunerCallbackImpl::TunerCallbackImpl() { +TunerCallbackImpl::TunerCallbackImpl(int32_t aidlVersion) { + mCallbackAidlVersion = aidlVersion; mAntennaConnectionState = true; } @@ -230,7 +243,12 @@ ScopedAStatus TunerCallbackImpl::onCurrentProgramInfoChanged(const ProgramInfo& physically > IdentifierType::SXM_CHANNEL); if (logically == IdentifierType::AMFM_FREQUENCY_KHZ) { - std::optional ps = bcutils::getMetadataString(info, Metadata::rdsPs); + std::optional ps; + if (mCallbackAidlVersion == kAidlVersion1) { + ps = bcutils::getMetadataString(info, Metadata::rdsPs); + } else { + ps = bcutils::getMetadataStringV2(info, Metadata::rdsPs); + } if (ps.has_value()) { EXPECT_NE(::android::base::Trim(*ps), "") << "Don't use empty RDS_PS as an indicator of missing RSD PS data."; @@ -323,9 +341,13 @@ void BroadcastRadioHalTest::SetUp() { EXPECT_FALSE(mProperties.product.empty()); EXPECT_GT(mProperties.supportedIdentifierTypes.size(), 0u); - mCallback = SharedRefBase::make(); + // get AIDL HAL version + ASSERT_TRUE(mModule->getInterfaceVersion(&mAidlVersion).isOk()); + EXPECT_GE(mAidlVersion, kAidlVersion1); + EXPECT_LE(mAidlVersion, kAidlVersion2); // set callback + mCallback = SharedRefBase::make(mAidlVersion); EXPECT_TRUE(mModule->setTunerCallback(mCallback).isOk()); } @@ -443,7 +465,7 @@ TEST_P(BroadcastRadioHalTest, GetAmFmRegionConfigRanges) { EXPECT_GT(config.ranges.size(), 0u); for (const auto& range : config.ranges) { - validateRange(range); + validateRange(range, mAidlVersion); EXPECT_EQ(range.seekSpacing % range.spacing, 0u); EXPECT_GE(range.seekSpacing, range.spacing); } @@ -494,7 +516,7 @@ TEST_P(BroadcastRadioHalTest, GetAmFmRegionConfigCapabilitiesRanges) { EXPECT_GT(config.ranges.size(), 0u); for (const auto& range : config.ranges) { - validateRange(range); + validateRange(range, mAidlVersion); EXPECT_EQ(range.seekSpacing, 0u); } } @@ -522,11 +544,17 @@ TEST_P(BroadcastRadioHalTest, GetDabRegionConfig) { std::regex re("^[A-Z0-9][A-Z0-9 ]{0,5}[A-Z0-9]$"); for (const auto& entry : config) { - EXPECT_TRUE(std::regex_match(string(entry.label), re)); + EXPECT_TRUE(std::regex_match(std::string(entry.label), re)); ProgramIdentifier id = bcutils::makeIdentifier(IdentifierType::DAB_FREQUENCY_KHZ, entry.frequencyKhz); - EXPECT_TRUE(bcutils::isValid(id)); + if (mAidlVersion == kAidlVersion1) { + EXPECT_TRUE(bcutils::isValid(id)); + } else if (mAidlVersion == kAidlVersion2) { + EXPECT_TRUE(bcutils::isValidV2(id)); + } else { + LOG(ERROR) << "Unknown callback AIDL version " << mAidlVersion; + } } } @@ -673,6 +701,59 @@ TEST_P(BroadcastRadioHalTest, FmTune) { << "FM freq " << freq << " kHz is not sent back by callback."; } +/** + * Test tuning with HD selector. + * + * Verifies that: + * - if AM/FM HD selector is not supported, the method returns NOT_SUPPORTED; + * - if it is supported, the method succeeds; + * - after a successful tune call, onCurrentProgramInfoChanged callback is + * invoked carrying a proper selector; + * - program changes to a program info with the program selector requested. + */ +TEST_P(BroadcastRadioHalTest, HdTune) { + LOG(DEBUG) << "HdTune Test"; + auto programList = getProgramList(); + if (!programList) { + printSkipped("Empty station list, tune cannot be performed"); + return; + } + ProgramSelector hdSel = {}; + ProgramIdentifier physicallyTunedToExpected = {}; + bool hdStationPresent = false; + for (auto&& programInfo : *programList) { + if (programInfo.selector.primaryId.type != IdentifierType::HD_STATION_ID_EXT) { + continue; + } + hdSel = programInfo.selector; + hdStationPresent = true; + physicallyTunedToExpected = bcutils::makeIdentifier(IdentifierType::AMFM_FREQUENCY_KHZ, + bcutils::getAmFmFrequency(hdSel)); + break; + } + if (!hdStationPresent) { + printSkipped("No HD stations in the list, tune cannot be performed"); + return; + } + + // try tuning + auto result = mModule->tune(hdSel); + + // expect a failure if it's not supported + if (!bcutils::isSupported(mProperties, hdSel)) { + EXPECT_EQ(result.getServiceSpecificError(), resultToInt(Result::NOT_SUPPORTED)); + return; + } + // expect a callback if it succeeds + EXPECT_TRUE(result.isOk()); + EXPECT_TRUE(mCallback->waitOnCurrentProgramInfoChangedCallback()); + ProgramInfo infoCb = mCallback->getCurrentProgramInfo(); + LOG(DEBUG) << "Current program info: " << infoCb.toString(); + // it should tune exactly to what was requested + EXPECT_EQ(infoCb.selector.primaryId, hdSel.primaryId); + EXPECT_EQ(infoCb.physicallyTunedTo, physicallyTunedToExpected); +} + /** * Test tuning with DAB selector. * @@ -1175,10 +1256,21 @@ TEST_P(BroadcastRadioHalTest, HdRadioStationNameId) { continue; } - std::optional name = bcutils::getMetadataString(program, Metadata::programName); - if (!name) { - name = bcutils::getMetadataString(program, Metadata::rdsPs); + std::optional name; + if (mAidlVersion == kAidlVersion1) { + name = bcutils::getMetadataString(program, Metadata::programName); + if (!name) { + name = bcutils::getMetadataString(program, Metadata::rdsPs); + } + } else if (mAidlVersion == kAidlVersion2) { + name = bcutils::getMetadataStringV2(program, Metadata::programName); + if (!name) { + name = bcutils::getMetadataStringV2(program, Metadata::rdsPs); + } + } else { + LOG(ERROR) << "Unknown HAL AIDL version " << mAidlVersion; } + ASSERT_TRUE(name.has_value()); ProgramIdentifier expectedId = bcutils::makeHdRadioStationName(*name); diff --git a/broadcastradio/common/utilsaidl/Android.bp b/broadcastradio/common/utilsaidl/Android.bp index fa6de193638e52833d156cd207277dc2ddd025c8..4ec635b17365dedeb435df4ac3730d1dd295dcad 100644 --- a/broadcastradio/common/utilsaidl/Android.bp +++ b/broadcastradio/common/utilsaidl/Android.bp @@ -25,6 +25,29 @@ package { cc_library_static { name: "android.hardware.broadcastradio@common-utils-aidl-lib", + defaults: [ + "VtsBroadcastRadioDefaults", + ], + shared_libs: [ + "android.hardware.broadcastradio-V1-ndk", + ], +} + +cc_library_static { + name: "android.hardware.broadcastradio@common-utils-aidl-lib-V2", + defaults: [ + "VtsBroadcastRadioDefaults", + ], + srcs: [ + "src/UtilsV2.cpp", + ], + shared_libs: [ + "android.hardware.broadcastradio-V2-ndk", + ], +} + +cc_defaults { + name: "VtsBroadcastRadioDefaults", vendor_available: true, relative_install_path: "hw", cflags: [ @@ -37,11 +60,10 @@ cc_library_static { "-std=c++1z", ], srcs: [ - "Utils.cpp", + "src/Utils.cpp", ], export_include_dirs: ["include"], shared_libs: [ - "android.hardware.broadcastradio-V1-ndk", "libbase", ], static_libs: [ diff --git a/broadcastradio/common/utilsaidl/include/broadcastradio-utils-aidl/Utils.h b/broadcastradio/common/utilsaidl/include/broadcastradio-utils-aidl/Utils.h index ee85a178daaa7dc199ff8273290106076e2146df..3ced6856548e52e881bc4049262a8f94fa91cb02 100644 --- a/broadcastradio/common/utilsaidl/include/broadcastradio-utils-aidl/Utils.h +++ b/broadcastradio/common/utilsaidl/include/broadcastradio-utils-aidl/Utils.h @@ -17,7 +17,6 @@ #pragma once #include -#include #include #include #include @@ -140,9 +139,18 @@ ProgramIdentifier makeIdentifier(IdentifierType type, int64_t value); ProgramSelector makeSelectorAmfm(uint32_t frequency); ProgramSelector makeSelectorDab(uint64_t sidExt); ProgramSelector makeSelectorDab(uint64_t sidExt, uint32_t ensemble, uint64_t freq); +ProgramSelector makeSelectorHd(uint64_t stationId, uint64_t subChannel, uint64_t frequency); bool satisfies(const ProgramFilter& filter, const ProgramSelector& sel); +struct ProgramSelectorComparator { + bool operator()(const ProgramSelector& lhs, const ProgramSelector& rhs) const; +}; + +struct ProgramInfoComparator { + bool operator()(const ProgramInfo& lhs, const ProgramInfo& rhs) const; +}; + struct ProgramInfoHasher { size_t operator()(const ProgramInfo& info) const; }; @@ -159,6 +167,20 @@ std::optional getMetadataString(const ProgramInfo& info, const Meta ProgramIdentifier makeHdRadioStationName(const std::string& name); +uint32_t getHdFrequency(const ProgramSelector& sel); + +int getHdSubchannel(const ProgramSelector& sel); + +uint32_t getDabSId(const ProgramSelector& sel); + +int getDabEccCode(const ProgramSelector& sel); + +int getDabSCIdS(const ProgramSelector& sel); + +bool hasAmFmFrequency(const ProgramSelector& sel); + +uint32_t getAmFmFrequency(const ProgramSelector& sel); + template inline std::string vectorToString(const std::vector& in_values) { return std::accumulate(std::begin(in_values), std::end(in_values), std::string{}, diff --git a/broadcastradio/common/utilsaidl/include/broadcastradio-utils-aidl/UtilsV2.h b/broadcastradio/common/utilsaidl/include/broadcastradio-utils-aidl/UtilsV2.h new file mode 100644 index 0000000000000000000000000000000000000000..e411aa446de65fce9dd8cea1320d522dc2b884c3 --- /dev/null +++ b/broadcastradio/common/utilsaidl/include/broadcastradio-utils-aidl/UtilsV2.h @@ -0,0 +1,35 @@ +/* + * Copyright (C) 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include +#include +#include +#include +#include + +namespace aidl::android::hardware::broadcastradio { + +namespace utils { + +bool isValidV2(const ProgramIdentifier& id); +bool isValidV2(const ProgramSelector& sel); +std::optional getMetadataStringV2(const ProgramInfo& info, const Metadata::Tag& tag); + +} // namespace utils + +} // namespace aidl::android::hardware::broadcastradio diff --git a/broadcastradio/common/utilsaidl/Utils.cpp b/broadcastradio/common/utilsaidl/src/Utils.cpp similarity index 76% rename from broadcastradio/common/utilsaidl/Utils.cpp rename to broadcastradio/common/utilsaidl/src/Utils.cpp index de4f52926da3e47e169ada2f41dc9335ac626b65..b6474424b35e3009b0f051195e177a90c3003a0f 100644 --- a/broadcastradio/common/utilsaidl/Utils.cpp +++ b/broadcastradio/common/utilsaidl/src/Utils.cpp @@ -31,7 +31,6 @@ namespace utils { namespace { using ::android::base::EqualsIgnoreCase; -using ::std::string; using ::std::vector; const int64_t kValueForNotFoundIdentifier = 0; @@ -50,12 +49,6 @@ bool haveEqualIds(const ProgramSelector& a, const ProgramSelector& b, const Iden return getId(a, type) == getId(b, type); } -int getHdSubchannel(const ProgramSelector& sel) { - int64_t hdSidExt = getId(sel, IdentifierType::HD_STATION_ID_EXT, /* defaultValue */ 0); - hdSidExt >>= 32; // Station ID number - return hdSidExt & 0xF; // HD Radio subchannel -} - bool maybeGetId(const ProgramSelector& sel, const IdentifierType& type, int64_t* val) { // iterate through primaryId and secondaryIds for (auto it = begin(sel); it != end(sel); it++) { @@ -133,8 +126,13 @@ bool tunesTo(const ProgramSelector& a, const ProgramSelector& b) { case IdentifierType::AMFM_FREQUENCY_KHZ: if (haveEqualIds(a, b, IdentifierType::HD_STATION_ID_EXT)) return true; if (haveEqualIds(a, b, IdentifierType::RDS_PI)) return true; - return getHdSubchannel(b) == 0 && - haveEqualIds(a, b, IdentifierType::AMFM_FREQUENCY_KHZ); + if (getHdSubchannel(b) != 0) { // supplemental program services + return false; + } + return haveEqualIds(a, b, IdentifierType::AMFM_FREQUENCY_KHZ) || + (b.primaryId.type == IdentifierType::HD_STATION_ID_EXT && + static_cast(getId(a, IdentifierType::AMFM_FREQUENCY_KHZ)) == + getAmFmFrequency(b)); case IdentifierType::DAB_SID_EXT: if (!haveEqualIds(a, b, IdentifierType::DAB_SID_EXT)) { return false; @@ -207,7 +205,7 @@ bool isValid(const ProgramIdentifier& id) { uint64_t val = static_cast(id.value); bool valid = true; - auto expect = [&valid](bool condition, const string& message) { + auto expect = [&valid](bool condition, const std::string& message) { if (!condition) { valid = false; LOG(ERROR) << "identifier not valid, expected " << message; @@ -278,9 +276,9 @@ bool isValid(const ProgramIdentifier& id) { case IdentifierType::SXM_CHANNEL: expect(val < 1000u, "SXM channel < 1000"); break; - case IdentifierType::VENDOR_START: - case IdentifierType::VENDOR_END: - // skip + default: + expect(id.type >= IdentifierType::VENDOR_START && id.type <= IdentifierType::VENDOR_END, + "Undefined identifier type"); break; } @@ -317,6 +315,13 @@ ProgramSelector makeSelectorDab(uint64_t sidExt) { return sel; } +ProgramSelector makeSelectorHd(uint64_t stationId, uint64_t subChannel, uint64_t frequency) { + ProgramSelector sel = {}; + uint64_t sidExt = stationId | (subChannel << 32) | (frequency << 36); + sel.primaryId = makeIdentifier(IdentifierType::HD_STATION_ID_EXT, sidExt); + return sel; +} + ProgramSelector makeSelectorDab(uint64_t sidExt, uint32_t ensemble, uint64_t freq) { ProgramSelector sel = {}; sel.primaryId = makeIdentifier(IdentifierType::DAB_SID_EXT, sidExt); @@ -350,6 +355,55 @@ bool satisfies(const ProgramFilter& filter, const ProgramSelector& sel) { return true; } +bool ProgramSelectorComparator::operator()(const ProgramSelector& lhs, + const ProgramSelector& rhs) const { + if ((utils::hasId(lhs, IdentifierType::AMFM_FREQUENCY_KHZ) || + lhs.primaryId.type == IdentifierType::HD_STATION_ID_EXT) && + (utils::hasId(rhs, IdentifierType::AMFM_FREQUENCY_KHZ) || + rhs.primaryId.type == IdentifierType::HD_STATION_ID_EXT)) { + uint32_t freq1 = utils::getAmFmFrequency(lhs); + int subChannel1 = lhs.primaryId.type == IdentifierType::HD_STATION_ID_EXT + ? utils::getHdSubchannel(lhs) + : 0; + uint32_t freq2 = utils::getAmFmFrequency(rhs); + int subChannel2 = rhs.primaryId.type == IdentifierType::HD_STATION_ID_EXT + ? utils::getHdSubchannel(rhs) + : 0; + return freq1 < freq2 || (freq1 == freq2 && (lhs.primaryId.type < rhs.primaryId.type || + subChannel1 < subChannel2)); + } + if (lhs.primaryId.type == IdentifierType::DAB_SID_EXT && + rhs.primaryId.type == IdentifierType::DAB_SID_EXT) { + uint64_t dabFreq1 = utils::getId(lhs, IdentifierType::DAB_FREQUENCY_KHZ); + uint64_t dabFreq2 = utils::getId(rhs, IdentifierType::DAB_FREQUENCY_KHZ); + if (dabFreq1 != dabFreq2) { + return dabFreq1 < dabFreq2; + } + uint32_t ecc1 = utils::getDabEccCode(lhs); + uint32_t ecc2 = utils::getDabEccCode(rhs); + if (ecc1 != ecc2) { + return ecc1 < ecc2; + } + uint64_t dabEnsemble1 = utils::getId(lhs, IdentifierType::DAB_ENSEMBLE); + uint64_t dabEnsemble2 = utils::getId(rhs, IdentifierType::DAB_ENSEMBLE); + if (dabEnsemble1 != dabEnsemble2) { + return dabEnsemble1 < dabEnsemble2; + } + uint32_t sId1 = utils::getDabSId(lhs); + uint32_t sId2 = utils::getDabSId(rhs); + return sId1 < sId2 || (sId1 == sId2 && utils::getDabSCIdS(lhs) < utils::getDabSCIdS(rhs)); + } + + if (lhs.primaryId.type != rhs.primaryId.type) { + return lhs.primaryId.type < rhs.primaryId.type; + } + return lhs.primaryId.value < rhs.primaryId.value; +} + +bool ProgramInfoComparator::operator()(const ProgramInfo& lhs, const ProgramInfo& rhs) const { + return ProgramSelectorComparator()(lhs.selector, rhs.selector); +} + size_t ProgramInfoHasher::operator()(const ProgramInfo& info) const { const ProgramIdentifier& id = info.selector.primaryId; @@ -452,10 +506,10 @@ std::optional getMetadataString(const ProgramInfo& info, const Meta return metadataString; } -ProgramIdentifier makeHdRadioStationName(const string& name) { +ProgramIdentifier makeHdRadioStationName(const std::string& name) { constexpr size_t maxlen = 8; - string shortName; + std::string shortName; shortName.reserve(maxlen); const auto& loc = std::locale::classic(); @@ -484,7 +538,48 @@ IdentifierType getType(int typeAsInt) { return static_cast(typeAsInt); } -bool parseArgInt(const string& s, int* out) { +uint32_t getDabSId(const ProgramSelector& sel) { + int64_t dabSidExt = getId(sel, IdentifierType::DAB_SID_EXT, /* defaultValue */ 0); + return static_cast(dabSidExt & 0xFFFFFFFF); +} + +int getDabEccCode(const ProgramSelector& sel) { + int64_t dabSidExt = getId(sel, IdentifierType::DAB_SID_EXT, /* defaultValue */ 0); + return static_cast((dabSidExt >> 32) & 0xFF); +} + +int getDabSCIdS(const ProgramSelector& sel) { + int64_t dabSidExt = getId(sel, IdentifierType::DAB_SID_EXT, /* defaultValue */ 0); + return static_cast((dabSidExt >> 40) & 0xF); +} + +int getHdSubchannel(const ProgramSelector& sel) { + int64_t hdSidExt = getId(sel, IdentifierType::HD_STATION_ID_EXT, kValueForNotFoundIdentifier); + hdSidExt >>= 32; // Station ID number + return hdSidExt & 0xF; // HD Radio subchannel +} + +uint32_t getHdFrequency(const ProgramSelector& sel) { + int64_t hdSidExt = getId(sel, IdentifierType::HD_STATION_ID_EXT, kValueForNotFoundIdentifier); + if (hdSidExt == kValueForNotFoundIdentifier) { + return kValueForNotFoundIdentifier; + } + return static_cast((hdSidExt >> 36) & 0x3FFFF); // HD Radio subchannel +} + +bool hasAmFmFrequency(const ProgramSelector& sel) { + return hasId(sel, IdentifierType::AMFM_FREQUENCY_KHZ) || + sel.primaryId.type == IdentifierType::HD_STATION_ID_EXT; +} + +uint32_t getAmFmFrequency(const ProgramSelector& sel) { + if (hasId(sel, IdentifierType::AMFM_FREQUENCY_KHZ)) { + return static_cast(getId(sel, IdentifierType::AMFM_FREQUENCY_KHZ)); + } + return getHdFrequency(sel); +} + +bool parseArgInt(const std::string& s, int* out) { return ::android::base::ParseInt(s, out); } @@ -492,7 +587,7 @@ bool parseArgLong(const std::string& s, long* out) { return ::android::base::ParseInt(s, out); } -bool parseArgBool(const string& s, bool* out) { +bool parseArgBool(const std::string& s, bool* out) { if (EqualsIgnoreCase(s, "true")) { *out = true; } else if (EqualsIgnoreCase(s, "false")) { @@ -503,7 +598,7 @@ bool parseArgBool(const string& s, bool* out) { return true; } -bool parseArgDirection(const string& s, bool* out) { +bool parseArgDirection(const std::string& s, bool* out) { if (EqualsIgnoreCase(s, "up")) { *out = true; } else if (EqualsIgnoreCase(s, "down")) { @@ -514,8 +609,8 @@ bool parseArgDirection(const string& s, bool* out) { return true; } -bool parseArgIdentifierTypeArray(const string& s, vector* out) { - for (const string& val : ::android::base::Split(s, ",")) { +bool parseArgIdentifierTypeArray(const std::string& s, vector* out) { + for (const std::string& val : ::android::base::Split(s, ",")) { int outInt; if (!parseArgInt(val, &outInt)) { return false; @@ -526,8 +621,8 @@ bool parseArgIdentifierTypeArray(const string& s, vector* out) { } bool parseProgramIdentifierList(const std::string& s, vector* out) { - for (const string& idStr : ::android::base::Split(s, ",")) { - const vector idStrPair = ::android::base::Split(idStr, ":"); + for (const std::string& idStr : ::android::base::Split(s, ",")) { + const vector idStrPair = ::android::base::Split(idStr, ":"); if (idStrPair.size() != 2) { return false; } diff --git a/broadcastradio/common/utilsaidl/src/UtilsV2.cpp b/broadcastradio/common/utilsaidl/src/UtilsV2.cpp new file mode 100644 index 0000000000000000000000000000000000000000..ef739df117e1f6472c0dd400cf0dd1c2b26c05e4 --- /dev/null +++ b/broadcastradio/common/utilsaidl/src/UtilsV2.cpp @@ -0,0 +1,240 @@ +/* + * Copyright (C) 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#define LOG_TAG "BcRadioAidlDef.utilsV2" + +#include "broadcastradio-utils-aidl/UtilsV2.h" + +#include +#include + +namespace aidl::android::hardware::broadcastradio { + +namespace utils { + +bool isValidV2(const ProgramIdentifier& id) { + uint64_t val = static_cast(id.value); + bool valid = true; + + auto expect = [&valid](bool condition, const std::string& message) { + if (!condition) { + valid = false; + LOG(ERROR) << "identifier not valid, expected " << message; + } + }; + + switch (id.type) { + case IdentifierType::INVALID: + expect(false, "IdentifierType::INVALID"); + break; + case IdentifierType::DAB_FREQUENCY_KHZ: + expect(val > 100000u, "f > 100MHz"); + [[fallthrough]]; + case IdentifierType::AMFM_FREQUENCY_KHZ: + case IdentifierType::DRMO_FREQUENCY_KHZ: + expect(val > 100u, "f > 100kHz"); + expect(val < 10000000u, "f < 10GHz"); + break; + case IdentifierType::RDS_PI: + expect(val != 0u, "RDS PI != 0"); + expect(val <= 0xFFFFu, "16bit id"); + break; + case IdentifierType::HD_STATION_ID_EXT: { + uint64_t stationId = val & 0xFFFFFFFF; // 32bit + val >>= 32; + uint64_t subchannel = val & 0xF; // 4bit + val >>= 4; + uint64_t freq = val & 0x3FFFF; // 18bit + expect(stationId != 0u, "HD station id != 0"); + expect(subchannel < 8u, "HD subch < 8"); + expect(freq > 100u, "f > 100kHz"); + expect(freq < 10000000u, "f < 10GHz"); + break; + } + case IdentifierType::HD_STATION_NAME: { + while (val > 0) { + char ch = static_cast(val & 0xFF); + val >>= 8; + expect((ch >= '0' && ch <= '9') || (ch >= 'A' && ch <= 'Z'), + "HD_STATION_NAME does not match [A-Z0-9]+"); + } + break; + } + case IdentifierType::DAB_SID_EXT: { + uint64_t sid = val & 0xFFFFFFFF; // 32bit + val >>= 32; + uint64_t ecc = val & 0xFF; // 8bit + expect(sid != 0u, "DAB SId != 0"); + expect(ecc >= 0xA0u && ecc <= 0xF6u, "Invalid ECC, see ETSI TS 101 756 V2.1.1"); + break; + } + case IdentifierType::DAB_ENSEMBLE: + expect(val != 0u, "DAB ensemble != 0"); + expect(val <= 0xFFFFu, "16bit id"); + break; + case IdentifierType::DAB_SCID: + expect(val > 0xFu, "12bit SCId (not 4bit SCIdS)"); + expect(val <= 0xFFFu, "12bit id"); + break; + case IdentifierType::DRMO_SERVICE_ID: + expect(val != 0u, "DRM SId != 0"); + expect(val <= 0xFFFFFFu, "24bit id"); + break; + case IdentifierType::SXM_SERVICE_ID: + expect(val != 0u, "SXM SId != 0"); + expect(val <= 0xFFFFFFFFu, "32bit id"); + break; + case IdentifierType::SXM_CHANNEL: + expect(val < 1000u, "SXM channel < 1000"); + break; + case IdentifierType::HD_STATION_LOCATION: { + uint64_t latitudeBit = val & 0x1; + expect(latitudeBit == 1u, "Latitude comes first"); + val >>= 27; + uint64_t latitudePad = val & 0x1Fu; + expect(latitudePad == 0u, "Latitude padding"); + val >>= 5; + uint64_t longitudeBit = val & 0x1; + expect(longitudeBit == 1u, "Longitude comes next"); + val >>= 27; + uint64_t longitudePad = val & 0x1Fu; + expect(longitudePad == 0u, "Latitude padding"); + break; + } + default: + expect(id.type >= IdentifierType::VENDOR_START && id.type <= IdentifierType::VENDOR_END, + "Undefined identifier type"); + break; + } + + return valid; +} + +bool isValidV2(const ProgramSelector& sel) { + if (sel.primaryId.type != IdentifierType::AMFM_FREQUENCY_KHZ && + sel.primaryId.type != IdentifierType::RDS_PI && + sel.primaryId.type != IdentifierType::HD_STATION_ID_EXT && + sel.primaryId.type != IdentifierType::DAB_SID_EXT && + sel.primaryId.type != IdentifierType::DRMO_SERVICE_ID && + sel.primaryId.type != IdentifierType::SXM_SERVICE_ID && + (sel.primaryId.type < IdentifierType::VENDOR_START || + sel.primaryId.type > IdentifierType::VENDOR_END)) { + return false; + } + return isValidV2(sel.primaryId); +} + +std::optional getMetadataStringV2(const ProgramInfo& info, const Metadata::Tag& tag) { + auto isRdsPs = [tag](const Metadata& item) { return item.getTag() == tag; }; + + auto it = std::find_if(info.metadata.begin(), info.metadata.end(), isRdsPs); + if (it == info.metadata.end()) { + return std::nullopt; + } + + std::string metadataString; + switch (it->getTag()) { + case Metadata::rdsPs: + metadataString = it->get(); + break; + case Metadata::rdsPty: + metadataString = std::to_string(it->get()); + break; + case Metadata::rbdsPty: + metadataString = std::to_string(it->get()); + break; + case Metadata::rdsRt: + metadataString = it->get(); + break; + case Metadata::songTitle: + metadataString = it->get(); + break; + case Metadata::songArtist: + metadataString = it->get(); + break; + case Metadata::songAlbum: + metadataString = it->get(); + break; + case Metadata::stationIcon: + metadataString = std::to_string(it->get()); + break; + case Metadata::albumArt: + metadataString = std::to_string(it->get()); + break; + case Metadata::programName: + metadataString = it->get(); + break; + case Metadata::dabEnsembleName: + metadataString = it->get(); + break; + case Metadata::dabEnsembleNameShort: + metadataString = it->get(); + break; + case Metadata::dabServiceName: + metadataString = it->get(); + break; + case Metadata::dabServiceNameShort: + metadataString = it->get(); + break; + case Metadata::dabComponentName: + metadataString = it->get(); + break; + case Metadata::dabComponentNameShort: + metadataString = it->get(); + break; + case Metadata::genre: + metadataString = it->get(); + break; + case Metadata::commentShortDescription: + metadataString = it->get(); + break; + case Metadata::commentActualText: + metadataString = it->get(); + break; + case Metadata::commercial: + metadataString = it->get(); + break; + case Metadata::ufids: { + auto& ufids = it->get(); + metadataString = "["; + for (const auto& ufid : ufids) { + metadataString += std::string(ufid) + ","; + } + if (ufids.empty()) { + metadataString += "]"; + } else { + metadataString[metadataString.size() - 1] = ']'; + } + } break; + case Metadata::hdStationNameShort: + metadataString = it->get(); + break; + case Metadata::hdStationNameLong: + metadataString = it->get(); + break; + case Metadata::hdSubChannelsAvailable: + metadataString = std::to_string(it->get()); + break; + default: + LOG(ERROR) << "Metadata " << it->toString() << " is not converted."; + return std::nullopt; + } + return metadataString; +} + +} // namespace utils + +} // namespace aidl::android::hardware::broadcastradio diff --git a/camera/common/default/Android.bp b/camera/common/default/Android.bp index e8c8f9dba024594818280fd202e2009eb4121130..b5d3095cff0b0cdaef87368015f380535f419a71 100644 --- a/camera/common/default/Android.bp +++ b/camera/common/default/Android.bp @@ -30,13 +30,12 @@ cc_library_static { "libgralloctypes", "libhardware", "libcamera_metadata", - "android.hardware.graphics.mapper@2.0", - "android.hardware.graphics.mapper@3.0", - "android.hardware.graphics.mapper@4.0", "libexif", + "libui", ], include_dirs: ["system/media/private/camera/include"], export_include_dirs: ["include"], + export_shared_lib_headers: ["libui"], } // NOTE: Deprecated module kept for compatibility reasons. diff --git a/camera/common/default/HandleImporter.cpp b/camera/common/default/HandleImporter.cpp index 1145baa5f150ddfbc8d4e8b4bcfd883a9b942b6e..9c579e59a1001e1a61566a5fce1bc6269907f885 100644 --- a/camera/common/default/HandleImporter.cpp +++ b/camera/common/default/HandleImporter.cpp @@ -17,9 +17,10 @@ #define LOG_TAG "HandleImporter" #include "HandleImporter.h" +#include #include #include -#include "aidl/android/hardware/graphics/common/Smpte2086.h" +#include namespace android { namespace hardware { @@ -31,12 +32,6 @@ using aidl::android::hardware::graphics::common::PlaneLayout; using aidl::android::hardware::graphics::common::PlaneLayoutComponent; using aidl::android::hardware::graphics::common::PlaneLayoutComponentType; using aidl::android::hardware::graphics::common::Smpte2086; -using MetadataType = android::hardware::graphics::mapper::V4_0::IMapper::MetadataType; -using MapperErrorV2 = android::hardware::graphics::mapper::V2_0::Error; -using MapperErrorV3 = android::hardware::graphics::mapper::V3_0::Error; -using MapperErrorV4 = android::hardware::graphics::mapper::V4_0::Error; -using IMapperV3 = android::hardware::graphics::mapper::V3_0::IMapper; -using IMapperV4 = android::hardware::graphics::mapper::V4_0::IMapper; HandleImporter::HandleImporter() : mInitialized(false) {} @@ -45,51 +40,20 @@ void HandleImporter::initializeLocked() { return; } - mMapperV4 = IMapperV4::getService(); - if (mMapperV4 != nullptr) { - mInitialized = true; - return; - } - - mMapperV3 = IMapperV3::getService(); - if (mMapperV3 != nullptr) { - mInitialized = true; - return; - } - - mMapperV2 = IMapper::getService(); - if (mMapperV2 == nullptr) { - ALOGE("%s: cannnot acccess graphics mapper HAL!", __FUNCTION__); - return; - } - + GraphicBufferMapper::preloadHal(); mInitialized = true; return; } void HandleImporter::cleanup() { - mMapperV4.clear(); - mMapperV3.clear(); - mMapperV2.clear(); mInitialized = false; } -template -bool HandleImporter::importBufferInternal(const sp mapper, buffer_handle_t& handle) { - E error; +bool HandleImporter::importBufferInternal(buffer_handle_t& handle) { buffer_handle_t importedHandle; - auto ret = mapper->importBuffer( - hidl_handle(handle), [&](const auto& tmpError, const auto& tmpBufferHandle) { - error = tmpError; - importedHandle = static_cast(tmpBufferHandle); - }); - - if (!ret.isOk()) { - ALOGE("%s: mapper importBuffer failed: %s", __FUNCTION__, ret.description().c_str()); - return false; - } - - if (error != E::NONE) { + auto status = GraphicBufferMapper::get().importBufferNoValidate(handle, &importedHandle); + if (status != OK) { + ALOGE("%s: mapper importBuffer failed: %d", __FUNCTION__, status); return false; } @@ -97,170 +61,32 @@ bool HandleImporter::importBufferInternal(const sp mapper, buffer_handle_t& h return true; } -template -YCbCrLayout HandleImporter::lockYCbCrInternal(const sp mapper, buffer_handle_t& buf, - uint64_t cpuUsage, - const IMapper::Rect& accessRegion) { - hidl_handle acquireFenceHandle; - auto buffer = const_cast(buf); - YCbCrLayout layout = {}; - - typename M::Rect accessRegionCopy = {accessRegion.left, accessRegion.top, accessRegion.width, - accessRegion.height}; - mapper->lockYCbCr(buffer, cpuUsage, accessRegionCopy, acquireFenceHandle, - [&](const auto& tmpError, const auto& tmpLayout) { - if (tmpError == E::NONE) { - // Member by member copy from different versions of YCbCrLayout. - layout.y = tmpLayout.y; - layout.cb = tmpLayout.cb; - layout.cr = tmpLayout.cr; - layout.yStride = tmpLayout.yStride; - layout.cStride = tmpLayout.cStride; - layout.chromaStep = tmpLayout.chromaStep; - } else { - ALOGE("%s: failed to lockYCbCr error %d!", __FUNCTION__, tmpError); - } - }); - return layout; -} +android_ycbcr HandleImporter::lockYCbCr(buffer_handle_t& buf, uint64_t cpuUsage, + const android::Rect& accessRegion) { + Mutex::Autolock lock(mLock); -bool isMetadataPesent(const sp mapper, const buffer_handle_t& buf, - MetadataType metadataType) { - auto buffer = const_cast(buf); - bool ret = false; - hidl_vec vec; - mapper->get(buffer, metadataType, [&](const auto& tmpError, const auto& tmpMetadata) { - if (tmpError == MapperErrorV4::NONE) { - vec = tmpMetadata; - } else { - ALOGE("%s: failed to get metadata %d!", __FUNCTION__, tmpError); - } - }); - - if (vec.size() > 0) { - if (metadataType == gralloc4::MetadataType_Smpte2086) { - std::optional realSmpte2086; - gralloc4::decodeSmpte2086(vec, &realSmpte2086); - ret = realSmpte2086.has_value(); - } else if (metadataType == gralloc4::MetadataType_Smpte2094_10) { - std::optional> realSmpte2094_10; - gralloc4::decodeSmpte2094_10(vec, &realSmpte2094_10); - ret = realSmpte2094_10.has_value(); - } else if (metadataType == gralloc4::MetadataType_Smpte2094_40) { - std::optional> realSmpte2094_40; - gralloc4::decodeSmpte2094_40(vec, &realSmpte2094_40); - ret = realSmpte2094_40.has_value(); - } else { - ALOGE("%s: Unknown metadata type!", __FUNCTION__); - } + if (!mInitialized) { + initializeLocked(); } + android_ycbcr layout; - return ret; -} + status_t status = GraphicBufferMapper::get().lockYCbCr(buf, cpuUsage, accessRegion, &layout); -std::vector getPlaneLayouts(const sp mapper, buffer_handle_t& buf) { - auto buffer = const_cast(buf); - std::vector planeLayouts; - hidl_vec encodedPlaneLayouts; - mapper->get(buffer, gralloc4::MetadataType_PlaneLayouts, - [&](const auto& tmpError, const auto& tmpEncodedPlaneLayouts) { - if (tmpError == MapperErrorV4::NONE) { - encodedPlaneLayouts = tmpEncodedPlaneLayouts; - } else { - ALOGE("%s: failed to get plane layouts %d!", __FUNCTION__, tmpError); - } - }); - - gralloc4::decodePlaneLayouts(encodedPlaneLayouts, &planeLayouts); - - return planeLayouts; -} - -template <> -YCbCrLayout HandleImporter::lockYCbCrInternal( - const sp mapper, buffer_handle_t& buf, uint64_t cpuUsage, - const IMapper::Rect& accessRegion) { - hidl_handle acquireFenceHandle; - auto buffer = const_cast(buf); - YCbCrLayout layout = {}; - void* mapped = nullptr; - - typename IMapperV4::Rect accessRegionV4 = {accessRegion.left, accessRegion.top, - accessRegion.width, accessRegion.height}; - mapper->lock(buffer, cpuUsage, accessRegionV4, acquireFenceHandle, - [&](const auto& tmpError, const auto& tmpPtr) { - if (tmpError == MapperErrorV4::NONE) { - mapped = tmpPtr; - } else { - ALOGE("%s: failed to lock error %d!", __FUNCTION__, tmpError); - } - }); - - if (mapped == nullptr) { - return layout; - } - - std::vector planeLayouts = getPlaneLayouts(mapper, buf); - for (const auto& planeLayout : planeLayouts) { - for (const auto& planeLayoutComponent : planeLayout.components) { - const auto& type = planeLayoutComponent.type; - - if (!gralloc4::isStandardPlaneLayoutComponentType(type)) { - continue; - } - - uint8_t* data = reinterpret_cast(mapped); - data += planeLayout.offsetInBytes; - data += planeLayoutComponent.offsetInBits / 8; - - switch (static_cast(type.value)) { - case PlaneLayoutComponentType::Y: - layout.y = data; - layout.yStride = planeLayout.strideInBytes; - break; - case PlaneLayoutComponentType::CB: - layout.cb = data; - layout.cStride = planeLayout.strideInBytes; - layout.chromaStep = planeLayout.sampleIncrementInBits / 8; - break; - case PlaneLayoutComponentType::CR: - layout.cr = data; - layout.cStride = planeLayout.strideInBytes; - layout.chromaStep = planeLayout.sampleIncrementInBits / 8; - break; - default: - break; - } - } + if (status != OK) { + ALOGE("%s: failed to lockYCbCr error %d!", __FUNCTION__, status); } return layout; } -template -int HandleImporter::unlockInternal(const sp mapper, buffer_handle_t& buf) { - int releaseFence = -1; - auto buffer = const_cast(buf); - - mapper->unlock(buffer, [&](const auto& tmpError, const auto& tmpReleaseFence) { - if (tmpError == E::NONE) { - auto fenceHandle = tmpReleaseFence.getNativeHandle(); - if (fenceHandle) { - if (fenceHandle->numInts != 0 || fenceHandle->numFds != 1) { - ALOGE("%s: bad release fence numInts %d numFds %d", __FUNCTION__, - fenceHandle->numInts, fenceHandle->numFds); - return; - } - releaseFence = dup(fenceHandle->data[0]); - if (releaseFence < 0) { - ALOGE("%s: bad release fence FD %d", __FUNCTION__, releaseFence); - } - } - } else { - ALOGE("%s: failed to unlock error %d!", __FUNCTION__, tmpError); - } - }); - return releaseFence; +std::vector getPlaneLayouts(buffer_handle_t& buf) { + std::vector planeLayouts; + status_t status = GraphicBufferMapper::get().getPlaneLayouts(buf, &planeLayouts); + if (status != OK) { + ALOGE("%s: failed to get PlaneLayouts! Status %d", __FUNCTION__, status); + } + + return planeLayouts; } // In IComposer, any buffer_handle_t is owned by the caller and we need to @@ -277,20 +103,7 @@ bool HandleImporter::importBuffer(buffer_handle_t& handle) { initializeLocked(); } - if (mMapperV4 != nullptr) { - return importBufferInternal(mMapperV4, handle); - } - - if (mMapperV3 != nullptr) { - return importBufferInternal(mMapperV3, handle); - } - - if (mMapperV2 != nullptr) { - return importBufferInternal(mMapperV2, handle); - } - - ALOGE("%s: mMapperV4, mMapperV3 and mMapperV2 are all null!", __FUNCTION__); - return false; + return importBufferInternal(handle); } void HandleImporter::freeBuffer(buffer_handle_t handle) { @@ -303,21 +116,9 @@ void HandleImporter::freeBuffer(buffer_handle_t handle) { initializeLocked(); } - if (mMapperV4 != nullptr) { - auto ret = mMapperV4->freeBuffer(const_cast(handle)); - if (!ret.isOk()) { - ALOGE("%s: mapper freeBuffer failed: %s", __FUNCTION__, ret.description().c_str()); - } - } else if (mMapperV3 != nullptr) { - auto ret = mMapperV3->freeBuffer(const_cast(handle)); - if (!ret.isOk()) { - ALOGE("%s: mapper freeBuffer failed: %s", __FUNCTION__, ret.description().c_str()); - } - } else { - auto ret = mMapperV2->freeBuffer(const_cast(handle)); - if (!ret.isOk()) { - ALOGE("%s: mapper freeBuffer failed: %s", __FUNCTION__, ret.description().c_str()); - } + status_t status = GraphicBufferMapper::get().freeBuffer(handle); + if (status != OK) { + ALOGE("%s: mapper freeBuffer failed. Status %d", __FUNCTION__, status); } } @@ -345,12 +146,12 @@ void HandleImporter::closeFence(int fd) const { } void* HandleImporter::lock(buffer_handle_t& buf, uint64_t cpuUsage, size_t size) { - IMapper::Rect accessRegion{0, 0, static_cast(size), 1}; + android::Rect accessRegion{0, 0, static_cast(size), 1}; return lock(buf, cpuUsage, accessRegion); } void* HandleImporter::lock(buffer_handle_t& buf, uint64_t cpuUsage, - const IMapper::Rect& accessRegion) { + const android::Rect& accessRegion) { Mutex::Autolock lock(mLock); if (!mInitialized) { @@ -358,81 +159,18 @@ void* HandleImporter::lock(buffer_handle_t& buf, uint64_t cpuUsage, } void* ret = nullptr; - - if (mMapperV4 == nullptr && mMapperV3 == nullptr && mMapperV2 == nullptr) { - ALOGE("%s: mMapperV4, mMapperV3 and mMapperV2 are all null!", __FUNCTION__); - return ret; - } - - hidl_handle acquireFenceHandle; - auto buffer = const_cast(buf); - if (mMapperV4 != nullptr) { - IMapperV4::Rect accessRegionV4{accessRegion.left, accessRegion.top, accessRegion.width, - accessRegion.height}; - - mMapperV4->lock(buffer, cpuUsage, accessRegionV4, acquireFenceHandle, - [&](const auto& tmpError, const auto& tmpPtr) { - if (tmpError == MapperErrorV4::NONE) { - ret = tmpPtr; - } else { - ALOGE("%s: failed to lock error %d!", __FUNCTION__, tmpError); - } - }); - } else if (mMapperV3 != nullptr) { - IMapperV3::Rect accessRegionV3{accessRegion.left, accessRegion.top, accessRegion.width, - accessRegion.height}; - - mMapperV3->lock(buffer, cpuUsage, accessRegionV3, acquireFenceHandle, - [&](const auto& tmpError, const auto& tmpPtr, const auto& /*bytesPerPixel*/, - const auto& /*bytesPerStride*/) { - if (tmpError == MapperErrorV3::NONE) { - ret = tmpPtr; - } else { - ALOGE("%s: failed to lock error %d!", __FUNCTION__, tmpError); - } - }); - } else { - mMapperV2->lock(buffer, cpuUsage, accessRegion, acquireFenceHandle, - [&](const auto& tmpError, const auto& tmpPtr) { - if (tmpError == MapperErrorV2::NONE) { - ret = tmpPtr; - } else { - ALOGE("%s: failed to lock error %d!", __FUNCTION__, tmpError); - } - }); + status_t status = GraphicBufferMapper::get().lock(buf, cpuUsage, accessRegion, &ret); + if (status != OK) { + ALOGE("%s: failed to lock error %d!", __FUNCTION__, status); } ALOGV("%s: ptr %p accessRegion.top: %d accessRegion.left: %d accessRegion.width: %d " "accessRegion.height: %d", - __FUNCTION__, ret, accessRegion.top, accessRegion.left, accessRegion.width, - accessRegion.height); + __FUNCTION__, ret, accessRegion.top, accessRegion.left, accessRegion.width(), + accessRegion.height()); return ret; } -YCbCrLayout HandleImporter::lockYCbCr(buffer_handle_t& buf, uint64_t cpuUsage, - const IMapper::Rect& accessRegion) { - Mutex::Autolock lock(mLock); - - if (!mInitialized) { - initializeLocked(); - } - - if (mMapperV4 != nullptr) { - return lockYCbCrInternal(mMapperV4, buf, cpuUsage, accessRegion); - } - - if (mMapperV3 != nullptr) { - return lockYCbCrInternal(mMapperV3, buf, cpuUsage, accessRegion); - } - - if (mMapperV2 != nullptr) { - return lockYCbCrInternal(mMapperV2, buf, cpuUsage, accessRegion); - } - - ALOGE("%s: mMapperV4, mMapperV3 and mMapperV2 are all null!", __FUNCTION__); - return {}; -} - status_t HandleImporter::getMonoPlanarStrideBytes(buffer_handle_t& buf, uint32_t* stride /*out*/) { if (stride == nullptr) { return BAD_VALUE; @@ -444,35 +182,26 @@ status_t HandleImporter::getMonoPlanarStrideBytes(buffer_handle_t& buf, uint32_t initializeLocked(); } - if (mMapperV4 != nullptr) { - std::vector planeLayouts = getPlaneLayouts(mMapperV4, buf); - if (planeLayouts.size() != 1) { - ALOGE("%s: Unexpected number of planes %zu!", __FUNCTION__, planeLayouts.size()); - return BAD_VALUE; - } - - *stride = planeLayouts[0].strideInBytes; - } else { - ALOGE("%s: mMapperV4 is null! Query not supported!", __FUNCTION__); - return NO_INIT; + std::vector planeLayouts = getPlaneLayouts(buf); + if (planeLayouts.size() != 1) { + ALOGE("%s: Unexpected number of planes %zu!", __FUNCTION__, planeLayouts.size()); + return BAD_VALUE; } + *stride = planeLayouts[0].strideInBytes; + return OK; } int HandleImporter::unlock(buffer_handle_t& buf) { - if (mMapperV4 != nullptr) { - return unlockInternal(mMapperV4, buf); - } - if (mMapperV3 != nullptr) { - return unlockInternal(mMapperV3, buf); - } - if (mMapperV2 != nullptr) { - return unlockInternal(mMapperV2, buf); + int releaseFence = -1; + + status_t status = GraphicBufferMapper::get().unlockAsync(buf, &releaseFence); + if (status != OK) { + ALOGE("%s: failed to unlock error %d!", __FUNCTION__, status); } - ALOGE("%s: mMapperV4, mMapperV3 and mMapperV2 are all null!", __FUNCTION__); - return -1; + return releaseFence; } bool HandleImporter::isSmpte2086Present(const buffer_handle_t& buf) { @@ -481,14 +210,14 @@ bool HandleImporter::isSmpte2086Present(const buffer_handle_t& buf) { if (!mInitialized) { initializeLocked(); } - - if (mMapperV4 != nullptr) { - return isMetadataPesent(mMapperV4, buf, gralloc4::MetadataType_Smpte2086); - } else { - ALOGE("%s: mMapperV4 is null! Query not supported!", __FUNCTION__); + std::optional metadata; + status_t status = GraphicBufferMapper::get().getSmpte2086(buf, &metadata); + if (status != OK) { + ALOGE("%s: Mapper failed to get Smpte2094_40 metadata! Status: %d", __FUNCTION__, status); + return false; } - return false; + return metadata.has_value(); } bool HandleImporter::isSmpte2094_10Present(const buffer_handle_t& buf) { @@ -498,13 +227,14 @@ bool HandleImporter::isSmpte2094_10Present(const buffer_handle_t& buf) { initializeLocked(); } - if (mMapperV4 != nullptr) { - return isMetadataPesent(mMapperV4, buf, gralloc4::MetadataType_Smpte2094_10); - } else { - ALOGE("%s: mMapperV4 is null! Query not supported!", __FUNCTION__); + std::optional> metadata; + status_t status = GraphicBufferMapper::get().getSmpte2094_10(buf, &metadata); + if (status != OK) { + ALOGE("%s: Mapper failed to get Smpte2094_40 metadata! Status: %d", __FUNCTION__, status); + return false; } - return false; + return metadata.has_value(); } bool HandleImporter::isSmpte2094_40Present(const buffer_handle_t& buf) { @@ -514,13 +244,14 @@ bool HandleImporter::isSmpte2094_40Present(const buffer_handle_t& buf) { initializeLocked(); } - if (mMapperV4 != nullptr) { - return isMetadataPesent(mMapperV4, buf, gralloc4::MetadataType_Smpte2094_40); - } else { - ALOGE("%s: mMapperV4 is null! Query not supported!", __FUNCTION__); + std::optional> metadata; + status_t status = GraphicBufferMapper::get().getSmpte2094_40(buf, &metadata); + if (status != OK) { + ALOGE("%s: Mapper failed to get Smpte2094_40 metadata! Status: %d", __FUNCTION__, status); + return false; } - return false; + return metadata.has_value(); } } // namespace helper diff --git a/camera/common/default/include/HandleImporter.h b/camera/common/default/include/HandleImporter.h index 5408ba92e6600dcedf38f76391a7b953c4bb7025..df01202224557287f983a72ef66e03e80bb6204a 100644 --- a/camera/common/default/include/HandleImporter.h +++ b/camera/common/default/include/HandleImporter.h @@ -17,15 +17,11 @@ #ifndef CAMERA_COMMON_1_0_HANDLEIMPORTED_H #define CAMERA_COMMON_1_0_HANDLEIMPORTED_H -#include -#include -#include #include +#include +#include #include -using android::hardware::graphics::mapper::V2_0::IMapper; -using android::hardware::graphics::mapper::V2_0::YCbCrLayout; - namespace android { namespace hardware { namespace camera { @@ -49,11 +45,11 @@ class HandleImporter { void* lock(buffer_handle_t& buf, uint64_t cpuUsage, size_t size); // Locks 2-D buffer. Assumes caller has waited for acquire fences. - void* lock(buffer_handle_t& buf, uint64_t cpuUsage, const IMapper::Rect& accessRegion); + void* lock(buffer_handle_t& buf, uint64_t cpuUsage, const android::Rect& accessRegion); // Assumes caller has waited for acquire fences. - YCbCrLayout lockYCbCr(buffer_handle_t& buf, uint64_t cpuUsage, - const IMapper::Rect& accessRegion); + android_ycbcr lockYCbCr(buffer_handle_t& buf, uint64_t cpuUsage, + const android::Rect& accessRegion); // Query the stride of the first plane in bytes. status_t getMonoPlanarStrideBytes(buffer_handle_t& buf, uint32_t* stride /*out*/); @@ -69,19 +65,11 @@ class HandleImporter { void initializeLocked(); void cleanup(); - template - bool importBufferInternal(const sp mapper, buffer_handle_t& handle); - template - YCbCrLayout lockYCbCrInternal(const sp mapper, buffer_handle_t& buf, uint64_t cpuUsage, - const IMapper::Rect& accessRegion); - template - int unlockInternal(const sp mapper, buffer_handle_t& buf); + bool importBufferInternal(buffer_handle_t& handle); + int unlockInternal(buffer_handle_t& buf); Mutex mLock; bool mInitialized; - sp mMapperV2; - sp mMapperV3; - sp mMapperV4; }; } // namespace helper diff --git a/camera/device/1.0/default/Android.bp b/camera/device/1.0/default/Android.bp index 9ff6480d4b7ed1c3bea6b82913d23485509995cb..6992ff0294b9f999783b6729ab35737f522c4b5f 100644 --- a/camera/device/1.0/default/Android.bp +++ b/camera/device/1.0/default/Android.bp @@ -32,6 +32,7 @@ cc_library_shared { "libgralloctypes", "libhardware", "libcamera_metadata", + "libui", ], static_libs: [ "android.hardware.camera.common@1.0-helper", diff --git a/camera/device/3.2/default/Android.bp b/camera/device/3.2/default/Android.bp index a1962915fff7f1c4e570796c6008acb9addde860..adf834ac53369ad05e9d059eac38e67604c0e8d0 100644 --- a/camera/device/3.2/default/Android.bp +++ b/camera/device/3.2/default/Android.bp @@ -30,6 +30,7 @@ cc_library_shared { "libhardware", "libcamera_metadata", "libfmq", + "libui", ], static_libs: [ "android.hardware.camera.common@1.0-helper", diff --git a/camera/device/3.4/default/Android.bp b/camera/device/3.4/default/Android.bp index 9f0c77739a571af6190a1e0331162476b9474c93..100106e437323b1a81df1b2121858398c77dabb3 100644 --- a/camera/device/3.4/default/Android.bp +++ b/camera/device/3.4/default/Android.bp @@ -106,6 +106,7 @@ cc_library_shared { "libjpeg", "libexif", "libtinyxml2", + "libui", ], static_libs: [ "android.hardware.camera.common@1.0-helper", diff --git a/camera/device/3.4/default/ExternalCameraDeviceSession.cpp b/camera/device/3.4/default/ExternalCameraDeviceSession.cpp index ca7186b18db6a4460524fa2b118e51728060578e..01b3d41ff7d5dc3d37945408a27656de6951777d 100644 --- a/camera/device/3.4/default/ExternalCameraDeviceSession.cpp +++ b/camera/device/3.4/default/ExternalCameraDeviceSession.cpp @@ -1574,14 +1574,23 @@ bool ExternalCameraDeviceSession::OutputThread::threadLoop() { } break; case PixelFormat::YCBCR_420_888: case PixelFormat::YV12: { - IMapper::Rect outRect {0, 0, - static_cast(halBuf.width), - static_cast(halBuf.height)}; - YCbCrLayout outLayout = sHandleImporter.lockYCbCr( - *(halBuf.bufPtr), halBuf.usage, outRect); - ALOGV("%s: outLayout y %p cb %p cr %p y_str %d c_str %d c_step %d", - __FUNCTION__, outLayout.y, outLayout.cb, outLayout.cr, - outLayout.yStride, outLayout.cStride, outLayout.chromaStep); + android::Rect outRect{0, 0, static_cast(halBuf.width), + static_cast(halBuf.height)}; + android_ycbcr result = + sHandleImporter.lockYCbCr(*(halBuf.bufPtr), halBuf.usage, outRect); + ALOGV("%s: outLayout y %p cb %p cr %p y_str %zu c_str %zu c_step %zu", __FUNCTION__, + result.y, result.cb, result.cr, result.ystride, result.cstride, + result.chroma_step); + if (result.ystride > UINT32_MAX || result.cstride > UINT32_MAX || + result.chroma_step > UINT32_MAX) { + return onDeviceError("%s: lockYCbCr failed. Unexpected values!", __FUNCTION__); + } + YCbCrLayout outLayout = {.y = result.y, + .cb = result.cb, + .cr = result.cr, + .yStride = static_cast(result.ystride), + .cStride = static_cast(result.cstride), + .chromaStep = static_cast(result.chroma_step)}; // Convert to output buffer size/format uint32_t outputFourcc = getFourCcFromLayout(outLayout); diff --git a/camera/device/3.5/default/Android.bp b/camera/device/3.5/default/Android.bp index 9d27b321e06ae2c04f7d27b6f12183067c58cfee..bc15629da003b6b09d01f19184abda466100bf00 100644 --- a/camera/device/3.5/default/Android.bp +++ b/camera/device/3.5/default/Android.bp @@ -46,6 +46,7 @@ cc_library_shared { ], shared_libs: [ "libhidlbase", + "libui", "libutils", "libcutils", "camera.device@3.2-impl", @@ -81,6 +82,7 @@ cc_library_shared { ], shared_libs: [ "libhidlbase", + "libui", "libutils", "libcutils", "camera.device@3.2-impl", diff --git a/camera/device/3.6/default/Android.bp b/camera/device/3.6/default/Android.bp index 89ee14582059df97d6971070f0ec8758dddbd570..b4a486ff267f0eff2a45f2ad73213105269235e3 100644 --- a/camera/device/3.6/default/Android.bp +++ b/camera/device/3.6/default/Android.bp @@ -41,6 +41,7 @@ cc_library_shared { ], shared_libs: [ "libhidlbase", + "libui", "libutils", "libcutils", "camera.device@3.2-impl", diff --git a/camera/device/3.6/default/ExternalCameraOfflineSession.cpp b/camera/device/3.6/default/ExternalCameraOfflineSession.cpp index e606fda8321ed42ddf91c790d45cda9cadcea7a4..1f1dfee146b4248e7704e09e43e174976b0de927 100644 --- a/camera/device/3.6/default/ExternalCameraOfflineSession.cpp +++ b/camera/device/3.6/default/ExternalCameraOfflineSession.cpp @@ -222,14 +222,23 @@ bool ExternalCameraOfflineSession::OutputThread::threadLoop() { } break; case PixelFormat::YCBCR_420_888: case PixelFormat::YV12: { - IMapper::Rect outRect {0, 0, - static_cast(halBuf.width), - static_cast(halBuf.height)}; - YCbCrLayout outLayout = sHandleImporter.lockYCbCr( - *(halBuf.bufPtr), halBuf.usage, outRect); - ALOGV("%s: outLayout y %p cb %p cr %p y_str %d c_str %d c_step %d", - __FUNCTION__, outLayout.y, outLayout.cb, outLayout.cr, - outLayout.yStride, outLayout.cStride, outLayout.chromaStep); + android::Rect outRect{0, 0, static_cast(halBuf.width), + static_cast(halBuf.height)}; + android_ycbcr result = + sHandleImporter.lockYCbCr(*(halBuf.bufPtr), halBuf.usage, outRect); + ALOGV("%s: outLayout y %p cb %p cr %p y_str %zu c_str %zu c_step %zu", __FUNCTION__, + result.y, result.cb, result.cr, result.ystride, result.cstride, + result.chroma_step); + if (result.ystride > UINT32_MAX || result.cstride > UINT32_MAX || + result.chroma_step > UINT32_MAX) { + return onDeviceError("%s: lockYCbCr failed. Unexpected values!", __FUNCTION__); + } + YCbCrLayout outLayout = {.y = result.y, + .cb = result.cb, + .cr = result.cr, + .yStride = static_cast(result.ystride), + .cStride = static_cast(result.cstride), + .chromaStep = static_cast(result.chroma_step)}; // Convert to output buffer size/format uint32_t outputFourcc = V3_4::implementation::getFourCcFromLayout(outLayout); diff --git a/camera/device/aidl/Android.bp b/camera/device/aidl/Android.bp index 43a3934e74cfd5aa488e82a7f9c877bc3260c175..4115c651d8c03bcee04a532e3a77e876b1a47e68 100644 --- a/camera/device/aidl/Android.bp +++ b/camera/device/aidl/Android.bp @@ -11,14 +11,14 @@ aidl_interface { name: "android.hardware.camera.device", vendor_available: true, srcs: ["android/hardware/camera/device/*.aidl"], - frozen: true, + frozen: false, stability: "vintf", imports: [ "android.hardware.common-V2", "android.hardware.common.fmq-V1", "android.hardware.camera.common-V1", "android.hardware.camera.metadata-V2", - "android.hardware.graphics.common-V4", + "android.hardware.graphics.common-V5", ], backend: { cpp: { @@ -37,7 +37,7 @@ aidl_interface { "android.hardware.common.fmq-V1", "android.hardware.camera.common-V1", "android.hardware.camera.metadata-V1", - "android.hardware.graphics.common-V4", + "android.hardware.graphics.common-V5", ], }, { @@ -47,7 +47,7 @@ aidl_interface { "android.hardware.common.fmq-V1", "android.hardware.camera.common-V1", "android.hardware.camera.metadata-V2", - "android.hardware.graphics.common-V4", + "android.hardware.graphics.common-V5", ], }, diff --git a/camera/device/aidl/aidl_api/android.hardware.camera.device/current/android/hardware/camera/device/ConfigureStreamsRet.aidl b/camera/device/aidl/aidl_api/android.hardware.camera.device/current/android/hardware/camera/device/ConfigureStreamsRet.aidl new file mode 100644 index 0000000000000000000000000000000000000000..5535a30e2aefbe52276809faf891e3d523524657 --- /dev/null +++ b/camera/device/aidl/aidl_api/android.hardware.camera.device/current/android/hardware/camera/device/ConfigureStreamsRet.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/////////////////////////////////////////////////////////////////////////////// +// THIS 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 -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.camera.device; +@VintfStability +parcelable ConfigureStreamsRet { + android.hardware.camera.device.HalStream[] halStreams; + boolean enableHalBufferManager = false; +} diff --git a/camera/device/aidl/aidl_api/android.hardware.camera.device/current/android/hardware/camera/device/ICameraDevice.aidl b/camera/device/aidl/aidl_api/android.hardware.camera.device/current/android/hardware/camera/device/ICameraDevice.aidl index 51c60676beefbc89baa0a0cd7e2bddad3d7ea216..f73483a4b3b2833a5e880d9b93fce7b41f7a675d 100644 --- a/camera/device/aidl/aidl_api/android.hardware.camera.device/current/android/hardware/camera/device/ICameraDevice.aidl +++ b/camera/device/aidl/aidl_api/android.hardware.camera.device/current/android/hardware/camera/device/ICameraDevice.aidl @@ -43,4 +43,7 @@ interface ICameraDevice { void setTorchMode(boolean on); void turnOnTorchWithStrengthLevel(int torchStrength); int getTorchStrengthLevel(); + android.hardware.camera.device.CameraMetadata constructDefaultRequestSettings(in android.hardware.camera.device.RequestTemplate type); + boolean isStreamCombinationWithSettingsSupported(in android.hardware.camera.device.StreamConfiguration streams); + android.hardware.camera.device.CameraMetadata getSessionCharacteristics(in android.hardware.camera.device.StreamConfiguration sessionConfig); } diff --git a/camera/device/aidl/aidl_api/android.hardware.camera.device/current/android/hardware/camera/device/ICameraDeviceSession.aidl b/camera/device/aidl/aidl_api/android.hardware.camera.device/current/android/hardware/camera/device/ICameraDeviceSession.aidl index 2196d37a6c6f051c2cd9988682875d5c413de3dc..b6ae734392db1d51507ae1e6fbf1e4cfb693f4b4 100644 --- a/camera/device/aidl/aidl_api/android.hardware.camera.device/current/android/hardware/camera/device/ICameraDeviceSession.aidl +++ b/camera/device/aidl/aidl_api/android.hardware.camera.device/current/android/hardware/camera/device/ICameraDeviceSession.aidl @@ -45,4 +45,5 @@ interface ICameraDeviceSession { oneway void signalStreamFlush(in int[] streamIds, in int streamConfigCounter); android.hardware.camera.device.ICameraOfflineSession switchToOffline(in int[] streamsToKeep, out android.hardware.camera.device.CameraOfflineSessionInfo offlineSessionInfo); void repeatingRequestEnd(in int frameNumber, in int[] streamIds); + android.hardware.camera.device.ConfigureStreamsRet configureStreamsV2(in android.hardware.camera.device.StreamConfiguration requestedConfiguration); } diff --git a/camera/device/aidl/android/hardware/camera/device/ConfigureStreamsRet.aidl b/camera/device/aidl/android/hardware/camera/device/ConfigureStreamsRet.aidl new file mode 100644 index 0000000000000000000000000000000000000000..8f462ecb5fa88face7b8a6df84439c60a4d03cbb --- /dev/null +++ b/camera/device/aidl/android/hardware/camera/device/ConfigureStreamsRet.aidl @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.hardware.camera.device; + +import android.hardware.camera.device.HalStream; + +/** + * ConfigureStreamsRet. + * + * Parcelable returned by the 'configureStreamsV2' call. + * This contains information which informs the camera framework + * about properties of each stream configured and also whether the + * the hal buffer manager must be used for the session configured. + */ +@VintfStability +parcelable ConfigureStreamsRet { + /** + * A vector of HalStream Parcelables, which contain information + * about the stream parameters desired by the HAL such as usage flags, + * overridden format, maximum buffers etc. + */ + HalStream[] halStreams; + /** + * A boolean informing the camera framework whether the HAL buffer manager + * must be used for the session configured. + */ + boolean enableHalBufferManager = false; +} diff --git a/camera/device/aidl/android/hardware/camera/device/ICameraDevice.aidl b/camera/device/aidl/android/hardware/camera/device/ICameraDevice.aidl index f9400006c852977bd643c3149b65a0c35e8bb0c1..3a1d7625d599d14fba2915d79be5cdab0ca039b7 100644 --- a/camera/device/aidl/android/hardware/camera/device/ICameraDevice.aidl +++ b/camera/device/aidl/android/hardware/camera/device/ICameraDevice.aidl @@ -21,6 +21,7 @@ import android.hardware.camera.device.CameraMetadata; import android.hardware.camera.device.ICameraDeviceCallback; import android.hardware.camera.device.ICameraDeviceSession; import android.hardware.camera.device.ICameraInjectionSession; +import android.hardware.camera.device.RequestTemplate; import android.hardware.camera.device.StreamConfiguration; import android.os.ParcelFileDescriptor; @@ -346,4 +347,122 @@ interface ICameraDevice { * */ int getTorchStrengthLevel(); + + /** + * constructDefaultRequestSettings: + * + * This is the same as ICameraDeviceSession.constructDefaultRequestSettings, with + * the exception that it can be called before the ICameraDevice.open call. + * + * @param type The requested template CaptureRequest type to create the default settings for. + * + * @return capture settings for the requested use case. + * + */ + CameraMetadata constructDefaultRequestSettings(in RequestTemplate type); + + /** + * isStreamCombinationWithSettingsSupported: + * + * This is the same as isStreamCombinationSupported with below exceptions: + * + * 1. The input StreamConfiguration parameter may contain session parameters + * supported by this camera device. When checking if the particular StreamConfiguration + * is supported, the camera HAL must take the session parameters into consideration. + * + * 2. For version 3 of this interface, the camera compliance test will verify that + * isStreamCombinationWithSettingsSupported behaves properly for all combinations of + * below features. This function must return true for all supported combinations, + * and return false for non-supported feature combinations. The list of features + * required may grow in future versions. + * + * - Stream Combinations (a subset of LEGACY device mandatory stream combinations): + * { + * // 4:3 16:9 + * // S1440P: 1920 x 1440 2560 x 1440 + * // S1080P: 1440 x 1080 1920 x 1080 + * // S720P: 960 x 720 1280 x 720 + * + * // Simple preview, GPU video processing, or no-preview video recording + * {PRIV, MAXIMUM}, + * {PRIV, PREVIEW}, + * {PRIV, S1440P}, + * {PRIV, S1080P}, + * {PRIV, S720P}, + * // In-application video/image processing + * {YUV, MAXIMUM}, + * {YUV, PREVIEW}, + * {YUV, S1440P}, + * {YUV, S1080P}, + * {YUV, S720P}, + * // Standard still imaging. + * {PRIV, PREVIEW, JPEG, MAXIMUM}, + * {PRIV, S1440P, JPEG, MAXIMUM}, + * {PRIV, S1080P, JPEG, MAXIMUM}, + * {PRIV, S720P, JPEG, MAXIMUM}, + * {PRIV, S1440P, JPEG, S1440P}, + * {PRIV, S1080P, JPEG, S1080P}, + * {PRIV, S720P, JPEG, S1080P}, + * // In-app processing plus still capture. + * {YUV, PREVIEW, JPEG, MAXIMUM}, + * {YUV, S1440P, JPEG, MAXIMUM}, + * {YUV, S1080P, JPEG, MAXIMUM}, + * {YUV, S720P, JPEG, MAXIMUM}, + * // Standard recording. + * {PRIV, PREVIEW, PRIV, PREVIEW}, + * {PRIV, S1440P, PRIV, S1440P}, + * {PRIV, S1080P, PRIV, S1080P}, + * {PRIV, S720P, PRIV, S720P}, + * // Preview plus in-app processing. + * {PRIV, PREVIEW, YUV, PREVIEW}, + * {PRIV, S1440P, YUV, S1440P}, + * {PRIV, S1080P, YUV, S1080P}, + * {PRIV, S720P, YUV, S720P}, + * } + * - VIDEO_STABILIZATION_MODES: {OFF, PREVIEW} + * - AE_TARGET_FPS_RANGE: {{*, 30}, {*, 60}} + * - DYNAMIC_RANGE_PROFILE: {STANDARD, HLG10} + * + * Note: If a combination contains a S1440P, S1080P, or S720P stream, + * both 4:3 and 16:9 aspect ratio will be considered. For example, for the + * stream combination of {PRIV, S1440P, JPEG, MAXIMUM}, and if MAXIMUM == + * 4032 x 3024, the camera compliance test will verify both + * {PRIV, 1920 x 1440, JPEG, 4032 x 3024} and {PRIV, 2560 x 1440, JPEG, 4032 x 2268}. + * + * @param streams The StreamConfiguration to be tested, with optional session parameters. + * + * @return true in case the stream combination is supported, false otherwise. + * + */ + boolean isStreamCombinationWithSettingsSupported(in StreamConfiguration streams); + + /** + * getSessionCharacteristics + * + * Gets the session characteristics associated with a particular session + * configuration by the CameraDevice. + * + * For Android 15, the characteristics which need to be set are: + * - ANDROID_CONTROL_ZOOM_RATIO_RANGE + * + * A service specific error will be returned on the following conditions + * INTERNAL_ERROR: + * The camera device cannot be opened due to an internal + * error. + * CAMERA_DISCONNECTED: + * An external camera device has been disconnected, and is no longer + * available. This camera device interface is now stale, and a new + * instance must be acquired if the device is reconnected. All + * subsequent calls on this interface must return + * CAMERA_DISCONNECTED. + * ILLEGAL_ARGUMENT: + * If the given session configuration is not supported. + * + * @param sessionConfig: The session configuration for which the + * characteristics are being fetched. + * + * @return The static metadata for this particular session config, or an + * empty metadata structure if a service specific error is returned. + */ + CameraMetadata getSessionCharacteristics(in StreamConfiguration sessionConfig); } diff --git a/camera/device/aidl/android/hardware/camera/device/ICameraDeviceSession.aidl b/camera/device/aidl/android/hardware/camera/device/ICameraDeviceSession.aidl index 885c71a84893f07781e9d343732f25a94e35264f..ffc1a11e5b1a769314506f0a601e626b61e69b05 100644 --- a/camera/device/aidl/android/hardware/camera/device/ICameraDeviceSession.aidl +++ b/camera/device/aidl/android/hardware/camera/device/ICameraDeviceSession.aidl @@ -20,6 +20,7 @@ import android.hardware.camera.device.BufferCache; import android.hardware.camera.device.CameraMetadata; import android.hardware.camera.device.CameraOfflineSessionInfo; import android.hardware.camera.device.CaptureRequest; +import android.hardware.camera.device.ConfigureStreamsRet; import android.hardware.camera.device.HalStream; import android.hardware.camera.device.ICameraOfflineSession; import android.hardware.camera.device.RequestTemplate; @@ -88,6 +89,13 @@ interface ICameraDeviceSession { * with processCaptureResult (and its respective releaseFence has been * signaled) the framework may free or reuse it at any time. * + * This method wil only be called by the framework if + * ANDROID_INFO_SUPPORTED_BUFFER_MANAGEMENT_VERSION is either not advertised or is + * ANDROID_INFO_SUPPORTED_BUFFER_MANAGEMENT_VERSION_AIDL. If the value of + * ANDROID_INFO_SUPPORTED_BUFFER_MANAGEMENT_VERSION is + * ANDROID_INFO_SUPPORTED_BUFFER_MANAGEMENT_VERSION_SESSION_CONFIGURABLE, configureStreamsV2 + * will be called instead. + * * ------------------------------------------------------------------------ * * Preconditions: @@ -386,8 +394,8 @@ interface ICameraDeviceSession { * error. * @return true in case the stream reconfiguration is required, false otherwise. */ - boolean isReconfigurationRequired(in CameraMetadata oldSessionParams, - in CameraMetadata newSessionParams); + boolean isReconfigurationRequired( + in CameraMetadata oldSessionParams, in CameraMetadata newSessionParams); /** * processCaptureRequest: @@ -576,4 +584,29 @@ interface ICameraDeviceSession { */ void repeatingRequestEnd(in int frameNumber, in int[] streamIds); + /** + * + * configureStreamsV2: + * + * Performs the same function as 'configureStreams'. This function returns a + * 'ConfigureStreamsRet' Parcelable. This tells the framework about the desired stream + * parameters such as usage flags, maximum buffers, overridden format etc. It also informs + * camera framework whether the HAL will use the HAL buffer manager APIs 'requestStreamBuffers' + * and 'returnStreamBuffers' to request and return buffers to the framework. + * + * This method is only supported if + * ANDROID_INFO_SUPPORTED_BUFFER_MANAGEMENT_VERSION is + * ANDROID_INFO_SUPPORTED_BUFFER_MANAGEMENT_VERSION_SESSION_CONFIGURABLE. It must not be + * called by the camera framework if it isn't supported. That is, the framework will only + * ever call one of 'configureStreams' or 'configureStreamsV2' depending on the value of + * ANDROID_INFO_SUPPORTED_BUFFER_MANAGEMENT_VERSION. + * + * @param requestedConfiguration The stream configuration requested by the camera framework to + * be configured by the camera HAL. + * @return A ConfigureStreamsRet Parcelable containing a vector of HalStreams and a boolean + * specifying whether the HAL buffer manager must be used for this session + * configuration. + * + */ + ConfigureStreamsRet configureStreamsV2(in StreamConfiguration requestedConfiguration); } diff --git a/camera/device/default/Android.bp b/camera/device/default/Android.bp index b577597d8cad852b9f8dee85477c9edbfdfbe87e..5fbcb5d89a60c1bd47828611413d5662139ffeb7 100644 --- a/camera/device/default/Android.bp +++ b/camera/device/default/Android.bp @@ -25,7 +25,10 @@ package { cc_library_shared { name: "camera.device-external-impl", - defaults: ["hidl_defaults"], + defaults: [ + "android.hardware.graphics.common-ndk_shared", + "hidl_defaults", + ], proprietary: true, srcs: [ "ExternalCameraDevice.cpp", @@ -37,8 +40,7 @@ cc_library_shared { shared_libs: [ "android.hardware.camera.common-V1-ndk", "android.hardware.camera.device-V1-ndk", - "android.hardware.graphics.allocator-V1-ndk", - "android.hardware.graphics.common-V4-ndk", + "android.hardware.graphics.allocator-V2-ndk", "android.hardware.graphics.mapper@2.0", "android.hardware.graphics.mapper@3.0", "android.hardware.graphics.mapper@4.0", @@ -58,6 +60,7 @@ cc_library_shared { "libsync", "libtinyxml2", "libutils", + "libui", "libyuv", ], static_libs: [ diff --git a/camera/device/default/ExternalCameraDeviceSession.cpp b/camera/device/default/ExternalCameraDeviceSession.cpp index 88e4b75646353b5071a1859867221d9c59bf92da..a6ec4c783e7ec90ca22dfc8400fe24b8f8d68d39 100644 --- a/camera/device/default/ExternalCameraDeviceSession.cpp +++ b/camera/device/default/ExternalCameraDeviceSession.cpp @@ -224,10 +224,6 @@ void ExternalCameraDeviceSession::initOutputThread() { } void ExternalCameraDeviceSession::closeOutputThread() { - closeOutputThreadImpl(); -} - -void ExternalCameraDeviceSession::closeOutputThreadImpl() { if (mOutputThread != nullptr) { mOutputThread->flush(); mOutputThread->requestExitAndWait(); @@ -235,6 +231,13 @@ void ExternalCameraDeviceSession::closeOutputThreadImpl() { } } +void ExternalCameraDeviceSession::closeBufferRequestThread() { + if (mBufferRequestThread != nullptr) { + mBufferRequestThread->requestExitAndWait(); + mBufferRequestThread.reset(); + } +} + Status ExternalCameraDeviceSession::initStatus() const { Mutex::Autolock _l(mLock); Status status = Status::OK; @@ -248,7 +251,7 @@ Status ExternalCameraDeviceSession::initStatus() const { ExternalCameraDeviceSession::~ExternalCameraDeviceSession() { if (!isClosed()) { ALOGE("ExternalCameraDeviceSession deleted before close!"); - close(/*callerIsDtor*/ true); + closeImpl(); } } @@ -1410,19 +1413,16 @@ Status ExternalCameraDeviceSession::importBufferLocked(int32_t streamId, uint64_ } ScopedAStatus ExternalCameraDeviceSession::close() { - close(false); + closeImpl(); return fromStatus(Status::OK); } -void ExternalCameraDeviceSession::close(bool callerIsDtor) { +void ExternalCameraDeviceSession::closeImpl() { Mutex::Autolock _il(mInterfaceLock); bool closed = isClosed(); if (!closed) { - if (callerIsDtor) { - closeOutputThreadImpl(); - } else { - closeOutputThread(); - } + closeOutputThread(); + closeBufferRequestThread(); Mutex::Autolock _l(mLock); // free all buffers @@ -2878,13 +2878,23 @@ bool ExternalCameraDeviceSession::OutputThread::threadLoop() { } break; case PixelFormat::YCBCR_420_888: case PixelFormat::YV12: { - IMapper::Rect outRect{0, 0, static_cast(halBuf.width), + android::Rect outRect{0, 0, static_cast(halBuf.width), static_cast(halBuf.height)}; - YCbCrLayout outLayout = sHandleImporter.lockYCbCr( + android_ycbcr result = sHandleImporter.lockYCbCr( *(halBuf.bufPtr), static_cast(halBuf.usage), outRect); - ALOGV("%s: outLayout y %p cb %p cr %p y_str %d c_str %d c_step %d", __FUNCTION__, - outLayout.y, outLayout.cb, outLayout.cr, outLayout.yStride, outLayout.cStride, - outLayout.chromaStep); + ALOGV("%s: outLayout y %p cb %p cr %p y_str %zu c_str %zu c_step %zu", __FUNCTION__, + result.y, result.cb, result.cr, result.ystride, result.cstride, + result.chroma_step); + if (result.ystride > UINT32_MAX || result.cstride > UINT32_MAX || + result.chroma_step > UINT32_MAX) { + return onDeviceError("%s: lockYCbCr failed. Unexpected values!", __FUNCTION__); + } + YCbCrLayout outLayout = {.y = result.y, + .cb = result.cb, + .cr = result.cr, + .yStride = static_cast(result.ystride), + .cStride = static_cast(result.cstride), + .chromaStep = static_cast(result.chroma_step)}; // Convert to output buffer size/format uint32_t outputFourcc = getFourCcFromLayout(outLayout); diff --git a/camera/device/default/ExternalCameraDeviceSession.h b/camera/device/default/ExternalCameraDeviceSession.h index e7eb799da2d6e86b0ceeb92ee86cc2df99a57502..736bfd152866344e313222a38bad033df64ed294 100644 --- a/camera/device/default/ExternalCameraDeviceSession.h +++ b/camera/device/default/ExternalCameraDeviceSession.h @@ -24,6 +24,9 @@ #include #include #include +#include +#include +#include #include #include #include @@ -55,6 +58,7 @@ using ::android::base::unique_fd; using ::android::hardware::camera::common::helper::SimpleThread; using ::android::hardware::camera::external::common::ExternalCameraConfig; using ::android::hardware::camera::external::common::SizeHasher; +using ::android::hardware::graphics::mapper::V2_0::YCbCrLayout; using ::ndk::ScopedAStatus; class ExternalCameraDeviceSession : public BnCameraDeviceSession, public OutputThreadInterface { @@ -240,9 +244,9 @@ class ExternalCameraDeviceSession : public BnCameraDeviceSession, public OutputT // To init/close different version of output thread void initOutputThread(); void closeOutputThread(); - void closeOutputThreadImpl(); + void closeBufferRequestThread(); - void close(bool callerIsDtor); + void closeImpl(); Status initStatus() const; status_t initDefaultRequests(); diff --git a/camera/device/default/ExternalCameraOfflineSession.cpp b/camera/device/default/ExternalCameraOfflineSession.cpp index 4c7f732f8763499c889989b9d05449a758a1537c..53bd44f4faaaea7624ccafb1e8e173342dd9f44a 100644 --- a/camera/device/default/ExternalCameraOfflineSession.cpp +++ b/camera/device/default/ExternalCameraOfflineSession.cpp @@ -486,13 +486,23 @@ bool ExternalCameraOfflineSession::OutputThread::threadLoop() { } break; case PixelFormat::YCBCR_420_888: case PixelFormat::YV12: { - IMapper::Rect outRect{0, 0, static_cast(halBuf.width), + android::Rect outRect{0, 0, static_cast(halBuf.width), static_cast(halBuf.height)}; - YCbCrLayout outLayout = sHandleImporter.lockYCbCr( + android_ycbcr result = sHandleImporter.lockYCbCr( *(halBuf.bufPtr), static_cast(halBuf.usage), outRect); - ALOGV("%s: outLayout y %p cb %p cr %p y_str %d c_str %d c_step %d", __FUNCTION__, - outLayout.y, outLayout.cb, outLayout.cr, outLayout.yStride, outLayout.cStride, - outLayout.chromaStep); + ALOGV("%s: outLayout y %p cb %p cr %p y_str %zu c_str %zu c_step %zu", __FUNCTION__, + result.y, result.cb, result.cr, result.ystride, result.cstride, + result.chroma_step); + if (result.ystride > UINT32_MAX || result.cstride > UINT32_MAX || + result.chroma_step > UINT32_MAX) { + return onDeviceError("%s: lockYCbCr failed. Unexpected values!", __FUNCTION__); + } + YCbCrLayout outLayout = {.y = result.y, + .cb = result.cb, + .cr = result.cr, + .yStride = static_cast(result.ystride), + .cStride = static_cast(result.cstride), + .chromaStep = static_cast(result.chroma_step)}; // Convert to output buffer size/format uint32_t outputFourcc = getFourCcFromLayout(outLayout); @@ -544,4 +554,4 @@ bool ExternalCameraOfflineSession::OutputThread::threadLoop() { } // namespace device } // namespace camera } // namespace hardware -} // namespace android \ No newline at end of file +} // namespace android diff --git a/camera/device/default/ExternalCameraUtils.h b/camera/device/default/ExternalCameraUtils.h index b37933ce7eb74237760f6108a5c23f9878d61a9e..d434905bd822e533560beaf0a84300091cbaf827 100644 --- a/camera/device/default/ExternalCameraUtils.h +++ b/camera/device/default/ExternalCameraUtils.h @@ -25,7 +25,11 @@ #include #include #include +#include +#include +#include #include +#include #include #include @@ -37,6 +41,8 @@ using ::aidl::android::hardware::graphics::common::BufferUsage; using ::aidl::android::hardware::graphics::common::PixelFormat; using ::android::hardware::camera::common::V1_0::helper::CameraMetadata; using ::android::hardware::camera::common::V1_0::helper::HandleImporter; +using ::android::hardware::graphics::mapper::V2_0::IMapper; +using ::android::hardware::graphics::mapper::V2_0::YCbCrLayout; namespace android { namespace hardware { diff --git a/camera/metadata/aidl/Android.bp b/camera/metadata/aidl/Android.bp index 5872a867270e9b2e9df351cb5e7cc3759f7854ff..2b2be55914a9fd60b9ab9409acdcc75eaf67bb51 100644 --- a/camera/metadata/aidl/Android.bp +++ b/camera/metadata/aidl/Android.bp @@ -11,7 +11,7 @@ aidl_interface { name: "android.hardware.camera.metadata", vendor_available: true, srcs: ["android/hardware/camera/metadata/*.aidl"], - frozen: true, + frozen: false, stability: "vintf", backend: { cpp: { diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/CameraMetadataTag.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/CameraMetadataTag.aidl index 71d4e41c446a17225fc971421baf61ae08297ee6..542b2962727432885dd640b87ca54f5e797fbd3b 100644 --- a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/CameraMetadataTag.aidl +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/CameraMetadataTag.aidl @@ -98,6 +98,8 @@ enum CameraMetadataTag { ANDROID_CONTROL_AUTOFRAMING, ANDROID_CONTROL_AUTOFRAMING_AVAILABLE, ANDROID_CONTROL_AUTOFRAMING_STATE, + ANDROID_CONTROL_LOW_LIGHT_BOOST_INFO_LUMINANCE_RANGE, + ANDROID_CONTROL_LOW_LIGHT_BOOST_STATE, ANDROID_DEMOSAIC_MODE = android.hardware.camera.metadata.CameraMetadataSectionStart.ANDROID_DEMOSAIC_START /* 131072 */, ANDROID_EDGE_MODE = android.hardware.camera.metadata.CameraMetadataSectionStart.ANDROID_EDGE_START /* 196608 */, ANDROID_EDGE_STRENGTH, @@ -108,6 +110,11 @@ enum CameraMetadataTag { ANDROID_FLASH_COLOR_TEMPERATURE, ANDROID_FLASH_MAX_ENERGY, ANDROID_FLASH_STATE, + ANDROID_FLASH_STRENGTH_LEVEL, + ANDROID_FLASH_SINGLE_STRENGTH_MAX_LEVEL, + ANDROID_FLASH_SINGLE_STRENGTH_DEFAULT_LEVEL, + ANDROID_FLASH_TORCH_STRENGTH_MAX_LEVEL, + ANDROID_FLASH_TORCH_STRENGTH_DEFAULT_LEVEL, ANDROID_FLASH_INFO_AVAILABLE = android.hardware.camera.metadata.CameraMetadataSectionStart.ANDROID_FLASH_INFO_START /* 327680 */, ANDROID_FLASH_INFO_CHARGE_DURATION, ANDROID_FLASH_INFO_STRENGTH_MAXIMUM_LEVEL, @@ -278,6 +285,8 @@ enum CameraMetadataTag { ANDROID_STATISTICS_OIS_TIMESTAMPS, ANDROID_STATISTICS_OIS_X_SHIFTS, ANDROID_STATISTICS_OIS_Y_SHIFTS, + ANDROID_STATISTICS_LENS_INTRINSIC_TIMESTAMPS, + ANDROID_STATISTICS_LENS_INTRINSIC_SAMPLES, ANDROID_STATISTICS_INFO_AVAILABLE_FACE_DETECT_MODES = android.hardware.camera.metadata.CameraMetadataSectionStart.ANDROID_STATISTICS_INFO_START /* 1179648 */, ANDROID_STATISTICS_INFO_HISTOGRAM_BUCKET_COUNT, ANDROID_STATISTICS_INFO_MAX_FACE_COUNT, @@ -324,6 +333,7 @@ enum CameraMetadataTag { ANDROID_LOGICAL_MULTI_CAMERA_PHYSICAL_IDS = android.hardware.camera.metadata.CameraMetadataSectionStart.ANDROID_LOGICAL_MULTI_CAMERA_START /* 1703936 */, ANDROID_LOGICAL_MULTI_CAMERA_SENSOR_SYNC_TYPE, ANDROID_LOGICAL_MULTI_CAMERA_ACTIVE_PHYSICAL_ID, + ANDROID_LOGICAL_MULTI_CAMERA_ACTIVE_PHYSICAL_SENSOR_CROP_REGION, ANDROID_DISTORTION_CORRECTION_MODE = android.hardware.camera.metadata.CameraMetadataSectionStart.ANDROID_DISTORTION_CORRECTION_START /* 1769472 */, ANDROID_DISTORTION_CORRECTION_AVAILABLE_MODES, ANDROID_HEIC_AVAILABLE_HEIC_STREAM_CONFIGURATIONS = android.hardware.camera.metadata.CameraMetadataSectionStart.ANDROID_HEIC_START /* 1835008 */, diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlAeMode.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlAeMode.aidl index 5e1b87178eda6c7bedb0bfb2dc2bf16d2e874aef..c1423aa87e5e64080a1283de48976a7763eb6737 100644 --- a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlAeMode.aidl +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlAeMode.aidl @@ -44,4 +44,5 @@ enum ControlAeMode { ANDROID_CONTROL_AE_MODE_ON_ALWAYS_FLASH, ANDROID_CONTROL_AE_MODE_ON_AUTO_FLASH_REDEYE, ANDROID_CONTROL_AE_MODE_ON_EXTERNAL_FLASH, + ANDROID_CONTROL_AE_MODE_ON_LOW_LIGHT_BOOST_BRIGHTNESS_PRIORITY, } diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlLowLightBoostState.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlLowLightBoostState.aidl new file mode 100644 index 0000000000000000000000000000000000000000..f8ae0130def36c0bd2880c050dde5597e9efc5a7 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlLowLightBoostState.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2022 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum ControlLowLightBoostState { + ANDROID_CONTROL_LOW_LIGHT_BOOST_STATE_INACTIVE, + ANDROID_CONTROL_LOW_LIGHT_BOOST_STATE_ACTIVE, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/InfoSupportedBufferManagementVersion.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/InfoSupportedBufferManagementVersion.aidl index 7303ff5a71890eb747a0e7d68af1e5e3535963e0..2c31cff5a750a03877665787eaa7b99239006f8a 100644 --- a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/InfoSupportedBufferManagementVersion.aidl +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/InfoSupportedBufferManagementVersion.aidl @@ -39,4 +39,5 @@ package android.hardware.camera.metadata; @Backing(type="int") @VintfStability enum InfoSupportedBufferManagementVersion { ANDROID_INFO_SUPPORTED_BUFFER_MANAGEMENT_VERSION_AIDL_DEVICE, + ANDROID_INFO_SUPPORTED_BUFFER_MANAGEMENT_VERSION_SESSION_CONFIGURABLE, } diff --git a/camera/metadata/aidl/android/hardware/camera/metadata/CameraMetadataTag.aidl b/camera/metadata/aidl/android/hardware/camera/metadata/CameraMetadataTag.aidl index 56aa69077743dfed0e529369068dc0116f33a156..03cfba150a89cc6b58148d56d67bda4403d650fc 100644 --- a/camera/metadata/aidl/android/hardware/camera/metadata/CameraMetadataTag.aidl +++ b/camera/metadata/aidl/android/hardware/camera/metadata/CameraMetadataTag.aidl @@ -489,6 +489,18 @@ enum CameraMetadataTag { *

      Current state of auto-framing.

      */ ANDROID_CONTROL_AUTOFRAMING_STATE, + /** + * android.control.lowLightBoostInfoLuminanceRange [static, float[], public] + * + *

      The operating luminance range of low light boost measured in lux (lx).

      + */ + ANDROID_CONTROL_LOW_LIGHT_BOOST_INFO_LUMINANCE_RANGE, + /** + * android.control.lowLightBoostState [dynamic, enum, public] + * + *

      Current state of the low light boost AE mode.

      + */ + ANDROID_CONTROL_LOW_LIGHT_BOOST_STATE, /** * android.demosaic.mode [controls, enum, system] * @@ -559,6 +571,36 @@ enum CameraMetadataTag { * unit.

      */ ANDROID_FLASH_STATE, + /** + * android.flash.strengthLevel [dynamic, int32, public] + * + *

      Flash strength level to be used when manual flash control is active.

      + */ + ANDROID_FLASH_STRENGTH_LEVEL, + /** + * android.flash.singleStrengthMaxLevel [static, int32, public] + * + *

      Maximum flash brightness level for manual flash control in SINGLE mode.

      + */ + ANDROID_FLASH_SINGLE_STRENGTH_MAX_LEVEL, + /** + * android.flash.singleStrengthDefaultLevel [static, int32, public] + * + *

      Default flash brightness level for manual flash control in SINGLE mode.

      + */ + ANDROID_FLASH_SINGLE_STRENGTH_DEFAULT_LEVEL, + /** + * android.flash.torchStrengthMaxLevel [static, int32, public] + * + *

      Maximum flash brightness level for manual flash control in TORCH mode

      + */ + ANDROID_FLASH_TORCH_STRENGTH_MAX_LEVEL, + /** + * android.flash.torchStrengthDefaultLevel [static, int32, public] + * + *

      Default flash brightness level for manual flash control in TORCH mode

      + */ + ANDROID_FLASH_TORCH_STRENGTH_DEFAULT_LEVEL, /** * android.flash.info.available [static, enum, public] * @@ -1300,8 +1342,8 @@ enum CameraMetadataTag { /** * android.sensor.frameDuration [dynamic, int64, public] * - *

      Duration from start of frame exposure to - * start of next frame exposure.

      + *

      Duration from start of frame readout to + * start of next frame readout.

      */ ANDROID_SENSOR_FRAME_DURATION, /** @@ -1837,6 +1879,18 @@ enum CameraMetadataTag { *

      An array of shifts of OIS samples, in y direction.

      */ ANDROID_STATISTICS_OIS_Y_SHIFTS, + /** + * android.statistics.lensIntrinsicTimestamps [dynamic, int64[], ndk_public] + * + *

      An array of timestamps of lens intrinsics samples, in nanoseconds.

      + */ + ANDROID_STATISTICS_LENS_INTRINSIC_TIMESTAMPS, + /** + * android.statistics.lensIntrinsicSamples [dynamic, float[], ndk_public] + * + *

      An array of intra-frame lens intrinsics.

      + */ + ANDROID_STATISTICS_LENS_INTRINSIC_SAMPLES, /** * android.statistics.info.availableFaceDetectModes [static, byte[], public] * @@ -2210,6 +2264,13 @@ enum CameraMetadataTag { *

      String containing the ID of the underlying active physical camera.

      */ ANDROID_LOGICAL_MULTI_CAMERA_ACTIVE_PHYSICAL_ID, + /** + * android.logicalMultiCamera.activePhysicalSensorCropRegion [dynamic, int32[], public] + * + *

      The current region of the active physical sensor that will be read out for this + * capture.

      + */ + ANDROID_LOGICAL_MULTI_CAMERA_ACTIVE_PHYSICAL_SENSOR_CROP_REGION, /** * android.distortionCorrection.mode [dynamic, enum, public] * @@ -2282,7 +2343,8 @@ enum CameraMetadataTag { * *

      Whether this camera device can support identical set of stream combinations * involving HEIC image format, compared to the - * table of combinations involving JPEG image format required for the device's hardware + * table of combinations + * involving JPEG image format required for the device's hardware * level and capabilities.

      */ ANDROID_HEIC_INFO_SUPPORTED = CameraMetadataSectionStart.ANDROID_HEIC_INFO_START, diff --git a/camera/metadata/aidl/android/hardware/camera/metadata/ControlAeMode.aidl b/camera/metadata/aidl/android/hardware/camera/metadata/ControlAeMode.aidl index e2f5553aee3ffb883a78acd0174930f8bfdb37b9..70174bed277e4d9f3c9d8c7bc7286ef64d2d1a82 100644 --- a/camera/metadata/aidl/android/hardware/camera/metadata/ControlAeMode.aidl +++ b/camera/metadata/aidl/android/hardware/camera/metadata/ControlAeMode.aidl @@ -35,4 +35,5 @@ enum ControlAeMode { ANDROID_CONTROL_AE_MODE_ON_ALWAYS_FLASH, ANDROID_CONTROL_AE_MODE_ON_AUTO_FLASH_REDEYE, ANDROID_CONTROL_AE_MODE_ON_EXTERNAL_FLASH, + ANDROID_CONTROL_AE_MODE_ON_LOW_LIGHT_BOOST_BRIGHTNESS_PRIORITY, } diff --git a/camera/metadata/aidl/android/hardware/camera/metadata/ControlLowLightBoostState.aidl b/camera/metadata/aidl/android/hardware/camera/metadata/ControlLowLightBoostState.aidl new file mode 100644 index 0000000000000000000000000000000000000000..67591c8067a06db8ffeda27bd78db04493746b51 --- /dev/null +++ b/camera/metadata/aidl/android/hardware/camera/metadata/ControlLowLightBoostState.aidl @@ -0,0 +1,34 @@ +/* + * Copyright (C) 2022 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. + */ + +/* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ + +package android.hardware.camera.metadata; + +/** + * android.control.lowLightBoostState enumeration values + * @see ANDROID_CONTROL_LOW_LIGHT_BOOST_STATE + */ +@VintfStability +@Backing(type="int") +enum ControlLowLightBoostState { + ANDROID_CONTROL_LOW_LIGHT_BOOST_STATE_INACTIVE, + ANDROID_CONTROL_LOW_LIGHT_BOOST_STATE_ACTIVE, +} diff --git a/camera/metadata/aidl/android/hardware/camera/metadata/InfoSupportedBufferManagementVersion.aidl b/camera/metadata/aidl/android/hardware/camera/metadata/InfoSupportedBufferManagementVersion.aidl index 9522377c6cda36662784c0ba9df12ca4f28abf9b..964d07903c8edcf2c9c224326ffab199e0228ddd 100644 --- a/camera/metadata/aidl/android/hardware/camera/metadata/InfoSupportedBufferManagementVersion.aidl +++ b/camera/metadata/aidl/android/hardware/camera/metadata/InfoSupportedBufferManagementVersion.aidl @@ -30,4 +30,5 @@ package android.hardware.camera.metadata; @Backing(type="int") enum InfoSupportedBufferManagementVersion { ANDROID_INFO_SUPPORTED_BUFFER_MANAGEMENT_VERSION_AIDL_DEVICE, + ANDROID_INFO_SUPPORTED_BUFFER_MANAGEMENT_VERSION_SESSION_CONFIGURABLE, } diff --git a/camera/provider/2.4/default/ExternalCameraProviderImpl_2_4.cpp b/camera/provider/2.4/default/ExternalCameraProviderImpl_2_4.cpp index 04db7f33ee48613a5dcdaf14ea52366149620ed8..2d919cccff2d7cc2b0aeebaceada891b38479cfe 100644 --- a/camera/provider/2.4/default/ExternalCameraProviderImpl_2_4.cpp +++ b/camera/provider/2.4/default/ExternalCameraProviderImpl_2_4.cpp @@ -95,13 +95,14 @@ ExternalCameraProviderImpl_2_4::~ExternalCameraProviderImpl_2_4() { Return ExternalCameraProviderImpl_2_4::setCallback( const sp& callback) { + if (callback == nullptr) { + return Status::ILLEGAL_ARGUMENT; + } + { Mutex::Autolock _l(mLock); mCallbacks = callback; } - if (mCallbacks == nullptr) { - return Status::OK; - } // Send a callback for all devices to initialize { for (const auto& pair : mCameraStatusMap) { diff --git a/camera/provider/2.4/default/LegacyCameraProviderImpl_2_4.cpp b/camera/provider/2.4/default/LegacyCameraProviderImpl_2_4.cpp index 69318c736882226739a5b8ce11f7ae2a88b76318..07ed689c9881d9d812f2d13af18cf2cf272a771b 100644 --- a/camera/provider/2.4/default/LegacyCameraProviderImpl_2_4.cpp +++ b/camera/provider/2.4/default/LegacyCameraProviderImpl_2_4.cpp @@ -448,11 +448,11 @@ bool LegacyCameraProviderImpl_2_4::setUpVendorTags() { // Methods from ::android::hardware::camera::provider::V2_4::ICameraProvider follow. Return LegacyCameraProviderImpl_2_4::setCallback( const sp& callback) { + if (callback == nullptr) { + return Status::ILLEGAL_ARGUMENT; + } Mutex::Autolock _l(mCbLock); mCallbacks = callback; - if (mCallbacks == nullptr) { - return Status::OK; - } // Add and report all presenting external cameras. for (auto const& statusPair : mCameraStatusMap) { int id = std::stoi(statusPair.first); diff --git a/camera/provider/2.7/default/ExternalCameraProviderImpl_2_7.cpp b/camera/provider/2.7/default/ExternalCameraProviderImpl_2_7.cpp index 62ce074404c2b1f42b0b2b8e731c5072638393ad..eba49a5649415df691d4fea474c706a5b9186dd1 100644 --- a/camera/provider/2.7/default/ExternalCameraProviderImpl_2_7.cpp +++ b/camera/provider/2.7/default/ExternalCameraProviderImpl_2_7.cpp @@ -91,11 +91,11 @@ ExternalCameraProviderImpl_2_7::~ExternalCameraProviderImpl_2_7() { Return ExternalCameraProviderImpl_2_7::setCallback( const sp& callback) { + if (callback == nullptr) { + return Status::ILLEGAL_ARGUMENT; + } Mutex::Autolock _l(mLock); mCallbacks = callback; - if (mCallbacks == nullptr) { - return Status::OK; - } // Send a callback for all devices to initialize { for (const auto& pair : mCameraStatusMap) { diff --git a/camera/provider/aidl/Android.bp b/camera/provider/aidl/Android.bp index 35ec9766a026e258a2237eadf9ec3d8fa996302f..f6b00a1bef7ef545a809dec1613a768b302533c6 100644 --- a/camera/provider/aidl/Android.bp +++ b/camera/provider/aidl/Android.bp @@ -14,10 +14,10 @@ aidl_interface { "android/hardware/camera/provider/*.aidl", ], imports: [ - "android.hardware.camera.device-V2", + "android.hardware.camera.device-V3", "android.hardware.camera.common-V1", ], - frozen: true, + frozen: false, stability: "vintf", backend: { java: { diff --git a/camera/provider/aidl/vts/Android.bp b/camera/provider/aidl/vts/Android.bp index 59f6c660515f9b437cc1188f7718cbf093fe28c8..f9305bbe1062dd6a41ba1a3beb6da774f9fa7a4f 100644 --- a/camera/provider/aidl/vts/Android.bp +++ b/camera/provider/aidl/vts/Android.bp @@ -53,20 +53,22 @@ cc_test { "android.hardware.graphics.mapper@2.0", "android.hardware.graphics.mapper@3.0", "android.hardware.graphics.mapper@4.0", + "camera_platform_flags_c_lib", ], // Statically link to libs not guaranteed to be present on the device. static_libs: [ "android.hardware.camera.common@1.0-helper", "android.hardware.camera.common-V1-ndk", - "android.hardware.camera.device-V2-ndk", + "android.hardware.camera.device-V3-ndk", "android.hardware.camera.metadata-V2-ndk", - "android.hardware.camera.provider-V2-ndk", + "android.hardware.camera.provider-V3-ndk", "android.hidl.allocator@1.0", "libgrallocusage", "libhidlmemory", "libgralloctypes", "libaidlcommonsupport", + "libgtest", ], require_root: true, diff --git a/camera/provider/aidl/vts/VtsAidlHalCameraProvider_TargetTest.cpp b/camera/provider/aidl/vts/VtsAidlHalCameraProvider_TargetTest.cpp index b6b5206e7f85304a2f80ba7ffb601059937d1047..e335853c2883740167de5415910e2d5a37ba30d9 100644 --- a/camera/provider/aidl/vts/VtsAidlHalCameraProvider_TargetTest.cpp +++ b/camera/provider/aidl/vts/VtsAidlHalCameraProvider_TargetTest.cpp @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +#include #include #include @@ -29,6 +30,7 @@ #include #include #include +#include #include using ::aidl::android::hardware::camera::common::CameraDeviceStatus; @@ -50,6 +52,7 @@ const uint32_t kMaxStillWidth = 2048; const uint32_t kMaxStillHeight = 1536; const int64_t kEmptyFlushTimeoutMSec = 200; +namespace flags = com::android::internal::camera::flags; const static std::vector kMandatoryUseCases = { ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES_DEFAULT, @@ -159,6 +162,28 @@ TEST_P(CameraAidlTest, getResourceCost) { } } +// Validate the integrity of manual flash strength control metadata +TEST_P(CameraAidlTest, validateManualFlashStrengthControlKeys) { + if (flags::camera_manual_flash_strength_control()) { + std::vector cameraDeviceNames = getCameraDeviceNames(mProvider); + for (const auto& name : cameraDeviceNames) { + ALOGI("validateManualFlashStrengthControlKeys: Testing camera device %s", name.c_str()); + CameraMetadata meta; + std::shared_ptr cameraDevice; + openEmptyDeviceSession(name, mProvider, &mSession /*out*/, &meta /*out*/, + &cameraDevice /*out*/); + ndk::ScopedAStatus ret = cameraDevice->getCameraCharacteristics(&meta); + ASSERT_TRUE(ret.isOk()); + const camera_metadata_t* staticMeta = + reinterpret_cast(meta.metadata.data()); + verifyManualFlashStrengthControlCharacteristics(staticMeta); + } + } else { + ALOGI("validateManualFlashStrengthControlKeys: Test skipped.\n"); + GTEST_SKIP(); + } +} + TEST_P(CameraAidlTest, systemCameraTest) { std::vector cameraDeviceNames = getCameraDeviceNames(mProvider); std::map> hiddenPhysicalIdToLogicalMap; @@ -475,6 +500,12 @@ TEST_P(CameraAidlTest, constructDefaultRequestSettings) { ASSERT_TRUE(ret.isOk()); ASSERT_NE(device, nullptr); + int32_t interfaceVersion; + ret = device->getInterfaceVersion(&interfaceVersion); + ASSERT_TRUE(ret.isOk()); + bool supportFeatureCombinationQuery = + (interfaceVersion >= CAMERA_DEVICE_API_MINOR_VERSION_3); + std::shared_ptr cb = ndk::SharedRefBase::make(); ret = device->open(cb, &mSession); ALOGI("device::open returns status:%d:%d", ret.getExceptionCode(), @@ -508,6 +539,34 @@ TEST_P(CameraAidlTest, constructDefaultRequestSettings) { } else { ASSERT_EQ(0u, rawMetadata.metadata.size()); } + + if (flags::feature_combination_query()) { + if (supportFeatureCombinationQuery) { + CameraMetadata rawMetadata2; + ndk::ScopedAStatus ret2 = + device->constructDefaultRequestSettings(reqTemplate, &rawMetadata2); + + // TODO: Do not allow OPERATION_NOT_SUPPORTED once HAL + // implementation is in place. + if (static_cast(ret2.getServiceSpecificError()) != + Status::OPERATION_NOT_SUPPORTED) { + ASSERT_EQ(ret.isOk(), ret2.isOk()); + ASSERT_EQ(ret.getStatus(), ret2.getStatus()); + + ASSERT_EQ(rawMetadata.metadata.size(), rawMetadata2.metadata.size()); + if (ret2.isOk()) { + const camera_metadata_t* metadata = + (camera_metadata_t*)rawMetadata2.metadata.data(); + size_t expectedSize = rawMetadata2.metadata.size(); + int result = + validate_camera_metadata_structure(metadata, &expectedSize); + ASSERT_TRUE((result == 0) || + (result == CAMERA_METADATA_VALIDATION_SHIFTED)); + verifyRequestTemplate(metadata, reqTemplate); + } + } + } + } } ret = mSession->close(); mSession = nullptr; @@ -563,8 +622,7 @@ TEST_P(CameraAidlTest, configureStreamsAvailableOutputs) { createStreamConfiguration(streams, StreamConfigurationMode::NORMAL_MODE, &config, jpegBufferSize); - bool expectStreamCombQuery = (isLogicalMultiCamera(staticMeta) == Status::OK); - verifyStreamCombination(device, config, /*expectedStatus*/ true, expectStreamCombQuery); + verifyStreamCombination(device, config, /*expectedStatus*/ true); config.streamConfigCounter = streamConfigCounter++; std::vector halConfigs; @@ -662,11 +720,7 @@ TEST_P(CameraAidlTest, configureConcurrentStreamsAvailableOutputs) { // Test the stream can actually be configured for (auto& cti : cameraTestInfos) { if (cti.session != nullptr) { - camera_metadata_t* staticMeta = - reinterpret_cast(cti.staticMeta.metadata.data()); - bool expectStreamCombQuery = (isLogicalMultiCamera(staticMeta) == Status::OK); - verifyStreamCombination(cti.cameraDevice, cti.config, /*expectedStatus*/ true, - expectStreamCombQuery); + verifyStreamCombination(cti.cameraDevice, cti.config, /*expectedStatus*/ true); } if (cti.session != nullptr) { @@ -727,8 +781,7 @@ TEST_P(CameraAidlTest, configureStreamsInvalidOutputs) { createStreamConfiguration(streams, StreamConfigurationMode::NORMAL_MODE, &config, jpegBufferSize); - verifyStreamCombination(cameraDevice, config, /*expectedStatus*/ false, - /*expectStreamCombQuery*/ false); + verifyStreamCombination(cameraDevice, config, /*expectedStatus*/ false); config.streamConfigCounter = streamConfigCounter++; std::vector halConfigs; @@ -947,8 +1000,7 @@ TEST_P(CameraAidlTest, configureStreamsZSLInputOutputs) { createStreamConfiguration(streams, StreamConfigurationMode::NORMAL_MODE, &config, jpegBufferSize); - verifyStreamCombination(cameraDevice, config, /*expectedStatus*/ true, - /*expectStreamCombQuery*/ false); + verifyStreamCombination(cameraDevice, config, /*expectedStatus*/ true); config.streamConfigCounter = streamConfigCounter++; std::vector halConfigs; @@ -1166,8 +1218,7 @@ TEST_P(CameraAidlTest, configureStreamsPreviewStillOutputs) { createStreamConfiguration(streams, StreamConfigurationMode::NORMAL_MODE, &config, jpegBufferSize); config.streamConfigCounter = streamConfigCounter++; - verifyStreamCombination(cameraDevice, config, /*expectedStatus*/ true, - /*expectStreamCombQuery*/ false); + verifyStreamCombination(cameraDevice, config, /*expectedStatus*/ true); std::vector halConfigs; ndk::ScopedAStatus ret = mSession->configureStreams(config, &halConfigs); @@ -1231,8 +1282,7 @@ TEST_P(CameraAidlTest, configureStreamsConstrainedOutputs) { createStreamConfiguration(streams, StreamConfigurationMode::CONSTRAINED_HIGH_SPEED_MODE, &config); - verifyStreamCombination(cameraDevice, config, /*expectedStatus*/ true, - /*expectStreamCombQuery*/ false); + verifyStreamCombination(cameraDevice, config, /*expectedStatus*/ true); config.streamConfigCounter = streamConfigCounter++; std::vector halConfigs; @@ -1404,8 +1454,7 @@ TEST_P(CameraAidlTest, configureStreamsVideoStillOutputs) { createStreamConfiguration(streams, StreamConfigurationMode::NORMAL_MODE, &config, jpegBufferSize); - verifyStreamCombination(cameraDevice, config, /*expectedStatus*/ true, - /*expectStreamCombQuery*/ false); + verifyStreamCombination(cameraDevice, config, /*expectedStatus*/ true); config.streamConfigCounter = streamConfigCounter++; std::vector halConfigs; diff --git a/camera/provider/aidl/vts/camera_aidl_test.cpp b/camera/provider/aidl/vts/camera_aidl_test.cpp index bb21620e6dc245219687b3e04ebb5d0dd6165f96..c18829197c475afd3e4d01f1440cf6468627116b 100644 --- a/camera/provider/aidl/vts/camera_aidl_test.cpp +++ b/camera/provider/aidl/vts/camera_aidl_test.cpp @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #include @@ -39,6 +40,7 @@ #include #include #include +#include "utils/Errors.h" using ::aidl::android::hardware::camera::common::CameraDeviceStatus; using ::aidl::android::hardware::camera::common::TorchModeStatus; @@ -56,6 +58,8 @@ using ::ndk::ScopedAStatus; using ::ndk::SpAIBinder; namespace { +namespace flags = com::android::internal::camera::flags; + bool parseProviderName(const std::string& serviceDescriptor, std::string* type /*out*/, uint32_t* id /*out*/) { if (!type || !id) { @@ -101,6 +105,8 @@ bool parseProviderName(const std::string& serviceDescriptor, std::string* type / return true; } +namespace flags = com::android::internal::camera::flags; + const std::vector kMandatoryUseCases = { ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES_DEFAULT, ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES_PREVIEW, @@ -468,6 +474,38 @@ void CameraAidlTest::verifyLogicalCameraResult(const camera_metadata_t* staticMe } else { ADD_FAILURE() << "Get LOGICAL_MULTI_CAMERA_ACTIVE_PHYSICAL_ID failed!"; } + + if (flags::concert_mode()) { + auto ret = find_camera_metadata_ro_entry( + metadata, ANDROID_LOGICAL_MULTI_CAMERA_ACTIVE_PHYSICAL_SENSOR_CROP_REGION, &entry); + if ((ret == android::OK) && (entry.count > 0)) { + ASSERT_TRUE(entry.count == 4); + ASSERT_GE(entry.data.i32[0], 0); // Top must be non-negative + ASSERT_GE(entry.data.i32[1], 0); // Left must be non-negative + ASSERT_GT(entry.data.i32[2], 0); // Width must be positive + ASSERT_GT(entry.data.i32[3], 0); // Height must be positive + } + } +} + +void CameraAidlTest::verifyLensIntrinsicsResult(const std::vector& resultMetadata) { + if (flags::concert_mode()) { + camera_metadata_t* metadata = (camera_metadata_t*)resultMetadata.data(); + + camera_metadata_ro_entry timestampsEntry, intrinsicsEntry; + auto tsRet = find_camera_metadata_ro_entry( + metadata, ANDROID_STATISTICS_LENS_INTRINSIC_TIMESTAMPS, ×tampsEntry); + auto inRet = find_camera_metadata_ro_entry( + metadata, ANDROID_STATISTICS_LENS_INTRINSIC_SAMPLES, &intrinsicsEntry); + ASSERT_EQ(tsRet, inRet); + ASSERT_TRUE((intrinsicsEntry.count % 5) == 0); + ASSERT_EQ(timestampsEntry.count, intrinsicsEntry.count / 5); + if (timestampsEntry.count > 0) { + for (size_t i = 0; i < timestampsEntry.count - 1; i++) { + ASSERT_GE(timestampsEntry.data.i64[i + 1], timestampsEntry.data.i64[i]); + } + } + } } Status CameraAidlTest::getPhysicalCameraIds(const camera_metadata_t* staticMeta, @@ -1142,6 +1180,58 @@ void CameraAidlTest::verifyMonochromeCharacteristics(const CameraMetadata& chars } } +void CameraAidlTest::verifyManualFlashStrengthControlCharacteristics( + const camera_metadata_t* staticMeta) { + camera_metadata_ro_entry singleMaxEntry; + camera_metadata_ro_entry singleDefEntry; + camera_metadata_ro_entry torchMaxEntry; + camera_metadata_ro_entry torchDefEntry; + bool torch_supported = false; + int32_t singleMaxLevel = 0; + int32_t singleDefLevel = 0; + int32_t torchMaxLevel = 0; + int32_t torchDefLevel = 0; + + // determine whether the device supports torch or not + torch_supported = isTorchSupported(staticMeta); + + int singleMaxRetCode = find_camera_metadata_ro_entry(staticMeta, + ANDROID_FLASH_SINGLE_STRENGTH_MAX_LEVEL, &singleMaxEntry); + int singleDefRetCode = find_camera_metadata_ro_entry(staticMeta, + ANDROID_FLASH_SINGLE_STRENGTH_DEFAULT_LEVEL, &singleDefEntry); + int torchMaxRetCode = find_camera_metadata_ro_entry(staticMeta, + ANDROID_FLASH_TORCH_STRENGTH_MAX_LEVEL, &torchMaxEntry); + int torchDefRetCode = find_camera_metadata_ro_entry(staticMeta, + ANDROID_FLASH_TORCH_STRENGTH_DEFAULT_LEVEL, &torchDefEntry); + if (torch_supported) { + if(singleMaxRetCode == 0 && singleDefRetCode == 0 && torchMaxRetCode == 0 && + torchDefRetCode == 0) { + singleMaxLevel = *singleMaxEntry.data.i32; + singleDefLevel = *singleDefEntry.data.i32; + torchMaxLevel = *torchMaxEntry.data.i32; + torchDefLevel = *torchDefEntry.data.i32; + ASSERT_TRUE((singleMaxEntry.count == singleDefEntry.count == torchMaxEntry.count + == torchDefEntry.count == 1)); + } else { + ASSERT_TRUE((singleMaxEntry.count == singleDefEntry.count == torchMaxEntry.count + == torchDefEntry.count == 0)); + } + // if the device supports this feature default levels should be greater than 0 + if (singleMaxLevel > 1) { + ASSERT_GT(torchMaxLevel, 1); + ASSERT_GT(torchDefLevel, 0); + ASSERT_GT(singleDefLevel, 0); + ASSERT_TRUE(torchDefLevel <= torchMaxLevel); // default levels should be <= max levels + ASSERT_TRUE(singleDefLevel <= singleMaxLevel); + } + } else { + ASSERT_TRUE(singleMaxRetCode != 0); + ASSERT_TRUE(singleDefRetCode != 0); + ASSERT_TRUE(torchMaxRetCode != 0); + ASSERT_TRUE(torchDefRetCode != 0); + } +} + void CameraAidlTest::verifyRecommendedConfigs(const CameraMetadata& chars) { size_t CONFIG_ENTRY_SIZE = 5; size_t CONFIG_ENTRY_TYPE_OFFSET = 3; @@ -1288,13 +1378,17 @@ void CameraAidlTest::verifyLogicalOrUltraHighResCameraMetadata( bool hasHalBufferManager = (0 == retcode && 1 == entry.count && entry.data.i32[0] == ANDROID_INFO_SUPPORTED_BUFFER_MANAGEMENT_VERSION_HIDL_DEVICE_3_5); + bool sessionHalBufferManager = + (0 == retcode && 1 == entry.count && + entry.data.i32[0] == + ANDROID_INFO_SUPPORTED_BUFFER_MANAGEMENT_VERSION_SESSION_CONFIGURABLE); retcode = find_camera_metadata_ro_entry( metadata, ANDROID_SCALER_MULTI_RESOLUTION_STREAM_SUPPORTED, &entry); bool multiResolutionStreamSupported = (0 == retcode && 1 == entry.count && entry.data.u8[0] == ANDROID_SCALER_MULTI_RESOLUTION_STREAM_SUPPORTED_TRUE); if (multiResolutionStreamSupported) { - ASSERT_TRUE(hasHalBufferManager); + ASSERT_TRUE(hasHalBufferManager || sessionHalBufferManager); } std::string version, cameraId; @@ -1797,17 +1891,32 @@ void CameraAidlTest::createStreamConfiguration(std::vector& streams, } void CameraAidlTest::verifyStreamCombination(const std::shared_ptr& device, - const StreamConfiguration& config, bool expectedStatus, - bool expectStreamCombQuery) { + const StreamConfiguration& config, + bool expectedStatus) { if (device != nullptr) { bool streamCombinationSupported; ScopedAStatus ret = device->isStreamCombinationSupported(config, &streamCombinationSupported); - // TODO: Check is unsupported operation is correct. - ASSERT_TRUE(ret.isOk() || - (expectStreamCombQuery && ret.getExceptionCode() == EX_UNSUPPORTED_OPERATION)); - if (ret.isOk()) { - ASSERT_EQ(expectedStatus, streamCombinationSupported); + ASSERT_TRUE(ret.isOk()); + ASSERT_EQ(expectedStatus, streamCombinationSupported); + + if (flags::feature_combination_query()) { + 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); + // TODO: Do not allow OPERATION_NOT_SUPPORTED once HAL + // implementation is in place. + ASSERT_TRUE(ret.isOk() || static_cast(ret.getServiceSpecificError()) == + Status::OPERATION_NOT_SUPPORTED); + if (ret.isOk()) { + ASSERT_EQ(expectedStatus, streamCombinationSupported); + } + } } } } @@ -2378,6 +2487,28 @@ void CameraAidlTest::configureStreamUseCaseInternal(const AvailableStream &thres } +ndk::ScopedAStatus CameraAidlTest::configureStreams(std::shared_ptr& session, + const StreamConfiguration& config, + bool sessionHalBufferManager, + bool* useHalBufManager, + std::vector* halStreams) { + auto ret = ndk::ScopedAStatus::ok(); + ConfigureStreamsRet aidl_return; + if (sessionHalBufferManager) { + ret = session->configureStreamsV2(config, &aidl_return); + } else { + ret = session->configureStreams(config, halStreams); + } + if (!ret.isOk()) { + return ret; + } + if (sessionHalBufferManager) { + *useHalBufManager = aidl_return.enableHalBufferManager; + *halStreams = std::move(aidl_return.halStreams); + } + return ndk::ScopedAStatus::ok(); +} + void CameraAidlTest::configureSingleStream( const std::string& name, const std::shared_ptr& provider, const AvailableStream* previewThreshold, uint64_t bufferUsage, RequestTemplate reqTemplate, @@ -2432,11 +2563,15 @@ void CameraAidlTest::configureSingleStream( ASSERT_NE(*session, nullptr); *useHalBufManager = false; + bool sessionHalBufferManager = false; status = find_camera_metadata_ro_entry( staticMeta, ANDROID_INFO_SUPPORTED_BUFFER_MANAGEMENT_VERSION, &entry); if ((0 == status) && (entry.count == 1)) { *useHalBufManager = (entry.data.u8[0] == ANDROID_INFO_SUPPORTED_BUFFER_MANAGEMENT_VERSION_HIDL_DEVICE_3_5); + sessionHalBufferManager = + (entry.data.u8[0] == + ANDROID_INFO_SUPPORTED_BUFFER_MANAGEMENT_VERSION_SESSION_CONFIGURABLE); } outputPreviewStreams.clear(); @@ -2495,7 +2630,8 @@ void CameraAidlTest::configureSingleStream( ASSERT_EQ(supported, true); std::vector halConfigs; - ret = (*session)->configureStreams(config, &halConfigs); + ret = configureStreams(*session, config, sessionHalBufferManager, useHalBufManager, + &halConfigs); ALOGI("configureStreams returns status: %d:%d", ret.getExceptionCode(), ret.getServiceSpecificError()); ASSERT_TRUE(ret.isOk()); @@ -2791,11 +2927,15 @@ void CameraAidlTest::configurePreviewStreams( ASSERT_NE(*session, nullptr); *useHalBufManager = false; + bool sessionHalBufferManager = false; status = find_camera_metadata_ro_entry( staticMeta, ANDROID_INFO_SUPPORTED_BUFFER_MANAGEMENT_VERSION, &entry); if ((0 == status) && (entry.count == 1)) { *useHalBufManager = (entry.data.u8[0] == ANDROID_INFO_SUPPORTED_BUFFER_MANAGEMENT_VERSION_HIDL_DEVICE_3_5); + sessionHalBufferManager = + (entry.data.u8[0] == + ANDROID_INFO_SUPPORTED_BUFFER_MANAGEMENT_VERSION_SESSION_CONFIGURABLE); } outputPreviewStreams.clear(); @@ -2850,7 +2990,9 @@ void CameraAidlTest::configurePreviewStreams( config.streamConfigCounter = streamConfigCounter; std::vector halConfigs; - ret = (*session)->configureStreams(config, &halConfigs); + ret = configureStreams(*session, config, sessionHalBufferManager, useHalBufManager, + &halConfigs); + ASSERT_TRUE(ret.isOk()); ASSERT_EQ(physicalIds.size(), halConfigs.size()); *halStreams = halConfigs; @@ -2930,11 +3072,15 @@ void CameraAidlTest::configureStreams(const std::string& name, ASSERT_NE(*session, nullptr); *useHalBufManager = false; + bool sessionHalBufferManager = false; status = find_camera_metadata_ro_entry( staticMeta, ANDROID_INFO_SUPPORTED_BUFFER_MANAGEMENT_VERSION, &entry); if ((0 == status) && (entry.count == 1)) { *useHalBufManager = (entry.data.u8[0] == ANDROID_INFO_SUPPORTED_BUFFER_MANAGEMENT_VERSION_HIDL_DEVICE_3_5); + sessionHalBufferManager = + (entry.data.u8[0] == + ANDROID_INFO_SUPPORTED_BUFFER_MANAGEMENT_VERSION_SESSION_CONFIGURABLE); } outputStreams.clear(); @@ -2988,7 +3134,8 @@ void CameraAidlTest::configureStreams(const std::string& name, ASSERT_TRUE(ret.isOk()); ASSERT_EQ(supported, true); - ret = (*session)->configureStreams(config, halStreams); + ret = configureStreams(*session, config, sessionHalBufferManager, useHalBufManager, halStreams); + ASSERT_TRUE(ret.isOk()); if (*useHalBufManager) { @@ -3387,11 +3534,15 @@ void CameraAidlTest::configureOfflineStillStream( } *useHalBufManager = false; + bool sessionHalBufferManager = false; status = find_camera_metadata_ro_entry( staticMeta, ANDROID_INFO_SUPPORTED_BUFFER_MANAGEMENT_VERSION, &entry); if ((0 == status) && (entry.count == 1)) { *useHalBufManager = (entry.data.u8[0] == ANDROID_INFO_SUPPORTED_BUFFER_MANAGEMENT_VERSION_HIDL_DEVICE_3_5); + sessionHalBufferManager = + (entry.data.u8[0] == + ANDROID_INFO_SUPPORTED_BUFFER_MANAGEMENT_VERSION_SESSION_CONFIGURABLE); } auto st = getJpegBufferSize(staticMeta, jpegBufferSize); @@ -3444,7 +3595,8 @@ void CameraAidlTest::configureOfflineStillStream( StreamConfiguration config = {streams, StreamConfigurationMode::NORMAL_MODE, CameraMetadata()}; - (*session)->configureStreams(config, halStreams); + ret = configureStreams(*session, config, sessionHalBufferManager, useHalBufManager, halStreams); + ASSERT_TRUE(ret.isOk()); if (*useHalBufManager) { diff --git a/camera/provider/aidl/vts/camera_aidl_test.h b/camera/provider/aidl/vts/camera_aidl_test.h index 36687c258e68360e69151ffd9b0abfc7a0d90ea2..cbf74a5fc1d53c75ca27fed95b09e2253af2c305 100644 --- a/camera/provider/aidl/vts/camera_aidl_test.h +++ b/camera/provider/aidl/vts/camera_aidl_test.h @@ -64,6 +64,7 @@ using ::aidl::android::hardware::camera::device::BufferRequest; using ::aidl::android::hardware::camera::device::BufferRequestStatus; using ::aidl::android::hardware::camera::device::CameraMetadata; using ::aidl::android::hardware::camera::device::CaptureResult; +using ::aidl::android::hardware::camera::device::ConfigureStreamsRet; using ::aidl::android::hardware::camera::device::ErrorCode; using ::aidl::android::hardware::camera::device::HalStream; using ::aidl::android::hardware::camera::device::ICameraDevice; @@ -201,6 +202,11 @@ class CameraAidlTest : public ::testing::TestWithParam { int32_t* partialResultCount /*out*/, std::shared_ptr* outCb /*out*/, int32_t* jpegBufferSize /*out*/, bool* useHalBufManager /*out*/); + ndk::ScopedAStatus configureStreams(std::shared_ptr& session, + const StreamConfiguration& config, + bool sessionHalBufferManager, bool* useHalBufManager, + std::vector* halStreams); + void configureStreams( const std::string& name, const std::shared_ptr& provider, PixelFormat format, std::shared_ptr* session /*out*/, @@ -262,6 +268,9 @@ class CameraAidlTest : public ::testing::TestWithParam { static void verifyMonochromeCharacteristics(const CameraMetadata& chars); + static void verifyManualFlashStrengthControlCharacteristics( + const camera_metadata_t* staticMeta); + static void verifyMonochromeCameraResult( const ::android::hardware::camera::common::V1_0::helper::CameraMetadata& metadata); @@ -270,12 +279,13 @@ class CameraAidlTest : public ::testing::TestWithParam { static void verifySettingsOverrideCharacteristics(const camera_metadata_t* metadata); static void verifyStreamCombination(const std::shared_ptr& device, - const StreamConfiguration& config, bool expectedStatus, - bool expectStreamCombQuery); + const StreamConfiguration& config, bool expectedStatus); static void verifyLogicalCameraResult(const camera_metadata_t* staticMetadata, const std::vector& resultMetadata); + static void verifyLensIntrinsicsResult(const std::vector& resultMetadata); + static void verifyBuffersReturned(const std::shared_ptr& session, int32_t streamId, const std::shared_ptr& cb, uint32_t streamConfigCounter = 0); @@ -615,6 +625,7 @@ namespace { // device@.//id const char* kDeviceNameRE = "device@([0-9]+\\.[0-9]+)/\\s+/(.+)"; const std::string CAMERA_DEVICE_API_VERSION_1 = "1.1"; +const int32_t CAMERA_DEVICE_API_MINOR_VERSION_3 = 3; const int32_t kMaxVideoWidth = 4096; const int32_t kMaxVideoHeight = 2160; diff --git a/camera/provider/aidl/vts/device_cb.cpp b/camera/provider/aidl/vts/device_cb.cpp index 7e0969aeae54d19305dfbacbf8907a4e1880be7f..2c11d3f9be7a0a25dbc7c0f41f6ad447bd6cfd80 100644 --- a/camera/provider/aidl/vts/device_cb.cpp +++ b/camera/provider/aidl/vts/device_cb.cpp @@ -388,15 +388,16 @@ bool DeviceCb::processCaptureResultLocked( // Verify logical camera result metadata bool isLogicalCamera = Status::OK == CameraAidlTest::isLogicalMultiCamera(staticMetadataBuffer); + camera_metadata_t* collectedMetadata = + const_cast(request->collectedResult.getAndLock()); + uint8_t* rawMetadata = reinterpret_cast(collectedMetadata); + std::vector metadata = + std::vector(rawMetadata, rawMetadata + get_camera_metadata_size(collectedMetadata)); if (isLogicalCamera) { - camera_metadata_t* collectedMetadata = - const_cast(request->collectedResult.getAndLock()); - uint8_t* rawMetadata = reinterpret_cast(collectedMetadata); - std::vector metadata = std::vector( - rawMetadata, rawMetadata + get_camera_metadata_size(collectedMetadata)); CameraAidlTest::verifyLogicalCameraResult(staticMetadataBuffer, metadata); - request->collectedResult.unlock(collectedMetadata); } + CameraAidlTest::verifyLensIntrinsicsResult(metadata); + request->collectedResult.unlock(collectedMetadata); } uint32_t numBuffersReturned = results.outputBuffers.size(); diff --git a/camera/provider/default/ExternalCameraProvider.cpp b/camera/provider/default/ExternalCameraProvider.cpp index 4d2c847255c39a78178c79bccbd638949d091f3f..54875abb2014787920fddf2044acef8bf032d529 100644 --- a/camera/provider/default/ExternalCameraProvider.cpp +++ b/camera/provider/default/ExternalCameraProvider.cpp @@ -75,15 +75,15 @@ ExternalCameraProvider::~ExternalCameraProvider() { ndk::ScopedAStatus ExternalCameraProvider::setCallback( const std::shared_ptr& in_callback) { + if (in_callback == nullptr) { + return fromStatus(Status::ILLEGAL_ARGUMENT); + } + { Mutex::Autolock _l(mLock); mCallback = in_callback; } - if (mCallback == nullptr) { - return fromStatus(Status::OK); - } - for (const auto& pair : mCameraStatusMap) { mCallback->cameraDeviceStatusChange(pair.first, pair.second); } diff --git a/compatibility_matrices/compatibility_matrix.202404.xml b/compatibility_matrices/compatibility_matrix.202404.xml index b34011e8b8131c2e664f6909f929710792900410..f6f70e0494273859274e76e9af019967a3ab49b1 100644 --- a/compatibility_matrices/compatibility_matrix.202404.xml +++ b/compatibility_matrices/compatibility_matrix.202404.xml @@ -66,6 +66,14 @@ [a-z]+/[0-9]+ + + android.hardware.macsec + 1 + + IMacsecPskPlugin + default + + android.hardware.automotive.occupant_awareness 1 @@ -76,7 +84,7 @@ android.hardware.automotive.vehicle - 1-2 + 1-3 IVehicle default @@ -84,6 +92,7 @@ android.hardware.automotive.remoteaccess + 1-2 IRemoteAccess default @@ -98,15 +107,16 @@ android.hardware.biometrics.face - 3 + 3-4 IFace default + virtual android.hardware.biometrics.fingerprint - 3 + 3-4 IFingerprint default @@ -161,6 +171,7 @@ android.hardware.broadcastradio + 1-2 IBroadcastRadio .* @@ -168,7 +179,7 @@ android.hardware.camera.provider - 1-2 + 1-3 ICameraProvider [^/]+/[0-9]+ @@ -191,7 +202,7 @@ android.hardware.contexthub - 2 + 3 IContextHub default @@ -222,7 +233,7 @@ android.hardware.gnss - 2-3 + 2-4 IGnss default @@ -238,7 +249,7 @@ android.hardware.graphics.composer3 - 2 + 3 IComposer default @@ -377,7 +388,7 @@ android.hardware.power - 4 + 5 IPower default @@ -393,7 +404,7 @@ android.hardware.radio.config - 2 + 3 IRadioConfig default @@ -401,7 +412,7 @@ android.hardware.radio.data - 2 + 3 IRadioData slot1 @@ -411,7 +422,7 @@ android.hardware.radio.messaging - 2 + 3 IRadioMessaging slot1 @@ -421,7 +432,7 @@ android.hardware.radio.modem - 2 + 3 IRadioModem slot1 @@ -431,7 +442,7 @@ android.hardware.radio.network - 2 + 3 IRadioNetwork slot1 @@ -441,7 +452,7 @@ android.hardware.radio.sim - 2 + 3 IRadioSim slot1 @@ -461,7 +472,7 @@ android.hardware.radio.voice - 2 + 3 IRadioVoice slot1 @@ -471,7 +482,7 @@ android.hardware.radio.ims - 1 + 2 IRadioIms slot1 @@ -481,7 +492,7 @@ android.hardware.radio.ims.media - 1 + 2 IImsMedia default @@ -555,7 +566,7 @@ android.hardware.thermal - 1 + 2 IThermal default @@ -611,7 +622,7 @@ android.hardware.tv.input - 1 + 1-2 ITvInput default @@ -619,7 +630,7 @@ android.hardware.usb - 1-2 + 1-3 IUsb default @@ -658,7 +669,7 @@ android.hardware.wifi - 1 + 1-2 IWifi default @@ -674,7 +685,7 @@ android.hardware.wifi.hostapd - 1 + 1-2 IHostapd default @@ -682,7 +693,7 @@ android.hardware.wifi.supplicant - 2 + 2-3 ISupplicant default diff --git a/compatibility_matrices/compatibility_matrix.8.xml b/compatibility_matrices/compatibility_matrix.8.xml index d8115e158d0458821c2f5eae18dd5d370068e8e6..7054bfa240198b49038415d53e9d6d2ac751ff69 100644 --- a/compatibility_matrices/compatibility_matrix.8.xml +++ b/compatibility_matrices/compatibility_matrix.8.xml @@ -116,7 +116,7 @@ android.hardware.biometrics.face - 3 + 3-4 IFace default diff --git a/compatibility_matrices/exclude/fcm_exclude.cpp b/compatibility_matrices/exclude/fcm_exclude.cpp index 2cb4ffac22219cceb1e2aab4fc6d56caddb04502..46f0e03098ea86bb2a2eb69f8da87e008f7feb23 100644 --- a/compatibility_matrices/exclude/fcm_exclude.cpp +++ b/compatibility_matrices/exclude/fcm_exclude.cpp @@ -128,6 +128,7 @@ bool ShouldCheckMissingAidlHalsInFcm(const std::string& packageAndVersion) { "android.hardware.media.bufferpool2@", "android.hardware.radio@", "android.hardware.uwb.fira_android@", + "android.hardware.wifi.common@", // Test packages are exempted. "android.hardware.tests.", diff --git a/contexthub/aidl/Android.bp b/contexthub/aidl/Android.bp index a0315d0b30d39346ffb29491cfd0f3a55185da1f..cf10529ba1fa4abeb1db9dc5415b636ee19e1fde 100644 --- a/contexthub/aidl/Android.bp +++ b/contexthub/aidl/Android.bp @@ -49,6 +49,6 @@ aidl_interface { }, ], - frozen: true, + frozen: false, } diff --git a/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/ContextHubInfo.aidl b/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/ContextHubInfo.aidl index e5735566e7648518bcfbcbb3e065bf8e6036e04e..c99169eb6f24f5da6ed6004b5fb777990601e81d 100644 --- a/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/ContextHubInfo.aidl +++ b/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/ContextHubInfo.aidl @@ -45,4 +45,5 @@ parcelable ContextHubInfo { byte chreApiMinorVersion; char chrePatchVersion; String[] supportedPermissions; + boolean supportsReliableMessages; } diff --git a/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/ContextHubMessage.aidl b/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/ContextHubMessage.aidl index e38c251928587a17eae3e6a0b341324c6a103591..a6951a8f16712e55470421672f2995afe22d4eef 100644 --- a/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/ContextHubMessage.aidl +++ b/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/ContextHubMessage.aidl @@ -39,4 +39,6 @@ parcelable ContextHubMessage { int messageType; byte[] messageBody; String[] permissions; + boolean isReliable; + int messageSequenceNumber; } diff --git a/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/ErrorCode.aidl b/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/ErrorCode.aidl new file mode 100644 index 0000000000000000000000000000000000000000..892465835782fd74ce1462888ba643a455c3ec8e --- /dev/null +++ b/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/ErrorCode.aidl @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/////////////////////////////////////////////////////////////////////////////// +// THIS 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 -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.contexthub; +@Backing(type="byte") @VintfStability +enum ErrorCode { + OK = 0, + TRANSIENT_ERROR, + PERMANENT_ERROR, + PERMISSION_DENIED, + DESTINATION_NOT_FOUND, +} diff --git a/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/IContextHub.aidl b/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/IContextHub.aidl index de8d752695ac090b1301fa9a64c379bd1613ab57..7341e0ec75b3198729919531e3c2d439cdf8dfac 100644 --- a/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/IContextHub.aidl +++ b/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/IContextHub.aidl @@ -48,5 +48,6 @@ interface IContextHub { long[] getPreloadedNanoappIds(in int contextHubId); void onNanSessionStateChanged(in android.hardware.contexthub.NanSessionStateUpdate update); void setTestMode(in boolean enable); + void sendMessageDeliveryStatusToHub(in int contextHubId, in android.hardware.contexthub.MessageDeliveryStatus messageDeliveryStatus); const int EX_CONTEXT_HUB_UNSPECIFIED = (-1) /* -1 */; } diff --git a/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/IContextHubCallback.aidl b/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/IContextHubCallback.aidl index 6163cfc662a4883a2563fc5d723855a9eea483d6..70f69c608bf33f7a016f8825a640f998c1a01152 100644 --- a/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/IContextHubCallback.aidl +++ b/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/IContextHubCallback.aidl @@ -39,5 +39,8 @@ interface IContextHubCallback { void handleContextHubAsyncEvent(in android.hardware.contexthub.AsyncEventType evt); void handleTransactionResult(in int transactionId, in boolean success); void handleNanSessionRequest(in android.hardware.contexthub.NanSessionRequest request); + void handleMessageDeliveryStatus(in char hostEndpointId, in android.hardware.contexthub.MessageDeliveryStatus messageDeliveryStatus); + byte[16] getUuid(); + String getName(); const int CONTEXTHUB_NAN_TRANSACTION_TIMEOUT_MS = 10000; } diff --git a/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/MessageDeliveryStatus.aidl b/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/MessageDeliveryStatus.aidl new file mode 100644 index 0000000000000000000000000000000000000000..40dac13f1ca48314ca5b0280313020d08535fa95 --- /dev/null +++ b/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/MessageDeliveryStatus.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/////////////////////////////////////////////////////////////////////////////// +// THIS 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 -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.contexthub; +@VintfStability +parcelable MessageDeliveryStatus { + int messageSequenceNumber; + android.hardware.contexthub.ErrorCode errorCode; +} diff --git a/contexthub/aidl/android/hardware/contexthub/ContextHubInfo.aidl b/contexthub/aidl/android/hardware/contexthub/ContextHubInfo.aidl index c0fa702f0bcc868e84cd8ec02f66245946605861..42dba1053d2401c1c1ca19044d3f82dda800d599 100644 --- a/contexthub/aidl/android/hardware/contexthub/ContextHubInfo.aidl +++ b/contexthub/aidl/android/hardware/contexthub/ContextHubInfo.aidl @@ -33,7 +33,9 @@ parcelable ContextHubInfo { /** Peak MIPs this platform can deliver */ float peakMips; - /** The maximum length in bytes of the message that can be sent to the Context Hub. */ + /** + * The maximum length in bytes of a message sent to the Context Hub. + */ int maxSupportedMessageLengthBytes; /** @@ -61,4 +63,11 @@ parcelable ContextHubInfo { * are granted in order to communicate with them. */ String[] supportedPermissions; + + /** + * True if the Context Hub supports reliable messages. False otherwise, in which case + * ContextHubMessage.isReliable must always be set to false. See + * ContextHubMessage.isReliable for more information. + */ + boolean supportsReliableMessages; } diff --git a/contexthub/aidl/android/hardware/contexthub/ContextHubMessage.aidl b/contexthub/aidl/android/hardware/contexthub/ContextHubMessage.aidl index 95d478e6c210a48e722d649aff16ff50906bb709..3cd20caa0d0fb16e03778ee3da6b2941b7aefcef 100644 --- a/contexthub/aidl/android/hardware/contexthub/ContextHubMessage.aidl +++ b/contexthub/aidl/android/hardware/contexthub/ContextHubMessage.aidl @@ -50,4 +50,35 @@ parcelable ContextHubMessage { * of the permissions that the sending nanoapp is using. */ String[] permissions; + + /** + * Whether the message is reliable. + * + * For reliable messages, the receiver is expected to acknowledge the reception of + * the message by sending a message delivery status back to the sender. Acknowledgment of + * the message must be returned within 1 second. + * + * For reliable messages sent by the host, the Context Hub invokes + * IContextHubCallback#handleMessageDeliveryStatus to report the status. + * + * For reliable messages sent by the Context Hub, the host calls + * IContextHub#sendMessageDeliveryStatusToHub to report the status. + */ + boolean isReliable; + + /** + * The sequence number for a reliable message. For less than 2^32 messages, each message sent + * from a Context Hub will have a unique sequence number generated by the Context Hub, and the + * sequence numbers are guaranteed to not be reused for unacknowledged messages. For messages + * sent to the Context Hub, sequence numbers are only guaranteed to be unique within the scope + * of a given hostEndPoint. The sequence number may be reused if more than 2^32 messages are + * sent, due to the size limit of int. + * + * The sequence number is used only for reliable messages. There is no guarantee of strict + * ordering of messages. The recipient may receive messages with gaps between the sequence + * numbers. This is not an indication of a missed message. + * + * See isReliable for more information. + */ + int messageSequenceNumber; } diff --git a/contexthub/aidl/android/hardware/contexthub/ErrorCode.aidl b/contexthub/aidl/android/hardware/contexthub/ErrorCode.aidl new file mode 100644 index 0000000000000000000000000000000000000000..22e7ea1bb31f6b9c69160e25022d5a0d9771aa23 --- /dev/null +++ b/contexthub/aidl/android/hardware/contexthub/ErrorCode.aidl @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.hardware.contexthub; + +@VintfStability +@Backing(type="byte") +enum ErrorCode { + /** + * No Error. + */ + OK = 0, + + /** + * A generic transient error. The sender may retry the + * operation, but there is no guarantee of success. + */ + TRANSIENT_ERROR, + + /** + * A generic permanent error. The sender should not retry the operation. + */ + PERMANENT_ERROR, + + /** + * The request failed because the sender does not have necessary permissions. + * The sender should not retry the operation. + */ + PERMISSION_DENIED, + + /** + * The request failed because the destination was not found. + * The sender should not retry the operation. + */ + DESTINATION_NOT_FOUND, +} diff --git a/contexthub/aidl/android/hardware/contexthub/IContextHub.aidl b/contexthub/aidl/android/hardware/contexthub/IContextHub.aidl index 9683d2d7e474786b249c957658317bb37d1e86e5..b146ff814dc2be4a7bd510890a2e07177d0dd286 100644 --- a/contexthub/aidl/android/hardware/contexthub/IContextHub.aidl +++ b/contexthub/aidl/android/hardware/contexthub/IContextHub.aidl @@ -20,6 +20,7 @@ import android.hardware.contexthub.ContextHubInfo; import android.hardware.contexthub.ContextHubMessage; import android.hardware.contexthub.HostEndpointInfo; import android.hardware.contexthub.IContextHubCallback; +import android.hardware.contexthub.MessageDeliveryStatus; import android.hardware.contexthub.NanSessionStateUpdate; import android.hardware.contexthub.NanoappBinary; import android.hardware.contexthub.NanoappInfo; @@ -147,7 +148,7 @@ interface IContextHub { /** * Register a callback for the HAL implementation to send asynchronous messages to the service - * from a Context hub. There can only be one callback registered for a single Context Hub ID. + * from a Context hub. Each HAL client can only have one callback for each Context Hub ID. * * A call to this function when a callback has already been registered must override the * previous registration. @@ -235,6 +236,21 @@ interface IContextHub { */ void setTestMode(in boolean enable); + /** + * Sends a message delivery status to the Context Hub in response to receiving a + * ContextHubMessage with isReliable=true. Each reliable message should have a + * messageDeliveryStatus response. This method sends the message delivery status + * back to the Context Hub. + * + * @param contextHubId The identifier of the Context Hub. + * @param messageDeliveryStatus The status to be sent. + * + * @throws EX_UNSUPPORTED_OPERATION if ContextHubInfo.supportsReliableMessages is false for + * this hub. + */ + void sendMessageDeliveryStatusToHub( + in int contextHubId, in MessageDeliveryStatus messageDeliveryStatus); + /** * Error codes that are used as service specific errors with the AIDL return * value EX_SERVICE_SPECIFIC. diff --git a/contexthub/aidl/android/hardware/contexthub/IContextHubCallback.aidl b/contexthub/aidl/android/hardware/contexthub/IContextHubCallback.aidl index bfcb51e5895447b49a79236976663294728a2b6b..1aa07768f80e900fbc5247a9b96f628b844e0b9b 100644 --- a/contexthub/aidl/android/hardware/contexthub/IContextHubCallback.aidl +++ b/contexthub/aidl/android/hardware/contexthub/IContextHubCallback.aidl @@ -18,6 +18,7 @@ package android.hardware.contexthub; import android.hardware.contexthub.AsyncEventType; import android.hardware.contexthub.ContextHubMessage; +import android.hardware.contexthub.MessageDeliveryStatus; import android.hardware.contexthub.NanSessionRequest; import android.hardware.contexthub.NanoappInfo; @@ -90,6 +91,35 @@ interface IContextHubCallback { */ void handleNanSessionRequest(in NanSessionRequest request); + /** + * This callback is passed by the Contexthub service to the HAL + * implementation to allow the HAL to send the response for a reliable message. + * The response is the message delivery status of a recently sent message. See + * sendMessageDeliveryStatusToHub() for more details. + * + * @param hostEndPointId The ID of the host endpoint associated with this message delivery + * status. + * @param messageDeliveryStatus The status to be sent. + */ + void handleMessageDeliveryStatus( + in char hostEndpointId, in MessageDeliveryStatus messageDeliveryStatus); + + /** + * This callback is passed to the HAL implementation to allow the HAL to request a UUID that + * uniquely identifies a client. + * + * @return a byte array representating the UUID + */ + byte[16] getUuid(); + + /** + * This callback gets the name of a client implementing this IContextHubCallback interface, + * which must be a hard-coded string and does not change at runtime. + * + *

      The name provides a human-readable way to identify a client for troubleshooting purpose. + */ + String getName(); + /** * Amount of time, in milliseconds, that a handleNanSessionRequest can be pending before the * Contexthub service must respond. diff --git a/contexthub/aidl/android/hardware/contexthub/MessageDeliveryStatus.aidl b/contexthub/aidl/android/hardware/contexthub/MessageDeliveryStatus.aidl new file mode 100644 index 0000000000000000000000000000000000000000..ae425b322b2a43738f7f704500b90b0e6006f9c4 --- /dev/null +++ b/contexthub/aidl/android/hardware/contexthub/MessageDeliveryStatus.aidl @@ -0,0 +1,32 @@ +/* + * Copyright (C) 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.hardware.contexthub; + +import android.hardware.contexthub.ErrorCode; + +@VintfStability +parcelable MessageDeliveryStatus { + /** + * The messageSequenceNumber of the ContextHubMessage to which this status applies. + */ + int messageSequenceNumber; + + /** + * The error code associated with this status. + */ + ErrorCode errorCode; +} diff --git a/contexthub/aidl/default/Android.bp b/contexthub/aidl/default/Android.bp index d293e306c784b3bd11037e1f06dedbfea0829241..03213bc1b1f621ec784e7493a18ab5287f9c2201 100644 --- a/contexthub/aidl/default/Android.bp +++ b/contexthub/aidl/default/Android.bp @@ -29,7 +29,7 @@ cc_library_static { shared_libs: [ "libbase", "libbinder_ndk", - "android.hardware.contexthub-V2-ndk", + "android.hardware.contexthub-V3-ndk", ], export_include_dirs: ["include"], srcs: [ @@ -50,7 +50,7 @@ cc_binary { shared_libs: [ "libbase", "libbinder_ndk", - "android.hardware.contexthub-V2-ndk", + "android.hardware.contexthub-V3-ndk", ], static_libs: [ "libcontexthubexampleimpl", diff --git a/contexthub/aidl/default/ContextHub.cpp b/contexthub/aidl/default/ContextHub.cpp index 5272957f070ab16070d701aaab2a9fa76385a795..bd483d7101ffb10609853a1ada3d46ca451a5b3d 100644 --- a/contexthub/aidl/default/ContextHub.cpp +++ b/contexthub/aidl/default/ContextHub.cpp @@ -16,10 +16,7 @@ #include "contexthub-impl/ContextHub.h" -namespace aidl { -namespace android { -namespace hardware { -namespace contexthub { +namespace aidl::android::hardware::contexthub { using ::ndk::ScopedAStatus; @@ -34,10 +31,11 @@ ScopedAStatus ContextHub::getContextHubs(std::vector* out_contex hub.chrePlatformId = UINT64_C(0x476f6f6754000000); hub.chreApiMajorVersion = 1; hub.chreApiMinorVersion = 6; + hub.supportsReliableMessages = false; out_contextHubInfos->push_back(hub); - return ndk::ScopedAStatus::ok(); + return ScopedAStatus::ok(); } // We don't expose any nanoapps for the default impl, therefore all nanoapp-related APIs fail. @@ -63,14 +61,14 @@ ScopedAStatus ContextHub::enableNanoapp(int32_t /* in_contextHubId */, int64_t / } ScopedAStatus ContextHub::onSettingChanged(Setting /* in_setting */, bool /*in_enabled */) { - return ndk::ScopedAStatus::ok(); + return ScopedAStatus::ok(); } ScopedAStatus ContextHub::queryNanoapps(int32_t in_contextHubId) { if (in_contextHubId == kMockHubId && mCallback != nullptr) { std::vector nanoapps; mCallback->handleNanoappInfo(nanoapps); - return ndk::ScopedAStatus::ok(); + return ScopedAStatus::ok(); } else { return ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); } @@ -85,18 +83,18 @@ ScopedAStatus ContextHub::getPreloadedNanoappIds(int32_t /* in_contextHubId */, for (uint64_t i = 0; i < 10; ++i) { out_preloadedNanoappIds->push_back(i); } - return ndk::ScopedAStatus::ok(); + return ScopedAStatus::ok(); } ScopedAStatus ContextHub::onNanSessionStateChanged(const NanSessionStateUpdate& /*in_update*/) { - return ndk::ScopedAStatus::ok(); + return ScopedAStatus::ok(); } ScopedAStatus ContextHub::registerCallback(int32_t in_contextHubId, const std::shared_ptr& in_cb) { if (in_contextHubId == kMockHubId) { mCallback = in_cb; - return ndk::ScopedAStatus::ok(); + return ScopedAStatus::ok(); } else { return ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); } @@ -108,20 +106,20 @@ ScopedAStatus ContextHub::sendMessageToHub(int32_t in_contextHubId, // Return true here to indicate that the HAL has accepted the message. // Successful delivery of the message to a nanoapp should be handled at // a higher level protocol. - return ndk::ScopedAStatus::ok(); + return ScopedAStatus::ok(); } else { return ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); } } ScopedAStatus ContextHub::setTestMode(bool /* enable */) { - return ndk::ScopedAStatus::ok(); + return ScopedAStatus::ok(); } ScopedAStatus ContextHub::onHostEndpointConnected(const HostEndpointInfo& in_info) { mConnectedHostEndpoints.insert(in_info.hostEndpointId); - return ndk::ScopedAStatus::ok(); + return ScopedAStatus::ok(); } ScopedAStatus ContextHub::onHostEndpointDisconnected(char16_t in_hostEndpointId) { @@ -129,10 +127,13 @@ ScopedAStatus ContextHub::onHostEndpointDisconnected(char16_t in_hostEndpointId) mConnectedHostEndpoints.erase(in_hostEndpointId); } - return ndk::ScopedAStatus::ok(); + return ScopedAStatus::ok(); } -} // namespace contexthub -} // namespace hardware -} // namespace android -} // namespace aidl +ScopedAStatus ContextHub::sendMessageDeliveryStatusToHub( + int32_t /* in_contextHubId */, + const MessageDeliveryStatus& /* in_messageDeliveryStatus */) { + return ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION); +} + +} // namespace aidl::android::hardware::contexthub diff --git a/contexthub/aidl/default/contexthub-default.xml b/contexthub/aidl/default/contexthub-default.xml index 930f672197731d0692154be83f570432c5b7f54c..2f8ddc8e1b3feb42a7f7050a4dbb0fdb1056dca8 100644 --- a/contexthub/aidl/default/contexthub-default.xml +++ b/contexthub/aidl/default/contexthub-default.xml @@ -1,7 +1,7 @@ android.hardware.contexthub - 2 + 3 IContextHub default diff --git a/contexthub/aidl/default/include/contexthub-impl/ContextHub.h b/contexthub/aidl/default/include/contexthub-impl/ContextHub.h index 7a2cfd170224c77f79908448aba29f02dc2da96b..72e8b3b66ecad0843d73ccc69c21a9b3291e0c8e 100644 --- a/contexthub/aidl/default/include/contexthub-impl/ContextHub.h +++ b/contexthub/aidl/default/include/contexthub-impl/ContextHub.h @@ -49,6 +49,9 @@ class ContextHub : public BnContextHub { ::ndk::ScopedAStatus onHostEndpointDisconnected(char16_t in_hostEndpointId) override; ::ndk::ScopedAStatus onNanSessionStateChanged(const NanSessionStateUpdate& in_update) override; + ::ndk::ScopedAStatus sendMessageDeliveryStatusToHub( + int32_t in_contextHubId, + const MessageDeliveryStatus& in_messageDeliveryStatus) override; private: static constexpr uint32_t kMockHubId = 0; diff --git a/contexthub/aidl/vts/Android.bp b/contexthub/aidl/vts/Android.bp index 1534b40876e8c324d0105dcbe13b7b32dbd7aa66..b166bafe26280c875c85225095897df94bc1e890 100644 --- a/contexthub/aidl/vts/Android.bp +++ b/contexthub/aidl/vts/Android.bp @@ -32,7 +32,7 @@ cc_test { "libbinder", ], static_libs: [ - "android.hardware.contexthub-V2-cpp", + "android.hardware.contexthub-V3-cpp", "VtsHalContexthubUtils", ], test_suites: [ diff --git a/contexthub/aidl/vts/VtsAidlHalContextHubTargetTest.cpp b/contexthub/aidl/vts/VtsAidlHalContextHubTargetTest.cpp index c1cc07cf51a961adeab622f8605f374f1d1f7db5..fd55b80fde823e5ddef8b4f54975eb58945b1587 100644 --- a/contexthub/aidl/vts/VtsAidlHalContextHubTargetTest.cpp +++ b/contexthub/aidl/vts/VtsAidlHalContextHubTargetTest.cpp @@ -36,9 +36,11 @@ using ::android::binder::Status; using ::android::hardware::contexthub::AsyncEventType; using ::android::hardware::contexthub::ContextHubInfo; using ::android::hardware::contexthub::ContextHubMessage; +using ::android::hardware::contexthub::ErrorCode; using ::android::hardware::contexthub::HostEndpointInfo; using ::android::hardware::contexthub::IContextHub; using ::android::hardware::contexthub::IContextHubCallbackDefault; +using ::android::hardware::contexthub::MessageDeliveryStatus; using ::android::hardware::contexthub::NanoappBinary; using ::android::hardware::contexthub::NanoappInfo; using ::android::hardware::contexthub::NanoappRpcService; @@ -48,6 +50,11 @@ using ::android::hardware::contexthub::Setting; using ::android::hardware::contexthub::vts_utils::kNonExistentAppId; using ::android::hardware::contexthub::vts_utils::waitForCallback; +// 6612b522-b717-41c8-b48d-c0b1cc64e142 +constexpr std::array kUuid = {0x66, 0x12, 0xb5, 0x22, 0xb7, 0x17, 0x41, 0xc8, + 0xb4, 0x8d, 0xc0, 0xb1, 0xcc, 0x64, 0xe1, 0x42}; +const String16 kName{"VtsAidlHalContextHubTargetTest"}; + class ContextHubAidl : public testing::TestWithParam> { public: virtual void SetUp() override { @@ -126,6 +133,22 @@ class EmptyContextHubCallback : public android::hardware::contexthub::BnContextH Status handleNanSessionRequest(const NanSessionRequest& /* request */) override { return Status::ok(); } + + Status handleMessageDeliveryStatus( + char16_t /* hostEndPointId */, + const MessageDeliveryStatus& /* messageDeliveryStatus */) override { + return Status::ok(); + } + + Status getUuid(std::array* out_uuid) override { + *out_uuid = kUuid; + return Status::ok(); + } + + Status getName(::android::String16* out_name) override { + *out_name = kName; + return Status::ok(); + } }; TEST_P(ContextHubAidl, TestRegisterCallback) { @@ -157,6 +180,22 @@ class QueryAppsCallback : public android::hardware::contexthub::BnContextHubCall return Status::ok(); } + Status handleMessageDeliveryStatus( + char16_t /* hostEndPointId */, + const MessageDeliveryStatus& /* messageDeliveryStatus */) override { + return Status::ok(); + } + + Status getUuid(std::array* out_uuid) override { + *out_uuid = kUuid; + return Status::ok(); + } + + Status getName(::android::String16* out_name) override { + *out_name = kName; + return Status::ok(); + } + std::promise> promise; }; @@ -223,6 +262,22 @@ class TransactionResultCallback : public android::hardware::contexthub::BnContex return Status::ok(); } + Status handleMessageDeliveryStatus( + char16_t /* hostEndPointId */, + const MessageDeliveryStatus& /* messageDeliveryStatus */) override { + return Status::ok(); + } + + Status getUuid(std::array* out_uuid) override { + *out_uuid = kUuid; + return Status::ok(); + } + + Status getName(::android::String16* out_name) override { + *out_name = kName; + return Status::ok(); + } + uint32_t expectedTransactionId = 0; std::promise promise; }; @@ -396,6 +451,20 @@ TEST_P(ContextHubAidl, TestNanSessionStateChange) { } } +TEST_P(ContextHubAidl, TestSendMessageDeliveryStatusToHub) { + MessageDeliveryStatus messageDeliveryStatus; + messageDeliveryStatus.messageSequenceNumber = 123; + messageDeliveryStatus.errorCode = ErrorCode::OK; + + Status status = contextHub->sendMessageDeliveryStatusToHub(getHubId(), messageDeliveryStatus); + if (status.exceptionCode() == Status::EX_UNSUPPORTED_OPERATION || + status.transactionError() == android::UNKNOWN_TRANSACTION) { + GTEST_SKIP() << "Not supported -> old API; or not implemented"; + } else { + EXPECT_TRUE(status.isOk()); + } +} + std::string PrintGeneratedTest(const testing::TestParamInfo& info) { return std::string("CONTEXT_HUB_ID_") + std::to_string(std::get<1>(info.param)); } diff --git a/drm/aidl/OWNERS b/drm/aidl/OWNERS deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/drm/aidl/vts/OWNERS b/drm/aidl/vts/OWNERS deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/gnss/1.1/default/Android.bp b/gnss/1.1/default/Android.bp index 300e8de3afdcb5e4aee9b9177da404e9ccdca23f..697cb91f4f9ca675094137d62a67fdd8f15ce82a 100644 --- a/gnss/1.1/default/Android.bp +++ b/gnss/1.1/default/Android.bp @@ -27,7 +27,7 @@ cc_binary { "android.hardware.gnss@2.0", "android.hardware.gnss@1.1", "android.hardware.gnss@1.0", - "android.hardware.gnss-V3-ndk", + "android.hardware.gnss-V4-ndk", ], static_libs: [ "android.hardware.gnss@common-default-lib", diff --git a/gnss/1.1/vts/functional/Android.bp b/gnss/1.1/vts/functional/Android.bp index 2414cbc4aaf3d093e1501eeec5968b8c79a5c2b9..f9fcbf1f515391d92256e97521054160e242af62 100644 --- a/gnss/1.1/vts/functional/Android.bp +++ b/gnss/1.1/vts/functional/Android.bp @@ -36,7 +36,7 @@ cc_test { "android.hardware.gnss@1.1", "android.hardware.gnss@2.0", "android.hardware.gnss@common-vts-lib", - "android.hardware.gnss-V3-cpp", + "android.hardware.gnss-V4-cpp", ], shared_libs: [ "android.hardware.gnss.measurement_corrections@1.0", diff --git a/gnss/2.0/default/Android.bp b/gnss/2.0/default/Android.bp index 83bc2cc903cc46f35281433af7ed194fc7b30771..35c2e376ac74189f27634fdc1419399362623651 100644 --- a/gnss/2.0/default/Android.bp +++ b/gnss/2.0/default/Android.bp @@ -50,7 +50,7 @@ cc_binary { "android.hardware.gnss@2.0", "android.hardware.gnss@1.1", "android.hardware.gnss@1.0", - "android.hardware.gnss-V3-ndk", + "android.hardware.gnss-V4-ndk", ], static_libs: [ "android.hardware.gnss@common-default-lib", diff --git a/gnss/2.0/vts/functional/Android.bp b/gnss/2.0/vts/functional/Android.bp index e8db8862d29147e5b9b2ddeabd65c282429b8751..0b543086d58ee0b0ba6ea9d350fc1b58c0a3248c 100644 --- a/gnss/2.0/vts/functional/Android.bp +++ b/gnss/2.0/vts/functional/Android.bp @@ -39,7 +39,7 @@ cc_test { "android.hardware.gnss@2.0", "android.hardware.gnss@2.1", "android.hardware.gnss@common-vts-lib", - "android.hardware.gnss-V3-cpp", + "android.hardware.gnss-V4-cpp", ], test_suites: [ "general-tests", diff --git a/gnss/2.1/default/Android.bp b/gnss/2.1/default/Android.bp index 4a4ce544aefa4b1aff7b753c17f8dde0f0bdb287..1bb75121139b31698b59af18666ae3c941c5ab08 100644 --- a/gnss/2.1/default/Android.bp +++ b/gnss/2.1/default/Android.bp @@ -44,7 +44,7 @@ cc_binary { "android.hardware.gnss@1.0", "android.hardware.gnss@1.1", "android.hardware.gnss@2.0", - "android.hardware.gnss-V3-ndk", + "android.hardware.gnss-V4-ndk", ], static_libs: [ "android.hardware.gnss@common-default-lib", diff --git a/gnss/2.1/vts/functional/Android.bp b/gnss/2.1/vts/functional/Android.bp index 76f9d079644f54be43c4273e3a0b02d307b9efcd..9906b276a077c47146757c9d0b03e12d3d3ce370 100644 --- a/gnss/2.1/vts/functional/Android.bp +++ b/gnss/2.1/vts/functional/Android.bp @@ -40,7 +40,7 @@ cc_test { "android.hardware.gnss@2.0", "android.hardware.gnss@2.1", "android.hardware.gnss@common-vts-lib", - "android.hardware.gnss-V3-cpp", + "android.hardware.gnss-V4-cpp", ], shared_libs: [ "libvintf", diff --git a/gnss/aidl/Android.bp b/gnss/aidl/Android.bp index cb2c001612dc50018c23aa036ce6e01077e2202a..611c7e0683fa09e008a44a85cf10a1ee2b361d7a 100644 --- a/gnss/aidl/Android.bp +++ b/gnss/aidl/Android.bp @@ -52,6 +52,6 @@ aidl_interface { }, ], - frozen: true, + frozen: false, } diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/ElapsedRealtime.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/ElapsedRealtime.aidl index 559ed2915f59410924a1d59d81dba4406b9a90a1..5d7f51e3423c8f0749b9c462972798974b0ced96 100644 --- a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/ElapsedRealtime.aidl +++ b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/ElapsedRealtime.aidl @@ -38,6 +38,6 @@ parcelable ElapsedRealtime { int flags; long timestampNs; double timeUncertaintyNs; - const int HAS_TIMESTAMP_NS = 1; - const int HAS_TIME_UNCERTAINTY_NS = 2; + const int HAS_TIMESTAMP_NS = (1 << 0) /* 1 */; + const int HAS_TIME_UNCERTAINTY_NS = (1 << 1) /* 2 */; } diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/GnssClock.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/GnssClock.aidl index a8454ddfc04a3f16a3c00e86fe57ddb936e6280e..63edd44a196f93a865fc4369cf32fda24efa43ba 100644 --- a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/GnssClock.aidl +++ b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/GnssClock.aidl @@ -46,11 +46,11 @@ parcelable GnssClock { double driftUncertaintyNsps; int hwClockDiscontinuityCount; android.hardware.gnss.GnssSignalType referenceSignalTypeForIsb; - const int HAS_LEAP_SECOND = 1; - const int HAS_TIME_UNCERTAINTY = 2; - const int HAS_FULL_BIAS = 4; - const int HAS_BIAS = 8; - const int HAS_BIAS_UNCERTAINTY = 16; - const int HAS_DRIFT = 32; - const int HAS_DRIFT_UNCERTAINTY = 64; + const int HAS_LEAP_SECOND = (1 << 0) /* 1 */; + const int HAS_TIME_UNCERTAINTY = (1 << 1) /* 2 */; + const int HAS_FULL_BIAS = (1 << 2) /* 4 */; + const int HAS_BIAS = (1 << 3) /* 8 */; + const int HAS_BIAS_UNCERTAINTY = (1 << 4) /* 16 */; + const int HAS_DRIFT = (1 << 5) /* 32 */; + const int HAS_DRIFT_UNCERTAINTY = (1 << 6) /* 64 */; } diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/GnssLocation.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/GnssLocation.aidl index ed9dcfa96781d877c2b41fdfbe9a41c840a50067..e64d98a297652d3ec7d8e60adbe256207f7e15be 100644 --- a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/GnssLocation.aidl +++ b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/GnssLocation.aidl @@ -47,12 +47,12 @@ parcelable GnssLocation { double bearingAccuracyDegrees; long timestampMillis; android.hardware.gnss.ElapsedRealtime elapsedRealtime; - const int HAS_LAT_LONG = 1; - const int HAS_ALTITUDE = 2; - const int HAS_SPEED = 4; - const int HAS_BEARING = 8; - const int HAS_HORIZONTAL_ACCURACY = 16; - const int HAS_VERTICAL_ACCURACY = 32; - const int HAS_SPEED_ACCURACY = 64; - const int HAS_BEARING_ACCURACY = 128; + const int HAS_LAT_LONG = 0x0001; + const int HAS_ALTITUDE = 0x0002; + const int HAS_SPEED = 0x0004; + const int HAS_BEARING = 0x0008; + const int HAS_HORIZONTAL_ACCURACY = 0x0010; + const int HAS_VERTICAL_ACCURACY = 0x0020; + const int HAS_SPEED_ACCURACY = 0x0040; + const int HAS_BEARING_ACCURACY = 0x0080; } diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/GnssMeasurement.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/GnssMeasurement.aidl index 8a448874196a9a9b32d59e68a9dbc1a42c900ba0..a2594af99a500581dbfba0f87e5c9ed77a6aa2c4 100644 --- a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/GnssMeasurement.aidl +++ b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/GnssMeasurement.aidl @@ -61,39 +61,39 @@ parcelable GnssMeasurement { double satelliteInterSignalBiasUncertaintyNs; android.hardware.gnss.SatellitePvt satellitePvt; android.hardware.gnss.CorrelationVector[] correlationVectors; - const int HAS_SNR = 1; - const int HAS_CARRIER_FREQUENCY = 512; - const int HAS_CARRIER_CYCLES = 1024; - const int HAS_CARRIER_PHASE = 2048; - const int HAS_CARRIER_PHASE_UNCERTAINTY = 4096; - const int HAS_AUTOMATIC_GAIN_CONTROL = 8192; - const int HAS_FULL_ISB = 65536; - const int HAS_FULL_ISB_UNCERTAINTY = 131072; - const int HAS_SATELLITE_ISB = 262144; - const int HAS_SATELLITE_ISB_UNCERTAINTY = 524288; - const int HAS_SATELLITE_PVT = 1048576; - const int HAS_CORRELATION_VECTOR = 2097152; + const int HAS_SNR = (1 << 0) /* 1 */; + const int HAS_CARRIER_FREQUENCY = (1 << 9) /* 512 */; + const int HAS_CARRIER_CYCLES = (1 << 10) /* 1024 */; + const int HAS_CARRIER_PHASE = (1 << 11) /* 2048 */; + const int HAS_CARRIER_PHASE_UNCERTAINTY = (1 << 12) /* 4096 */; + const int HAS_AUTOMATIC_GAIN_CONTROL = (1 << 13) /* 8192 */; + const int HAS_FULL_ISB = (1 << 16) /* 65536 */; + const int HAS_FULL_ISB_UNCERTAINTY = (1 << 17) /* 131072 */; + const int HAS_SATELLITE_ISB = (1 << 18) /* 262144 */; + const int HAS_SATELLITE_ISB_UNCERTAINTY = (1 << 19) /* 524288 */; + const int HAS_SATELLITE_PVT = (1 << 20) /* 1048576 */; + const int HAS_CORRELATION_VECTOR = (1 << 21) /* 2097152 */; const int STATE_UNKNOWN = 0; - const int STATE_CODE_LOCK = 1; - const int STATE_BIT_SYNC = 2; - const int STATE_SUBFRAME_SYNC = 4; - const int STATE_TOW_DECODED = 8; - const int STATE_MSEC_AMBIGUOUS = 16; - const int STATE_SYMBOL_SYNC = 32; - const int STATE_GLO_STRING_SYNC = 64; - const int STATE_GLO_TOD_DECODED = 128; - const int STATE_BDS_D2_BIT_SYNC = 256; - const int STATE_BDS_D2_SUBFRAME_SYNC = 512; - const int STATE_GAL_E1BC_CODE_LOCK = 1024; - const int STATE_GAL_E1C_2ND_CODE_LOCK = 2048; - const int STATE_GAL_E1B_PAGE_SYNC = 4096; - const int STATE_SBAS_SYNC = 8192; - const int STATE_TOW_KNOWN = 16384; - const int STATE_GLO_TOD_KNOWN = 32768; - const int STATE_2ND_CODE_LOCK = 65536; + const int STATE_CODE_LOCK = (1 << 0) /* 1 */; + const int STATE_BIT_SYNC = (1 << 1) /* 2 */; + const int STATE_SUBFRAME_SYNC = (1 << 2) /* 4 */; + const int STATE_TOW_DECODED = (1 << 3) /* 8 */; + const int STATE_MSEC_AMBIGUOUS = (1 << 4) /* 16 */; + const int STATE_SYMBOL_SYNC = (1 << 5) /* 32 */; + const int STATE_GLO_STRING_SYNC = (1 << 6) /* 64 */; + const int STATE_GLO_TOD_DECODED = (1 << 7) /* 128 */; + const int STATE_BDS_D2_BIT_SYNC = (1 << 8) /* 256 */; + const int STATE_BDS_D2_SUBFRAME_SYNC = (1 << 9) /* 512 */; + const int STATE_GAL_E1BC_CODE_LOCK = (1 << 10) /* 1024 */; + const int STATE_GAL_E1C_2ND_CODE_LOCK = (1 << 11) /* 2048 */; + const int STATE_GAL_E1B_PAGE_SYNC = (1 << 12) /* 4096 */; + const int STATE_SBAS_SYNC = (1 << 13) /* 8192 */; + const int STATE_TOW_KNOWN = (1 << 14) /* 16384 */; + const int STATE_GLO_TOD_KNOWN = (1 << 15) /* 32768 */; + const int STATE_2ND_CODE_LOCK = (1 << 16) /* 65536 */; const int ADR_STATE_UNKNOWN = 0; - const int ADR_STATE_VALID = 1; - const int ADR_STATE_RESET = 2; - const int ADR_STATE_CYCLE_SLIP = 4; - const int ADR_STATE_HALF_CYCLE_RESOLVED = 8; + const int ADR_STATE_VALID = (1 << 0) /* 1 */; + const int ADR_STATE_RESET = (1 << 1) /* 2 */; + const int ADR_STATE_CYCLE_SLIP = (1 << 2) /* 4 */; + const int ADR_STATE_HALF_CYCLE_RESOLVED = (1 << 3) /* 8 */; } diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/GnssSignalType.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/GnssSignalType.aidl index 4a49547b496b187c43f13fac452a05357bbdfbbe..a17f933e76a01ac79b2c3b7538e0cf118793cfa6 100644 --- a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/GnssSignalType.aidl +++ b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/GnssSignalType.aidl @@ -42,6 +42,7 @@ parcelable GnssSignalType { const @utf8InCpp String CODE_TYPE_B = "B"; const @utf8InCpp String CODE_TYPE_C = "C"; const @utf8InCpp String CODE_TYPE_D = "D"; + const @utf8InCpp String CODE_TYPE_E = "E"; const @utf8InCpp String CODE_TYPE_I = "I"; const @utf8InCpp String CODE_TYPE_L = "L"; const @utf8InCpp String CODE_TYPE_M = "M"; diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IAGnssRil.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IAGnssRil.aidl index c782b6f8ffc424519e239b837639498c36dd274e..c8634ec2b0ab31ecf7790b83cbe246cbb5fcf7c7 100644 --- a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IAGnssRil.aidl +++ b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IAGnssRil.aidl @@ -40,8 +40,8 @@ interface IAGnssRil { void setSetId(in android.hardware.gnss.IAGnssRil.SetIdType type, in @utf8InCpp String setid); void updateNetworkState(in android.hardware.gnss.IAGnssRil.NetworkAttributes attributes); void injectNiSuplMessageData(in byte[] msgData, in int slotIndex); - const int NETWORK_CAPABILITY_NOT_METERED = 1; - const int NETWORK_CAPABILITY_NOT_ROAMING = 2; + const int NETWORK_CAPABILITY_NOT_METERED = 0x01; + const int NETWORK_CAPABILITY_NOT_ROAMING = 0x02; @Backing(type="int") @VintfStability enum AGnssRefLocationType { GSM_CELLID = 1, diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnss.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnss.aidl index 0e6405ea7ccbe32843a2aa16e6d3704c8e492f20..d1aaf2c4578eceffab6b8d477dda0b1b1e91f4be 100644 --- a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnss.aidl +++ b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnss.aidl @@ -77,19 +77,19 @@ interface IGnss { } @Backing(type="int") @VintfStability enum GnssAidingData { - EPHEMERIS = 1, - ALMANAC = 2, - POSITION = 4, - TIME = 8, - IONO = 16, - UTC = 32, - HEALTH = 64, - SVDIR = 128, - SVSTEER = 256, - SADATA = 512, - RTI = 1024, - CELLDB_INFO = 32768, - ALL = 65535, + EPHEMERIS = 0x0001, + ALMANAC = 0x0002, + POSITION = 0x0004, + TIME = 0x0008, + IONO = 0x0010, + UTC = 0x0020, + HEALTH = 0x0040, + SVDIR = 0x0080, + SVSTEER = 0x0100, + SADATA = 0x0200, + RTI = 0x0400, + CELLDB_INFO = 0x8000, + ALL = 0xFFFF, } @VintfStability parcelable PositionModeOptions { diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnssBatching.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnssBatching.aidl index d82aa1fe07db58048ab8598ae15aa397a87415d5..a021f55918d3fec2193a844260e06db51a8b0b7f 100644 --- a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnssBatching.aidl +++ b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnssBatching.aidl @@ -41,7 +41,7 @@ interface IGnssBatching { void flush(); void stop(); void cleanup(); - const int WAKEUP_ON_FIFO_FULL = 1; + const int WAKEUP_ON_FIFO_FULL = 0x01; @VintfStability parcelable Options { long periodNanos; diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnssCallback.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnssCallback.aidl index 0247182207b85a72524b943648af0000a7c736af..61710d3e25c2ce6b6d90cf0b66bbfb056edb6183 100644 --- a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnssCallback.aidl +++ b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnssCallback.aidl @@ -46,22 +46,22 @@ interface IGnssCallback { void gnssRequestTimeCb(); void gnssRequestLocationCb(in boolean independentFromGnss, in boolean isUserEmergency); void gnssSetSignalTypeCapabilitiesCb(in android.hardware.gnss.GnssSignalType[] gnssSignalTypes); - const int CAPABILITY_SCHEDULING = 1; - const int CAPABILITY_MSB = 2; - const int CAPABILITY_MSA = 4; - const int CAPABILITY_SINGLE_SHOT = 8; - const int CAPABILITY_ON_DEMAND_TIME = 16; - const int CAPABILITY_GEOFENCING = 32; - const int CAPABILITY_MEASUREMENTS = 64; - const int CAPABILITY_NAV_MESSAGES = 128; - const int CAPABILITY_LOW_POWER_MODE = 256; - const int CAPABILITY_SATELLITE_BLOCKLIST = 512; - const int CAPABILITY_MEASUREMENT_CORRECTIONS = 1024; - const int CAPABILITY_ANTENNA_INFO = 2048; - const int CAPABILITY_CORRELATION_VECTOR = 4096; - const int CAPABILITY_SATELLITE_PVT = 8192; - const int CAPABILITY_MEASUREMENT_CORRECTIONS_FOR_DRIVING = 16384; - const int CAPABILITY_ACCUMULATED_DELTA_RANGE = 32768; + const int CAPABILITY_SCHEDULING = (1 << 0) /* 1 */; + const int CAPABILITY_MSB = (1 << 1) /* 2 */; + const int CAPABILITY_MSA = (1 << 2) /* 4 */; + const int CAPABILITY_SINGLE_SHOT = (1 << 3) /* 8 */; + const int CAPABILITY_ON_DEMAND_TIME = (1 << 4) /* 16 */; + const int CAPABILITY_GEOFENCING = (1 << 5) /* 32 */; + const int CAPABILITY_MEASUREMENTS = (1 << 6) /* 64 */; + const int CAPABILITY_NAV_MESSAGES = (1 << 7) /* 128 */; + const int CAPABILITY_LOW_POWER_MODE = (1 << 8) /* 256 */; + const int CAPABILITY_SATELLITE_BLOCKLIST = (1 << 9) /* 512 */; + const int CAPABILITY_MEASUREMENT_CORRECTIONS = (1 << 10) /* 1024 */; + const int CAPABILITY_ANTENNA_INFO = (1 << 11) /* 2048 */; + const int CAPABILITY_CORRELATION_VECTOR = (1 << 12) /* 4096 */; + const int CAPABILITY_SATELLITE_PVT = (1 << 13) /* 8192 */; + const int CAPABILITY_MEASUREMENT_CORRECTIONS_FOR_DRIVING = (1 << 14) /* 16384 */; + const int CAPABILITY_ACCUMULATED_DELTA_RANGE = (1 << 15) /* 32768 */; @Backing(type="int") @VintfStability enum GnssStatusValue { NONE = 0, @@ -73,10 +73,10 @@ interface IGnssCallback { @Backing(type="int") @VintfStability enum GnssSvFlags { NONE = 0, - HAS_EPHEMERIS_DATA = 1, - HAS_ALMANAC_DATA = 2, - USED_IN_FIX = 4, - HAS_CARRIER_FREQUENCY = 8, + HAS_EPHEMERIS_DATA = (1 << 0) /* 1 */, + HAS_ALMANAC_DATA = (1 << 1) /* 2 */, + USED_IN_FIX = (1 << 2) /* 4 */, + HAS_CARRIER_FREQUENCY = (1 << 3) /* 8 */, } @VintfStability parcelable GnssSvInfo { diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnssConfiguration.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnssConfiguration.aidl index 1d6399e52ba172965a9b84fd3194b1e0a740bd4f..70df11afa95a5a2bf209590b74de0c694290ba7f 100644 --- a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnssConfiguration.aidl +++ b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnssConfiguration.aidl @@ -42,11 +42,11 @@ interface IGnssConfiguration { void setEmergencySuplPdn(in boolean enable); void setEsExtensionSec(in int emergencyExtensionSeconds); void setBlocklist(in android.hardware.gnss.BlocklistedSource[] blocklist); - const int SUPL_MODE_MSB = 1; - const int SUPL_MODE_MSA = 2; - const int LPP_PROFILE_USER_PLANE = 1; - const int LPP_PROFILE_CONTROL_PLANE = 2; - const int GLONASS_POS_PROTOCOL_RRC_CPLANE = 1; - const int GLONASS_POS_PROTOCOL_RRLP_UPLANE = 2; - const int GLONASS_POS_PROTOCOL_LPP_UPLANE = 4; + const int SUPL_MODE_MSB = 0x01; + const int SUPL_MODE_MSA = 0x02; + const int LPP_PROFILE_USER_PLANE = 0x01; + const int LPP_PROFILE_CONTROL_PLANE = 0x02; + const int GLONASS_POS_PROTOCOL_RRC_CPLANE = 0x01; + const int GLONASS_POS_PROTOCOL_RRLP_UPLANE = 0x02; + const int GLONASS_POS_PROTOCOL_LPP_UPLANE = 0x04; } diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnssGeofenceCallback.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnssGeofenceCallback.aidl index df5dc2d9194b7f095f8dbb1ce6843e49952e31e4..90f9ebce433af9a7c8105d4e65af6a3f5cc43542 100644 --- a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnssGeofenceCallback.aidl +++ b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnssGeofenceCallback.aidl @@ -41,15 +41,15 @@ interface IGnssGeofenceCallback { void gnssGeofenceRemoveCb(in int geofenceId, in int status); void gnssGeofencePauseCb(in int geofenceId, in int status); void gnssGeofenceResumeCb(in int geofenceId, in int status); - const int ENTERED = 1; - const int EXITED = 2; - const int UNCERTAIN = 4; - const int UNAVAILABLE = 1; - const int AVAILABLE = 2; + const int ENTERED = (1 << 0) /* 1 */; + const int EXITED = (1 << 1) /* 2 */; + const int UNCERTAIN = (1 << 2) /* 4 */; + const int UNAVAILABLE = (1 << 0) /* 1 */; + const int AVAILABLE = (1 << 1) /* 2 */; const int OPERATION_SUCCESS = 0; - const int ERROR_TOO_MANY_GEOFENCES = -100; - const int ERROR_ID_EXISTS = -101; - const int ERROR_ID_UNKNOWN = -102; - const int ERROR_INVALID_TRANSITION = -103; - const int ERROR_GENERIC = -149; + const int ERROR_TOO_MANY_GEOFENCES = (-100) /* -100 */; + const int ERROR_ID_EXISTS = (-101) /* -101 */; + const int ERROR_ID_UNKNOWN = (-102) /* -102 */; + const int ERROR_INVALID_TRANSITION = (-103) /* -103 */; + const int ERROR_GENERIC = (-149) /* -149 */; } diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnssNavigationMessageCallback.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnssNavigationMessageCallback.aidl index c65cff21be6073230f04560f9743920037072e7f..f6a8fef7ace72cf55daeddb23be365aaaebccf8e 100644 --- a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnssNavigationMessageCallback.aidl +++ b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnssNavigationMessageCallback.aidl @@ -44,26 +44,31 @@ interface IGnssNavigationMessageCallback { int messageId; int submessageId; byte[] data; - const int STATUS_PARITY_PASSED = 1; - const int STATUS_PARITY_REBUILT = 2; + const int STATUS_PARITY_PASSED = (1 << 0) /* 1 */; + const int STATUS_PARITY_REBUILT = (1 << 1) /* 2 */; const int STATUS_UNKNOWN = 0; @Backing(type="int") @VintfStability enum GnssNavigationMessageType { UNKNOWN = 0, - GPS_L1CA = 257, - GPS_L2CNAV = 258, - GPS_L5CNAV = 259, - SBS = 513, - GPS_CNAV2 = 260, - GLO_L1CA = 769, - QZS_L1CA = 1025, - BDS_D1 = 1281, - BDS_D2 = 1282, - BDS_CNAV1 = 1283, - BDS_CNAV2 = 1284, - GAL_I = 1537, - GAL_F = 1538, - IRN_L5CA = 1793, + GPS_L1CA = 0x0101, + GPS_L2CNAV = 0x0102, + GPS_L5CNAV = 0x0103, + SBS = 0x0201, + GPS_CNAV2 = 0x0104, + GLO_L1CA = 0x0301, + QZS_L1CA = 0x0401, + BDS_D1 = 0x0501, + BDS_D2 = 0x0502, + BDS_CNAV1 = 0x0503, + BDS_CNAV2 = 0x0504, + GAL_I = 0x0601, + GAL_F = 0x0602, + /** + * @deprecated Use IRN_L5 instead. + */ + IRN_L5CA = 0x0701, + IRN_L5 = 0x0702, + IRN_L1 = 0x0703, } } } diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnssPowerIndicationCallback.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnssPowerIndicationCallback.aidl index d35c77fdf19ebb224cddb12c686096a65f951656..07b10ad201ac355e5de8aa8adf8884684d5a1b48 100644 --- a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnssPowerIndicationCallback.aidl +++ b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnssPowerIndicationCallback.aidl @@ -37,10 +37,10 @@ package android.hardware.gnss; interface IGnssPowerIndicationCallback { void setCapabilitiesCb(in int capabilities); oneway void gnssPowerStatsCb(in android.hardware.gnss.GnssPowerStats gnssPowerStats); - const int CAPABILITY_TOTAL = 1; - const int CAPABILITY_SINGLEBAND_TRACKING = 2; - const int CAPABILITY_MULTIBAND_TRACKING = 4; - const int CAPABILITY_SINGLEBAND_ACQUISITION = 8; - const int CAPABILITY_MULTIBAND_ACQUISITION = 16; - const int CAPABILITY_OTHER_MODES = 32; + const int CAPABILITY_TOTAL = (1 << 0) /* 1 */; + const int CAPABILITY_SINGLEBAND_TRACKING = (1 << 1) /* 2 */; + const int CAPABILITY_MULTIBAND_TRACKING = (1 << 2) /* 4 */; + const int CAPABILITY_SINGLEBAND_ACQUISITION = (1 << 3) /* 8 */; + const int CAPABILITY_MULTIBAND_ACQUISITION = (1 << 4) /* 16 */; + const int CAPABILITY_OTHER_MODES = (1 << 5) /* 32 */; } diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/SatellitePvt.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/SatellitePvt.aidl index 5fd411fa843fdbc50601375bff1178ffe63fe830..ae65f39e3a41f0850f5844667710ddf0548efe1a 100644 --- a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/SatellitePvt.aidl +++ b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/SatellitePvt.aidl @@ -46,9 +46,9 @@ parcelable SatellitePvt { long timeOfEphemerisSeconds; int issueOfDataEphemeris; android.hardware.gnss.SatellitePvt.SatelliteEphemerisSource ephemerisSource = android.hardware.gnss.SatellitePvt.SatelliteEphemerisSource.OTHER; - const int HAS_POSITION_VELOCITY_CLOCK_INFO = 1; - const int HAS_IONO = 2; - const int HAS_TROPO = 4; + const int HAS_POSITION_VELOCITY_CLOCK_INFO = (1 << 0) /* 1 */; + const int HAS_IONO = (1 << 1) /* 2 */; + const int HAS_TROPO = (1 << 2) /* 4 */; @Backing(type="int") @VintfStability enum SatelliteEphemerisSource { DEMODULATED = 0, diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/measurement_corrections/IMeasurementCorrectionsCallback.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/measurement_corrections/IMeasurementCorrectionsCallback.aidl index 4126702a2de934d4f31f923fb81b9a023c772245..61909d05f7c374d9c63d5f1f17ef46b2681979ff 100644 --- a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/measurement_corrections/IMeasurementCorrectionsCallback.aidl +++ b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/measurement_corrections/IMeasurementCorrectionsCallback.aidl @@ -36,7 +36,7 @@ package android.hardware.gnss.measurement_corrections; @VintfStability interface IMeasurementCorrectionsCallback { void setCapabilitiesCb(in int capabilities); - const int CAPABILITY_LOS_SATS = 1; - const int CAPABILITY_EXCESS_PATH_LENGTH = 2; - const int CAPABILITY_REFLECTING_PLANE = 4; + const int CAPABILITY_LOS_SATS = (1 << 0) /* 1 */; + const int CAPABILITY_EXCESS_PATH_LENGTH = (1 << 1) /* 2 */; + const int CAPABILITY_REFLECTING_PLANE = (1 << 2) /* 4 */; } diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/measurement_corrections/SingleSatCorrection.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/measurement_corrections/SingleSatCorrection.aidl index ebbe6846e95fd1bdb12c5cb456c3c1d80d021775..72d32e434c1515b46aa89c19447ae6cb1bfae236 100644 --- a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/measurement_corrections/SingleSatCorrection.aidl +++ b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/measurement_corrections/SingleSatCorrection.aidl @@ -44,10 +44,10 @@ parcelable SingleSatCorrection { float combinedExcessPathLengthUncertaintyMeters; float combinedAttenuationDb; android.hardware.gnss.measurement_corrections.SingleSatCorrection.ExcessPathInfo[] excessPathInfos; - const int SINGLE_SAT_CORRECTION_HAS_SAT_IS_LOS_PROBABILITY = 1; - const int SINGLE_SAT_CORRECTION_HAS_COMBINED_EXCESS_PATH_LENGTH = 2; - const int SINGLE_SAT_CORRECTION_HAS_COMBINED_EXCESS_PATH_LENGTH_UNC = 4; - const int SINGLE_SAT_CORRECTION_HAS_COMBINED_ATTENUATION = 16; + const int SINGLE_SAT_CORRECTION_HAS_SAT_IS_LOS_PROBABILITY = 0x0001; + const int SINGLE_SAT_CORRECTION_HAS_COMBINED_EXCESS_PATH_LENGTH = 0x0002; + const int SINGLE_SAT_CORRECTION_HAS_COMBINED_EXCESS_PATH_LENGTH_UNC = 0x0004; + const int SINGLE_SAT_CORRECTION_HAS_COMBINED_ATTENUATION = 0x0010; @VintfStability parcelable ExcessPathInfo { int excessPathInfoFlags; @@ -55,9 +55,9 @@ parcelable SingleSatCorrection { float excessPathLengthUncertaintyMeters; android.hardware.gnss.measurement_corrections.ReflectingPlane reflectingPlane; float attenuationDb; - const int EXCESS_PATH_INFO_HAS_EXCESS_PATH_LENGTH = 1; - const int EXCESS_PATH_INFO_HAS_EXCESS_PATH_LENGTH_UNC = 2; - const int EXCESS_PATH_INFO_HAS_REFLECTING_PLANE = 4; - const int EXCESS_PATH_INFO_HAS_ATTENUATION = 8; + const int EXCESS_PATH_INFO_HAS_EXCESS_PATH_LENGTH = 0x0001; + const int EXCESS_PATH_INFO_HAS_EXCESS_PATH_LENGTH_UNC = 0x0002; + const int EXCESS_PATH_INFO_HAS_REFLECTING_PLANE = 0x0004; + const int EXCESS_PATH_INFO_HAS_ATTENUATION = 0x0008; } } diff --git a/gnss/aidl/android/hardware/gnss/GnssSignalType.aidl b/gnss/aidl/android/hardware/gnss/GnssSignalType.aidl index 241971fe9316e426725a9747e9f90811fac4c101..69de750eca901016eb318753d732b6392dde0909 100644 --- a/gnss/aidl/android/hardware/gnss/GnssSignalType.aidl +++ b/gnss/aidl/android/hardware/gnss/GnssSignalType.aidl @@ -46,26 +46,36 @@ parcelable GnssSignalType { double carrierFrequencyHz; /** - * GNSS signal code type "A" representing GALILEO E1A, GALILEO E6A, IRNSS L5A, IRNSS SA. + * GNSS signal code type "A" representing GALILEO E1A, GALILEO E6A, NavIC L5A SPS, NavIC SA SPS, + * GLONASS G1a L1OCd, GLONASS G2a L2CSI. */ const @utf8InCpp String CODE_TYPE_A = "A"; /** - * GNSS signal code type "B" representing GALILEO E1B, GALILEO E6B, IRNSS L5B, IRNSS SB. + * GNSS signal code type "B" representing GALILEO E1B, GALILEO E6B, NavIC L5B RS (D), + * NavIC SB RS (D), GLONASS G1a L1OCp, GLONASS G2a L2OCp, QZSS L1Sb. */ const @utf8InCpp String CODE_TYPE_B = "B"; /** * GNSS signal code type "C" representing GPS L1 C/A, GPS L2 C/A, GLONASS G1 C/A, - * GLONASS G2 C/A, GALILEO E1C, GALILEO E6C, SBAS L1 C/A, QZSS L1 C/A, IRNSS L5C. + * GLONASS G2 C/A, GALILEO E1C, GALILEO E6C, SBAS L1 C/A, QZSS L1 C/A, NavIC L5C RS (P), + * NavIC SC RS (P). */ const @utf8InCpp String CODE_TYPE_C = "C"; /** - * GNSS signal code type "D" representing BDS B1C D. + * GNSS signal code type "D" representing GPS L2 (L1(C/A) + (P2-P1) (semi-codeless)), + * QZSS L5S(I), BDS B1C Data, BDS B2a Data, BDS B2b Data, BDS B2 (B2a+B2b) Data, BDS B3a Data, + * NavIC L1 Data. */ const @utf8InCpp String CODE_TYPE_D = "D"; + /** + * GNSS signal code type "E" representing QZSS L1 C/B, QZSS L6E. + */ + const @utf8InCpp String CODE_TYPE_E = "E"; + /** * GNSS signal code type "I" representing GPS L5 I, GLONASS G3 I, GALILEO E5a I, GALILEO E5b I, * GALILEO E5a+b I, SBAS L5 I, QZSS L5 I, BDS B1 I, BDS B2 I, BDS B3 I. @@ -74,7 +84,7 @@ parcelable GnssSignalType { /** * GNSS signal code type "L" representing GPS L1C (P), GPS L2C (L), QZSS L1C (P), QZSS L2C (L), - * LEX(6) L. + * QZSS L6P, BDS B1a Pilot. */ const @utf8InCpp String CODE_TYPE_L = "L"; @@ -89,7 +99,9 @@ parcelable GnssSignalType { const @utf8InCpp String CODE_TYPE_N = "N"; /** - * GNSS signal code type "P" representing GPS L1P, GPS L2P, GLONASS G1P, GLONASS G2P, BDS B1C P. + * GNSS signal code type "P" representing GPS L1P, GPS L2P, GLONASS G1P, GLONASS G2P, + * BDS B1C Pilot, BDS B2a Pilot, BDS B2b Pilot, BDS B2 (B2a+B2b) Pilot, BDS B3a Pilot, + * QZSS L5S(Q), NavIC L1 Pilot. */ const @utf8InCpp String CODE_TYPE_P = "P"; @@ -101,7 +113,7 @@ parcelable GnssSignalType { /** * GNSS signal code type "S" represents GPS L1C (D), GPS L2C (M), QZSS L1C (D), QZSS L2C (M), - * LEX(6) S. + * QZSS L6D, BDS B1a Data. */ const @utf8InCpp String CODE_TYPE_S = "S"; @@ -112,9 +124,11 @@ parcelable GnssSignalType { /** * GNSS signal code type "X" representing GPS L1C (D+P), GPS L2C (M+L), GPS L5 (I+Q), - * GLONASS G3 (I+Q), GALILEO E1 (B+C), GALILEO E5a (I+Q), GALILEO E5b (I+Q), GALILEO E5a+b(I+Q), - * GALILEO E6 (B+C), SBAS L5 (I+Q), QZSS L1C (D+P), QZSS L2C (M+L), QZSS L5 (I+Q), - * LEX(6) (S+L), BDS B1 (I+Q), BDS B1C (D+P), BDS B2 (I+Q), BDS B3 (I+Q), IRNSS L5 (B+C). + * GLONASS G1a L1OCd+L1OCp, GLONASS G2a L2CSI+L2OCp, GLONASS G3 (I+Q), GALILEO E1 (B+C), + * GALILEO E5a (I+Q), GALILEO E5b (I+Q), GALILEO E5a+b (I+Q), GALILEO E6 (B+C), SBAS L5 (I+Q), + * QZSS L1C (D+P), QZSS L2C (M+L), QZSS L5 (I+Q), QZSS L6 (D+P), BDS B1 (I+Q), + * BDS B1C Data+Pilot, BDS B2a Data+Pilot, BDS B2 (I+Q), BDS B2 (B2a+B2b) Data+Pilot, + * BDS B3 (I+Q), NavIC L5 (B+C), NavIC S (B+C), NavIC L1 Data+Pilot. */ const @utf8InCpp String CODE_TYPE_X = "X"; @@ -124,7 +138,9 @@ parcelable GnssSignalType { const @utf8InCpp String CODE_TYPE_Y = "Y"; /** - * GNSS signal code type "Z" representing GALILEO E1 (A+B+C), GALILEO E6 (A+B+C), QZSS L1-SAIF. + * GNSS signal code type "Z" representing GALILEO E1 (A+B+C), GALILEO E6 (A+B+C), + * QZSS L1S/L1-SAIF, QZSS L5S (I+Q), QZSS L6 (D+E), BDS B1A Data+Pilot, BDS B2b Data+Pilot, + * BDS B3a Data+Pilot. */ const @utf8InCpp String CODE_TYPE_Z = "Z"; @@ -142,10 +158,11 @@ parcelable GnssSignalType { * The value is one of the constant Strings with prefix CODE_TYPE_ defined in this parcelable. * * This is used to specify the observation descriptor defined in GNSS Observation Data File - * Header Section Description in the RINEX standard (Version 3.XX). In RINEX Version 3.03, - * in Appendix Table A2 Attributes are listed as uppercase letters (for instance, "A" for - * "A channel"). In the future, if for instance a code "G" was added in the official RINEX - * standard, "G" could be specified here. + * Header Section Description in the RINEX standard (Version 4.00) e.g., in Tables 9-16 (see + * https://igs.org/wg/rinex/#documents-formats). In cases where the code type does not align + * with the above listed values, the code type from the most recent version of RINEX should be + * used. In the future, if for instance a code "G" was added in the official RINEX standard, + * "G" could be specified here. */ @utf8InCpp String codeType; } diff --git a/gnss/aidl/android/hardware/gnss/IGnss.aidl b/gnss/aidl/android/hardware/gnss/IGnss.aidl index aaafe7f583d5a5c88a7bf2d0989ad7e013e55ff8..8a22d6e67f7e53ff1552daf5f1b084bf5b49ec89 100644 --- a/gnss/aidl/android/hardware/gnss/IGnss.aidl +++ b/gnss/aidl/android/hardware/gnss/IGnss.aidl @@ -217,6 +217,10 @@ interface IGnss { * Starts a location output stream using the IGnssCallback gnssLocationCb(), following the * settings from the most recent call to setPositionMode(). * + * When a location output stream is in progress, calling setPositionMode() does not change the + * settings of the current location output stream. stop() and start() must be called to make the + * new settings effective. + * * This output must operate independently of any GNSS location batching operations, * see the IGnssBatching for details. */ @@ -306,6 +310,10 @@ interface IGnss { /** * Sets the GnssPositionMode parameter, its associated recurrence value, the time between fixes, * requested fix accuracy, time to first fix. + * + * If a location output stream is in progress, calling this method does not affect the settings + * of current location output stream. stop() and start() must be called to make the new settings + * effective. */ void setPositionMode(in PositionModeOptions options); diff --git a/gnss/aidl/android/hardware/gnss/IGnssNavigationMessageCallback.aidl b/gnss/aidl/android/hardware/gnss/IGnssNavigationMessageCallback.aidl index 6990e19ff65045bb074568fc474882aa22ddd828..b224b0ba0993be483c29736f1d1134827ea3df9d 100644 --- a/gnss/aidl/android/hardware/gnss/IGnssNavigationMessageCallback.aidl +++ b/gnss/aidl/android/hardware/gnss/IGnssNavigationMessageCallback.aidl @@ -100,8 +100,17 @@ interface IGnssNavigationMessageCallback { /** Galileo F/NAV message contained in the structure. */ GAL_F = 0x0602, - /** IRNSS L5 C/A message contained in the structure. */ + /** + * NavIC L5 C/A message contained in the structure. + * @deprecated Use IRN_L5 instead. + */ IRN_L5CA = 0x0701, + + /** NavIC L5 message contained in the structure. */ + IRN_L5 = 0x0702, + + /** NavIC L1 message contained in the structure. */ + IRN_L1 = 0x0703, } /** @@ -156,9 +165,12 @@ interface IGnssNavigationMessageCallback { * * - For Beidou CNAV1 this refers to the page type number in the range of 1-63. * - * - For IRNSS L5 C/A subframe 3 and 4, this value corresponds to the Message Id of the + * - For NavIC L5 subframe 3 and 4, this value corresponds to the Message Id of the * navigation message, in the range of 1-63. (Subframe 1 and 2 does not contain a message * type id and this value can be set to -1.) + * - For NavIC L1 subframe 3, this value corresponds to the Message Id of the navigation + * message, in the range of 1-63. (Subframe 1 and 2 does not contain a message type id and + * this value can be set to -1.) */ int messageId; @@ -187,8 +199,10 @@ interface IGnssNavigationMessageCallback { * * - For Beidou CNAV2, the submessage id corresponds to the message type, in the range 1-63. * - * - For IRNSS L5 C/A, the submessage id corresponds to the subframe number of the - * navigation message, in the range of 1-4. + * - For NavIC L5, the submessage id corresponds to the subframe number of the navigation + * message, in the range of 1-4. + * - For NavIC L1, the submessage id corresponds to the subframe number of the navigation + * message, in the range of 1-3. */ int submessageId; @@ -196,7 +210,7 @@ interface IGnssNavigationMessageCallback { * The data of the reported GNSS message. The bytes (or words) are specified * using big endian format (MSB first). * - * - For GNSS L1 C/A, Beidou D1 & Beidou D2, each subframe contains 10 30-bit + * - For GNSS L1 C/A, NavIC L5, Beidou D1 & Beidou D2, each subframe contains 10 30-bit * words. Each word (30 bits) must fit into the last 30 bits in a * 4-byte word (skip B31 and B32), with MSB first, for a total of 40 * bytes, covering a time period of 6, 6, and 0.6 seconds, respectively. @@ -228,6 +242,10 @@ interface IGnssNavigationMessageCallback { * - For Beidou CNAV2, each subframe consists of 288 data bits, that should be fit into 36 * bytes. * + * - For NavIC L1, subframe #1 consists of 9 data bits that should be fit into 2 bytes (skip + * B10-B16). subframe #2 consists of 600 bits that should be fit into 75 bytes. subframe + * #3 consists of 274 data bits that should be fit into 35 bytes (skip B275-B280). + * * The data reported here must be the raw data as demodulated by the GNSS receiver, not data * received from an external source (i.e. not from a server download.) */ diff --git a/gnss/aidl/default/Android.bp b/gnss/aidl/default/Android.bp index 731092271df8e365c9ccadf4f8fb0a25eae16e77..822e8fc882b7af45eebffe643849a6891b620d63 100644 --- a/gnss/aidl/default/Android.bp +++ b/gnss/aidl/default/Android.bp @@ -45,7 +45,7 @@ cc_binary { "android.hardware.gnss.measurement_corrections@1.1", "android.hardware.gnss.measurement_corrections@1.0", "android.hardware.gnss.visibility_control@1.0", - "android.hardware.gnss-V3-ndk", + "android.hardware.gnss-V4-ndk", ], srcs: [ "AGnssRil.cpp", diff --git a/gnss/aidl/default/Gnss.cpp b/gnss/aidl/default/Gnss.cpp index f1b9cbfd3f6a4abc4e6b1422aeb25d208455c329..c31f991b9d81429a095687d5c589c32f9b39e126 100644 --- a/gnss/aidl/default/Gnss.cpp +++ b/gnss/aidl/default/Gnss.cpp @@ -115,7 +115,9 @@ ScopedAStatus Gnss::start() { mGnssMeasurementInterface->setLocationEnabled(true); this->reportGnssStatusValue(IGnssCallback::GnssStatusValue::SESSION_BEGIN); mThread = std::thread([this]() { - this->reportSvStatus(); + if (!mGnssMeasurementEnabled || mMinIntervalMs <= mGnssMeasurementIntervalMs) { + this->reportSvStatus(); + } if (!mFirstFixReceived) { std::this_thread::sleep_for(std::chrono::milliseconds(TTFF_MILLIS)); mFirstFixReceived = true; @@ -124,7 +126,9 @@ ScopedAStatus Gnss::start() { if (!mIsActive) { break; } - this->reportSvStatus(); + if (!mGnssMeasurementEnabled || mMinIntervalMs <= mGnssMeasurementIntervalMs) { + this->reportSvStatus(); + } this->reportNmea(); auto currentLocation = getLocationFromHW(); @@ -386,4 +390,12 @@ ndk::ScopedAStatus Gnss::getExtensionMeasurementCorrections( return ndk::ScopedAStatus::ok(); } +void Gnss::setGnssMeasurementEnabled(const bool enabled) { + mGnssMeasurementEnabled = enabled; +} + +void Gnss::setGnssMeasurementInterval(const long intervalMs) { + mGnssMeasurementIntervalMs = intervalMs; +} + } // namespace aidl::android::hardware::gnss diff --git a/gnss/aidl/default/Gnss.h b/gnss/aidl/default/Gnss.h index 00540cd62b70211097b25d3401ac95fc06a2e494..245d60785fa2fc05309ee6132c95ebde40c3a684 100644 --- a/gnss/aidl/default/Gnss.h +++ b/gnss/aidl/default/Gnss.h @@ -85,6 +85,8 @@ class Gnss : public BnGnss { override; void reportSvStatus() const; + void setGnssMeasurementEnabled(const bool enabled); + void setGnssMeasurementInterval(const long intervalMs); std::shared_ptr mGnssConfiguration; std::shared_ptr mGnssPowerIndication; std::shared_ptr mGnssMeasurementInterface; @@ -101,10 +103,12 @@ class Gnss : public BnGnss { static std::shared_ptr sGnssCallback; std::atomic mMinIntervalMs; + std::atomic mGnssMeasurementIntervalMs; std::atomic mIsActive; std::atomic mIsSvStatusActive; std::atomic mIsNmeaActive; std::atomic mFirstFixReceived; + std::atomic mGnssMeasurementEnabled; std::thread mThread; ::android::hardware::gnss::common::ThreadBlocker mThreadBlocker; diff --git a/gnss/aidl/default/GnssMeasurementInterface.cpp b/gnss/aidl/default/GnssMeasurementInterface.cpp index aab9e038d0b31957f6ec9fd620609342bb82b950..f3242138cbe900a25f1b6feff836804e2e7f97f7 100644 --- a/gnss/aidl/default/GnssMeasurementInterface.cpp +++ b/gnss/aidl/default/GnssMeasurementInterface.cpp @@ -35,7 +35,9 @@ using DeviceFileReader = ::android::hardware::gnss::common::DeviceFileReader; std::shared_ptr GnssMeasurementInterface::sCallback = nullptr; GnssMeasurementInterface::GnssMeasurementInterface() - : mIntervalMs(1000), mLocationIntervalMs(1000), mFutures(std::vector>()) {} + : mIntervalMs(1000), mLocationIntervalMs(1000) { + mThreads.reserve(2); +} GnssMeasurementInterface::~GnssMeasurementInterface() { waitForStoppingThreads(); @@ -74,6 +76,7 @@ ndk::ScopedAStatus GnssMeasurementInterface::setCallbackWithOptions( stop(); } mIntervalMs = std::max(options.intervalMs, 1000); + mGnss->setGnssMeasurementInterval(mIntervalMs); start(options.enableCorrVecOutputs, options.enableFullTracking); return ndk::ScopedAStatus::ok(); @@ -100,12 +103,13 @@ void GnssMeasurementInterface::start(const bool enableCorrVecOutputs, ALOGD("restarting since measurement has started"); stop(); } - // Wait for stopping previous thread. - waitForStoppingThreads(); mIsActive = true; - mThreadBlocker.reset(); - mThread = std::thread([this, enableCorrVecOutputs, enableFullTracking]() { + mGnss->setGnssMeasurementEnabled(true); + mThreads.emplace_back(std::thread([this, enableCorrVecOutputs, enableFullTracking]() { + waitForStoppingThreads(); + mThreadBlocker.reset(); + int intervalMs; do { if (!mIsActive) { @@ -127,22 +131,30 @@ void GnssMeasurementInterface::start(const bool enableCorrVecOutputs, auto measurement = Utils::getMockMeasurement(enableCorrVecOutputs, enableFullTracking); this->reportMeasurement(measurement); - if (!mLocationEnabled) { + if (!mLocationEnabled || mLocationIntervalMs > mIntervalMs) { mGnss->reportSvStatus(); } } intervalMs = (mLocationEnabled) ? std::min(mLocationIntervalMs, mIntervalMs) : mIntervalMs; } while (mIsActive && mThreadBlocker.wait_for(std::chrono::milliseconds(intervalMs))); - }); + })); } void GnssMeasurementInterface::stop() { ALOGD("stop"); mIsActive = false; + mGnss->setGnssMeasurementEnabled(false); mThreadBlocker.notify(); - if (mThread.joinable()) { - mFutures.push_back(std::async(std::launch::async, [this] { mThread.join(); })); + for (auto iter = mThreads.begin(); iter != mThreads.end(); ++iter) { + if (iter->joinable()) { + mFutures.push_back(std::async(std::launch::async, [this, iter] { + iter->join(); + mThreads.erase(iter); + })); + } else { + mThreads.erase(iter); + } } } diff --git a/gnss/aidl/default/GnssMeasurementInterface.h b/gnss/aidl/default/GnssMeasurementInterface.h index 926a4e759b5267edc24048b1e551aec87a888256..ea07c9a696f25e7fc594a9aa83f81df578c1cdba 100644 --- a/gnss/aidl/default/GnssMeasurementInterface.h +++ b/gnss/aidl/default/GnssMeasurementInterface.h @@ -52,7 +52,7 @@ struct GnssMeasurementInterface : public BnGnssMeasurementInterface { std::atomic mLocationIntervalMs; std::atomic mIsActive; std::atomic mLocationEnabled; - std::thread mThread; + std::vector mThreads; std::vector> mFutures; ::android::hardware::gnss::common::ThreadBlocker mThreadBlocker; diff --git a/gnss/aidl/default/GnssNavigationMessageInterface.cpp b/gnss/aidl/default/GnssNavigationMessageInterface.cpp index 75b962452a635feb7481dc0967ad6ce9c32ffcb8..c262dc6b88541524318d6c57a6641b064cc2d545 100644 --- a/gnss/aidl/default/GnssNavigationMessageInterface.cpp +++ b/gnss/aidl/default/GnssNavigationMessageInterface.cpp @@ -29,7 +29,9 @@ using GnssNavigationMessageType = GnssNavigationMessage::GnssNavigationMessageTy std::shared_ptr GnssNavigationMessageInterface::sCallback = nullptr; -GnssNavigationMessageInterface::GnssNavigationMessageInterface() : mMinIntervalMillis(1000) {} +GnssNavigationMessageInterface::GnssNavigationMessageInterface() : mMinIntervalMillis(1000) { + mThreads.reserve(2); +} GnssNavigationMessageInterface::~GnssNavigationMessageInterface() { waitForStoppingThreads(); @@ -61,11 +63,11 @@ void GnssNavigationMessageInterface::start() { ALOGD("restarting since nav msg has started"); stop(); } - // Wait for stopping previous thread. - waitForStoppingThreads(); mIsActive = true; - mThread = std::thread([this]() { + mThreads.emplace_back(std::thread([this]() { + waitForStoppingThreads(); + mThreadBlocker.reset(); do { if (!mIsActive) { break; @@ -81,15 +83,22 @@ void GnssNavigationMessageInterface::start() { this->reportMessage(message); } while (mIsActive && mThreadBlocker.wait_for(std::chrono::milliseconds(mMinIntervalMillis))); - }); + })); } void GnssNavigationMessageInterface::stop() { ALOGD("stop"); mIsActive = false; mThreadBlocker.notify(); - if (mThread.joinable()) { - mFutures.push_back(std::async(std::launch::async, [this] { mThread.join(); })); + for (auto iter = mThreads.begin(); iter != mThreads.end(); ++iter) { + if (iter->joinable()) { + mFutures.push_back(std::async(std::launch::async, [this, iter] { + iter->join(); + mThreads.erase(iter); + })); + } else { + mThreads.erase(iter); + } } } diff --git a/gnss/aidl/default/GnssNavigationMessageInterface.h b/gnss/aidl/default/GnssNavigationMessageInterface.h index b3353480f4c00fbb028673c3e48550d1560e4b42..e9a753635757c0fc77100848f5a980f376d67d46 100644 --- a/gnss/aidl/default/GnssNavigationMessageInterface.h +++ b/gnss/aidl/default/GnssNavigationMessageInterface.h @@ -40,7 +40,7 @@ struct GnssNavigationMessageInterface : public BnGnssNavigationMessageInterface std::atomic mMinIntervalMillis; std::atomic mIsActive; - std::thread mThread; + std::vector mThreads; std::vector> mFutures; ::android::hardware::gnss::common::ThreadBlocker mThreadBlocker; diff --git a/gnss/aidl/default/gnss-default.xml b/gnss/aidl/default/gnss-default.xml index 73b841e479a23c59028d63ba845c8dda20c80a3e..c01069e4fe02ddf1ee68949e59394dde8f2f4ef9 100644 --- a/gnss/aidl/default/gnss-default.xml +++ b/gnss/aidl/default/gnss-default.xml @@ -1,7 +1,7 @@ android.hardware.gnss - 3 + 4 IGnss default diff --git a/gnss/aidl/vts/Android.bp b/gnss/aidl/vts/Android.bp index 2a09a5686608a2eecd62ab59f1b1b88476f945e4..fd1d853bc27e83f3e0f95a3f7b4ef57a35fc745a 100644 --- a/gnss/aidl/vts/Android.bp +++ b/gnss/aidl/vts/Android.bp @@ -51,7 +51,7 @@ cc_test { "libbinder", ], static_libs: [ - "android.hardware.gnss-V3-cpp", + "android.hardware.gnss-V4-cpp", "android.hardware.gnss@common-vts-lib", ], test_suites: [ diff --git a/gnss/aidl/vts/gnss_hal_test_cases.cpp b/gnss/aidl/vts/gnss_hal_test_cases.cpp index aa8bdfdf16935d5e39a63be1361fb3f0585022d1..9381a0a12e26a50954811b10df4232dfa946c955 100644 --- a/gnss/aidl/vts/gnss_hal_test_cases.cpp +++ b/gnss/aidl/vts/gnss_hal_test_cases.cpp @@ -1430,13 +1430,13 @@ TEST_P(GnssHalTest, TestGnssMeasurementIntervals_WithoutLocation) { startMeasurementWithInterval(intervals[i], iGnssMeasurement, callback); std::vector measurementDeltas; - std::vector svInfoListTimestampsDeltas; + std::vector svInfoListDeltas; collectMeasurementIntervals(callback, numEvents[i], /* timeoutSeconds= */ 10, measurementDeltas); if (aidl_gnss_hal_->getInterfaceVersion() >= 3) { - collectSvInfoListTimestamps(numEvents[i], /* timeoutSeconds= */ 10, - svInfoListTimestampsDeltas); + collectSvInfoListTimestamps(numEvents[i], /* timeoutSeconds= */ 10, svInfoListDeltas); + EXPECT_TRUE(aidl_gnss_cb_->sv_info_list_cbq_.size() > 0); } status = iGnssMeasurement->close(); ASSERT_TRUE(status.isOk()); @@ -1444,8 +1444,7 @@ TEST_P(GnssHalTest, TestGnssMeasurementIntervals_WithoutLocation) { assertMeanAndStdev(intervals[i], measurementDeltas); if (aidl_gnss_hal_->getInterfaceVersion() >= 3) { - assertMeanAndStdev(intervals[i], svInfoListTimestampsDeltas); - EXPECT_TRUE(aidl_gnss_cb_->sv_info_list_cbq_.size() > 0); + assertMeanAndStdev(intervals[i], svInfoListDeltas); } } } @@ -1477,13 +1476,25 @@ TEST_P(GnssHalTest, TestGnssMeasurementIntervals_LocationOnBeforeMeasurement) { auto callback = sp::make(); startMeasurementWithInterval(intervalMs, iGnssMeasurement, callback); - std::vector deltas; - collectMeasurementIntervals(callback, /*numEvents=*/10, /*timeoutSeconds=*/10, deltas); + std::vector measurementDeltas; + std::vector svInfoListDeltas; + + collectMeasurementIntervals(callback, /*numEvents=*/10, /*timeoutSeconds=*/10, + measurementDeltas); + if (aidl_gnss_hal_->getInterfaceVersion() >= 3) { + collectSvInfoListTimestamps(/*numEvents=*/10, /* timeoutSeconds= */ 10, + svInfoListDeltas); + EXPECT_TRUE(aidl_gnss_cb_->sv_info_list_cbq_.size() > 0); + } status = iGnssMeasurement->close(); ASSERT_TRUE(status.isOk()); - assertMeanAndStdev(locationIntervalMs, deltas); + assertMeanAndStdev(locationIntervalMs, measurementDeltas); + if (aidl_gnss_hal_->getInterfaceVersion() >= 3) { + // Verify the SvStatus interval is 1s (not 2s) + assertMeanAndStdev(locationIntervalMs, svInfoListDeltas); + } } StopAndClearLocations(); } @@ -1516,16 +1527,37 @@ TEST_P(GnssHalTest, TestGnssMeasurementIntervals_LocationOnAfterMeasurement) { // Start location and verify the measurements are received at 1Hz StartAndCheckFirstLocation(locationIntervalMs, /* lowPowerMode= */ false); - std::vector deltas; - collectMeasurementIntervals(callback, /*numEvents=*/10, kFirstMeasTimeoutSec, deltas); - assertMeanAndStdev(locationIntervalMs, deltas); + std::vector measurementDeltas; + std::vector svInfoListDeltas; + collectMeasurementIntervals(callback, /*numEvents=*/10, kFirstMeasTimeoutSec, + measurementDeltas); + assertMeanAndStdev(locationIntervalMs, measurementDeltas); + if (aidl_gnss_hal_->getInterfaceVersion() >= 3) { + collectSvInfoListTimestamps(/*numEvents=*/10, /* timeoutSeconds= */ 10, + svInfoListDeltas); + EXPECT_TRUE(aidl_gnss_cb_->sv_info_list_cbq_.size() > 0); + // Verify the SvStatus intervals are at 1s interval + assertMeanAndStdev(locationIntervalMs, svInfoListDeltas); + } // Stop location request and verify the measurements are received at 2s intervals StopAndClearLocations(); - callback->gnss_data_cbq_.reset(); - deltas.clear(); - collectMeasurementIntervals(callback, /*numEvents=*/5, kFirstMeasTimeoutSec, deltas); - assertMeanAndStdev(intervalMs, deltas); + measurementDeltas.clear(); + collectMeasurementIntervals(callback, /*numEvents=*/5, kFirstMeasTimeoutSec, + measurementDeltas); + assertMeanAndStdev(intervalMs, measurementDeltas); + + if (aidl_gnss_hal_->getInterfaceVersion() >= 3) { + svInfoListDeltas.clear(); + collectSvInfoListTimestamps(/*numEvents=*/5, /* timeoutSeconds= */ 10, + svInfoListDeltas); + EXPECT_TRUE(aidl_gnss_cb_->sv_info_list_cbq_.size() > 0); + // Verify the SvStatus intervals are at 2s interval + for (const int& delta : svInfoListDeltas) { + ALOGD("svInfoListDelta: %d", delta); + } + assertMeanAndStdev(intervalMs, svInfoListDeltas); + } status = iGnssMeasurement->close(); ASSERT_TRUE(status.isOk()); @@ -1587,8 +1619,7 @@ TEST_P(GnssHalTest, TestGnssMeasurementIntervals_changeIntervals) { * TestGnssMeasurementIsFullTracking * 1. Start measurement with enableFullTracking=true. Verify the received measurements have * isFullTracking=true. - * 2. Start measurement with enableFullTracking = false. Verify the received measurements have - * isFullTracking=false. + * 2. Start measurement with enableFullTracking = false. * 3. Do step 1 again. */ TEST_P(GnssHalTest, TestGnssMeasurementIsFullTracking) { @@ -1675,4 +1706,59 @@ TEST_P(GnssHalTest, TestAccumulatedDeltaRange) { ASSERT_TRUE(accumulatedDeltaRangeFound); status = iGnssMeasurement->close(); ASSERT_TRUE(status.isOk()); -} \ No newline at end of file +} + +/* + * TestSvStatusIntervals: + * 1. start measurement and location with various intervals + * 2. verify the SvStatus are received at expected interval + */ +TEST_P(GnssHalTest, TestSvStatusIntervals) { + if (aidl_gnss_hal_->getInterfaceVersion() <= 2) { + return; + } + ALOGD("TestSvStatusIntervals"); + sp iGnssMeasurement; + auto status = aidl_gnss_hal_->getExtensionGnssMeasurement(&iGnssMeasurement); + ASSERT_TRUE(status.isOk()); + ASSERT_TRUE(iGnssMeasurement != nullptr); + + std::vector locationIntervals{1000, 2000, INT_MAX}; + std::vector measurementIntervals{1000, 2000, INT_MAX}; + + for (auto& locationIntervalMs : locationIntervals) { + for (auto& measurementIntervalMs : measurementIntervals) { + if (locationIntervalMs == INT_MAX && measurementIntervalMs == INT_MAX) { + continue; + } + auto measurementCallback = sp::make(); + // Start measurement + if (measurementIntervalMs < INT_MAX) { + startMeasurementWithInterval(measurementIntervalMs, iGnssMeasurement, + measurementCallback); + } + // Start location + if (locationIntervalMs < INT_MAX) { + StartAndCheckFirstLocation(locationIntervalMs, /* lowPowerMode= */ false); + } + ALOGD("location@%d(ms), measurement@%d(ms)", locationIntervalMs, measurementIntervalMs); + std::vector svInfoListDeltas; + collectSvInfoListTimestamps(/*numEvents=*/5, /* timeoutSeconds= */ 10, + svInfoListDeltas); + EXPECT_TRUE(aidl_gnss_cb_->sv_info_list_cbq_.size() > 0); + + int svStatusInterval = std::min(locationIntervalMs, measurementIntervalMs); + assertMeanAndStdev(svStatusInterval, svInfoListDeltas); + + if (locationIntervalMs < INT_MAX) { + // Stop location request + StopAndClearLocations(); + } + if (measurementIntervalMs < INT_MAX) { + // Stop measurement request + status = iGnssMeasurement->close(); + ASSERT_TRUE(status.isOk()); + } + } + } +} diff --git a/gnss/common/utils/default/Android.bp b/gnss/common/utils/default/Android.bp index 4cf17a66cd0bfcd820546eb7e186aabcb03e1c99..208bc593f36a97012baf1a94c1ff32e05ac7bdca 100644 --- a/gnss/common/utils/default/Android.bp +++ b/gnss/common/utils/default/Android.bp @@ -57,6 +57,6 @@ cc_library_static { "android.hardware.gnss@2.1", "android.hardware.gnss.measurement_corrections@1.1", "android.hardware.gnss.measurement_corrections@1.0", - "android.hardware.gnss-V3-ndk", + "android.hardware.gnss-V4-ndk", ], } diff --git a/gnss/common/utils/vts/Android.bp b/gnss/common/utils/vts/Android.bp index b5325b2881e3c181d3e42cd1dc911c8803a38e59..ed5674cf99e89a1d7201cb9129777776547b021d 100644 --- a/gnss/common/utils/vts/Android.bp +++ b/gnss/common/utils/vts/Android.bp @@ -44,7 +44,7 @@ cc_library_static { "android.hardware.gnss@2.1", "android.hardware.gnss.measurement_corrections@1.0", "android.hardware.gnss.measurement_corrections@1.1", - "android.hardware.gnss-V3-cpp", + "android.hardware.gnss-V4-cpp", ], static_libs: [ "libgtest", diff --git a/graphics/Android.bp b/graphics/Android.bp index 2fbcb41c47517f5ae35607abebb320945b6d620c..cae5292752ea05015db8e8c6f8df066bc8daee74 100644 --- a/graphics/Android.bp +++ b/graphics/Android.bp @@ -39,27 +39,27 @@ cc_defaults { cc_defaults { name: "android.hardware.graphics.common-ndk_static", static_libs: [ - "android.hardware.graphics.common-V4-ndk", + "android.hardware.graphics.common-V5-ndk", ], } cc_defaults { name: "android.hardware.graphics.common-ndk_shared", shared_libs: [ - "android.hardware.graphics.common-V4-ndk", + "android.hardware.graphics.common-V5-ndk", ], } cc_defaults { name: "android.hardware.graphics.composer3-ndk_static", static_libs: [ - "android.hardware.graphics.composer3-V2-ndk", + "android.hardware.graphics.composer3-V3-ndk", ], } cc_defaults { name: "android.hardware.graphics.composer3-ndk_shared", shared_libs: [ - "android.hardware.graphics.composer3-V2-ndk", + "android.hardware.graphics.composer3-V3-ndk", ], } diff --git a/graphics/allocator/aidl/Android.bp b/graphics/allocator/aidl/Android.bp index a3a2c554ca9bd9a735e7654efe3f155dec255dff..03628b058be5acb6cf0eeff1ff2ba67dca4e5fe4 100644 --- a/graphics/allocator/aidl/Android.bp +++ b/graphics/allocator/aidl/Android.bp @@ -18,7 +18,7 @@ aidl_interface { srcs: ["android/hardware/graphics/allocator/*.aidl"], imports: [ "android.hardware.common-V2", - "android.hardware.graphics.common-V4", + "android.hardware.graphics.common-V5", ], stability: "vintf", backend: { @@ -49,7 +49,7 @@ aidl_interface { version: "2", imports: [ "android.hardware.common-V2", - "android.hardware.graphics.common-V4", + "android.hardware.graphics.common-V5", ], }, diff --git a/graphics/common/aidl/Android.bp b/graphics/common/aidl/Android.bp index 02334e85c223b40910c4fff54e594f93187bc117..f177a41768a9017853e6ede36a003e34e36bd88a 100644 --- a/graphics/common/aidl/Android.bp +++ b/graphics/common/aidl/Android.bp @@ -15,7 +15,7 @@ aidl_interface { enabled: true, support_system_process: true, }, - vndk_use_version: "4", + vndk_use_version: "5", srcs: [ "android/hardware/graphics/common/*.aidl", ], @@ -43,7 +43,7 @@ aidl_interface { enabled: true, }, }, - frozen: true, + frozen: false, versions_with_info: [ { version: "1", diff --git a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/BufferUsage.aidl b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/BufferUsage.aidl index d3ab44f2ce2e07ddde44f566510256e8a100d8d9..d42a6d57b87e3455a7c8b18ec69a6c732f2fce6d 100644 --- a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/BufferUsage.aidl +++ b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/BufferUsage.aidl @@ -35,31 +35,31 @@ package android.hardware.graphics.common; /* @hide */ @Backing(type="long") @VintfStability enum BufferUsage { - CPU_READ_MASK = 15, + CPU_READ_MASK = 0xf, CPU_READ_NEVER = 0, CPU_READ_RARELY = 2, CPU_READ_OFTEN = 3, - CPU_WRITE_MASK = 240, - CPU_WRITE_NEVER = 0, - CPU_WRITE_RARELY = 32, - CPU_WRITE_OFTEN = 48, - GPU_TEXTURE = 256, - GPU_RENDER_TARGET = 512, - COMPOSER_OVERLAY = 2048, - COMPOSER_CLIENT_TARGET = 4096, - PROTECTED = 16384, - COMPOSER_CURSOR = 32768, - VIDEO_ENCODER = 65536, - CAMERA_OUTPUT = 131072, - CAMERA_INPUT = 262144, - RENDERSCRIPT = 1048576, - VIDEO_DECODER = 4194304, - SENSOR_DIRECT_DATA = 8388608, - GPU_DATA_BUFFER = 16777216, - GPU_CUBE_MAP = 33554432, - GPU_MIPMAP_COMPLETE = 67108864, - HW_IMAGE_ENCODER = 134217728, - FRONT_BUFFER = 4294967296, - VENDOR_MASK = -268435456, - VENDOR_MASK_HI = -281474976710656, + CPU_WRITE_MASK = (0xf << 4) /* 240 */, + CPU_WRITE_NEVER = (0 << 4) /* 0 */, + CPU_WRITE_RARELY = (2 << 4) /* 32 */, + CPU_WRITE_OFTEN = (3 << 4) /* 48 */, + GPU_TEXTURE = (1 << 8) /* 256 */, + GPU_RENDER_TARGET = (1 << 9) /* 512 */, + COMPOSER_OVERLAY = (1 << 11) /* 2048 */, + COMPOSER_CLIENT_TARGET = (1 << 12) /* 4096 */, + PROTECTED = (1 << 14) /* 16384 */, + COMPOSER_CURSOR = (1 << 15) /* 32768 */, + VIDEO_ENCODER = (1 << 16) /* 65536 */, + CAMERA_OUTPUT = (1 << 17) /* 131072 */, + CAMERA_INPUT = (1 << 18) /* 262144 */, + RENDERSCRIPT = (1 << 20) /* 1048576 */, + VIDEO_DECODER = (1 << 22) /* 4194304 */, + SENSOR_DIRECT_DATA = (1 << 23) /* 8388608 */, + GPU_DATA_BUFFER = (1 << 24) /* 16777216 */, + GPU_CUBE_MAP = (1 << 25) /* 33554432 */, + GPU_MIPMAP_COMPLETE = (1 << 26) /* 67108864 */, + HW_IMAGE_ENCODER = (1 << 27) /* 134217728 */, + FRONT_BUFFER = (1L << 32) /* 4294967296 */, + VENDOR_MASK = (0xf << 28) /* -268435456 */, + VENDOR_MASK_HI = ((1L * 0xffff) << 48) /* -281474976710656 */, } diff --git a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/ChromaSiting.aidl b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/ChromaSiting.aidl index b8af6446042719ea282d46f390700afff6c4a528..784fc1798a0f607f21e0f34306d54d8f0523bff8 100644 --- a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/ChromaSiting.aidl +++ b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/ChromaSiting.aidl @@ -39,4 +39,6 @@ enum ChromaSiting { UNKNOWN = 1, SITED_INTERSTITIAL = 2, COSITED_HORIZONTAL = 3, + COSITED_VERTICAL = 4, + COSITED_BOTH = 5, } diff --git a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/Dataspace.aidl b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/Dataspace.aidl index 563b6c1ac44abec190881919cadda5f967082112..6ed5bb2183efbbd2a46854070c1e0f0e369a6c2d 100644 --- a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/Dataspace.aidl +++ b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/Dataspace.aidl @@ -35,65 +35,67 @@ package android.hardware.graphics.common; /* @hide */ @Backing(type="int") @VintfStability enum Dataspace { - UNKNOWN = 0, - ARBITRARY = 1, + UNKNOWN = 0x0, + ARBITRARY = 0x1, STANDARD_SHIFT = 16, - STANDARD_MASK = 4128768, - STANDARD_UNSPECIFIED = 0, - STANDARD_BT709 = 65536, - STANDARD_BT601_625 = 131072, - STANDARD_BT601_625_UNADJUSTED = 196608, - STANDARD_BT601_525 = 262144, - STANDARD_BT601_525_UNADJUSTED = 327680, - STANDARD_BT2020 = 393216, - STANDARD_BT2020_CONSTANT_LUMINANCE = 458752, - STANDARD_BT470M = 524288, - STANDARD_FILM = 589824, - STANDARD_DCI_P3 = 655360, - STANDARD_ADOBE_RGB = 720896, + STANDARD_MASK = (63 << 16) /* 4128768 */, + STANDARD_UNSPECIFIED = (0 << 16) /* 0 */, + STANDARD_BT709 = (1 << 16) /* 65536 */, + STANDARD_BT601_625 = (2 << 16) /* 131072 */, + STANDARD_BT601_625_UNADJUSTED = (3 << 16) /* 196608 */, + STANDARD_BT601_525 = (4 << 16) /* 262144 */, + STANDARD_BT601_525_UNADJUSTED = (5 << 16) /* 327680 */, + STANDARD_BT2020 = (6 << 16) /* 393216 */, + STANDARD_BT2020_CONSTANT_LUMINANCE = (7 << 16) /* 458752 */, + STANDARD_BT470M = (8 << 16) /* 524288 */, + STANDARD_FILM = (9 << 16) /* 589824 */, + STANDARD_DCI_P3 = (10 << 16) /* 655360 */, + STANDARD_ADOBE_RGB = (11 << 16) /* 720896 */, TRANSFER_SHIFT = 22, - TRANSFER_MASK = 130023424, - TRANSFER_UNSPECIFIED = 0, - TRANSFER_LINEAR = 4194304, - TRANSFER_SRGB = 8388608, - TRANSFER_SMPTE_170M = 12582912, - TRANSFER_GAMMA2_2 = 16777216, - TRANSFER_GAMMA2_6 = 20971520, - TRANSFER_GAMMA2_8 = 25165824, - TRANSFER_ST2084 = 29360128, - TRANSFER_HLG = 33554432, + TRANSFER_MASK = (31 << 22) /* 130023424 */, + TRANSFER_UNSPECIFIED = (0 << 22) /* 0 */, + TRANSFER_LINEAR = (1 << 22) /* 4194304 */, + TRANSFER_SRGB = (2 << 22) /* 8388608 */, + TRANSFER_SMPTE_170M = (3 << 22) /* 12582912 */, + TRANSFER_GAMMA2_2 = (4 << 22) /* 16777216 */, + TRANSFER_GAMMA2_6 = (5 << 22) /* 20971520 */, + TRANSFER_GAMMA2_8 = (6 << 22) /* 25165824 */, + TRANSFER_ST2084 = (7 << 22) /* 29360128 */, + TRANSFER_HLG = (8 << 22) /* 33554432 */, RANGE_SHIFT = 27, - RANGE_MASK = 939524096, - RANGE_UNSPECIFIED = 0, - RANGE_FULL = 134217728, - RANGE_LIMITED = 268435456, - RANGE_EXTENDED = 402653184, - SRGB_LINEAR = 138477568, - SCRGB_LINEAR = 406913024, - SRGB = 142671872, - SCRGB = 411107328, - JFIF = 146931712, - BT601_625 = 281149440, - BT601_525 = 281280512, - BT709 = 281083904, - DCI_P3_LINEAR = 139067392, - DCI_P3 = 155844608, - DISPLAY_P3_LINEAR = 139067392, - DISPLAY_P3 = 143261696, - ADOBE_RGB = 151715840, - BT2020_LINEAR = 138805248, - BT2020 = 147193856, - BT2020_PQ = 163971072, - DEPTH = 4096, - SENSOR = 4097, - BT2020_ITU = 281411584, - BT2020_ITU_PQ = 298188800, - BT2020_ITU_HLG = 302383104, - BT2020_HLG = 168165376, - DISPLAY_BT2020 = 142999552, - DYNAMIC_DEPTH = 4098, - JPEG_APP_SEGMENTS = 4099, - HEIF = 4100, - JPEG_R = 4101, - BT709_FULL_RANGE = 146866176, + RANGE_MASK = (7 << 27) /* 939524096 */, + RANGE_UNSPECIFIED = (0 << 27) /* 0 */, + RANGE_FULL = (1 << 27) /* 134217728 */, + RANGE_LIMITED = (2 << 27) /* 268435456 */, + RANGE_EXTENDED = (3 << 27) /* 402653184 */, + SRGB_LINEAR = (((1 << 16) | (1 << 22)) | (1 << 27)) /* 138477568 */, + SCRGB_LINEAR = (((1 << 16) | (1 << 22)) | (3 << 27)) /* 406913024 */, + SRGB = (((1 << 16) | (2 << 22)) | (1 << 27)) /* 142671872 */, + SCRGB = (((1 << 16) | (2 << 22)) | (3 << 27)) /* 411107328 */, + JFIF = (((2 << 16) | (3 << 22)) | (1 << 27)) /* 146931712 */, + BT601_625 = (((2 << 16) | (3 << 22)) | (2 << 27)) /* 281149440 */, + BT601_525 = (((4 << 16) | (3 << 22)) | (2 << 27)) /* 281280512 */, + BT709 = (((1 << 16) | (3 << 22)) | (2 << 27)) /* 281083904 */, + DCI_P3_LINEAR = (((10 << 16) | (1 << 22)) | (1 << 27)) /* 139067392 */, + DCI_P3 = (((10 << 16) | (5 << 22)) | (1 << 27)) /* 155844608 */, + DISPLAY_P3_LINEAR = (((10 << 16) | (1 << 22)) | (1 << 27)) /* 139067392 */, + DISPLAY_P3 = (((10 << 16) | (2 << 22)) | (1 << 27)) /* 143261696 */, + ADOBE_RGB = (((11 << 16) | (4 << 22)) | (1 << 27)) /* 151715840 */, + ADOBE_RGB_LINEAR = (((11 << 16) | (1 << 22)) | (1 << 27)) /* 139132928 */, + BT2020_LINEAR = (((6 << 16) | (1 << 22)) | (1 << 27)) /* 138805248 */, + BT2020 = (((6 << 16) | (3 << 22)) | (1 << 27)) /* 147193856 */, + BT2020_PQ = (((6 << 16) | (7 << 22)) | (1 << 27)) /* 163971072 */, + BT2020_LINEAR_EXTENDED = (((6 << 16) | (1 << 22)) | (3 << 27)) /* 407240704 */, + DEPTH = 0x1000, + SENSOR = 0x1001, + BT2020_ITU = (((6 << 16) | (3 << 22)) | (2 << 27)) /* 281411584 */, + BT2020_ITU_PQ = (((6 << 16) | (7 << 22)) | (2 << 27)) /* 298188800 */, + BT2020_ITU_HLG = (((6 << 16) | (8 << 22)) | (2 << 27)) /* 302383104 */, + BT2020_HLG = (((6 << 16) | (8 << 22)) | (1 << 27)) /* 168165376 */, + DISPLAY_BT2020 = (((6 << 16) | (2 << 22)) | (1 << 27)) /* 142999552 */, + DYNAMIC_DEPTH = 0x1002, + JPEG_APP_SEGMENTS = 0x1003, + HEIF = 0x1004, + JPEG_R = 0x1005, + BT709_FULL_RANGE = (((1 << 16) | (3 << 22)) | (1 << 27)) /* 146866176 */, } diff --git a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/DisplayHotplugEvent.aidl b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/DisplayHotplugEvent.aidl new file mode 100644 index 0000000000000000000000000000000000000000..63dca0aab5d5ae9915215b89aaa772db5a968d23 --- /dev/null +++ b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/DisplayHotplugEvent.aidl @@ -0,0 +1,42 @@ +/** + * Copyright (c) 2023, The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/////////////////////////////////////////////////////////////////////////////// +// THIS 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 -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.graphics.common; +@Backing(type="int") @VintfStability +enum DisplayHotplugEvent { + CONNECTED = 0, + DISCONNECTED = 1, + ERROR_UNKNOWN = (-1) /* -1 */, + ERROR_INCOMPATIBLE_CABLE = (-2) /* -2 */, + ERROR_TOO_MANY_DISPLAYS = (-3) /* -3 */, +} diff --git a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/HardwareBuffer.aidl b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/HardwareBuffer.aidl index 1817769af21c404a21a058cad36fe36048aae382..0fe949304cff79e09a9aaadb258e4b9cde02b349 100644 --- a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/HardwareBuffer.aidl +++ b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/HardwareBuffer.aidl @@ -32,7 +32,10 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.graphics.common; -/* @hide */ +/** + * @hide + * @deprecated : Use instead android.hardware.HardwareBuffer in frameworks/base + */ @VintfStability parcelable HardwareBuffer { android.hardware.graphics.common.HardwareBufferDescription description; diff --git a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/PixelFormat.aidl b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/PixelFormat.aidl index 68857e816f33a47573225c0179bdf87da3fac111..ed84a44b4f026be55f070a63cf8d5a253294cbf3 100644 --- a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/PixelFormat.aidl +++ b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/PixelFormat.aidl @@ -36,36 +36,36 @@ package android.hardware.graphics.common; @Backing(type="int") @VintfStability enum PixelFormat { UNSPECIFIED = 0, - RGBA_8888 = 1, - RGBX_8888 = 2, - RGB_888 = 3, - RGB_565 = 4, - BGRA_8888 = 5, - YCBCR_422_SP = 16, - YCRCB_420_SP = 17, - YCBCR_422_I = 20, - RGBA_FP16 = 22, - RAW16 = 32, - BLOB = 33, - IMPLEMENTATION_DEFINED = 34, - YCBCR_420_888 = 35, - RAW_OPAQUE = 36, - RAW10 = 37, - RAW12 = 38, - RGBA_1010102 = 43, - Y8 = 538982489, - Y16 = 540422489, - YV12 = 842094169, - DEPTH_16 = 48, - DEPTH_24 = 49, - DEPTH_24_STENCIL_8 = 50, - DEPTH_32F = 51, - DEPTH_32F_STENCIL_8 = 52, - STENCIL_8 = 53, - YCBCR_P010 = 54, - HSV_888 = 55, - R_8 = 56, - R_16_UINT = 57, - RG_1616_UINT = 58, - RGBA_10101010 = 59, + RGBA_8888 = 0x1, + RGBX_8888 = 0x2, + RGB_888 = 0x3, + RGB_565 = 0x4, + BGRA_8888 = 0x5, + YCBCR_422_SP = 0x10, + YCRCB_420_SP = 0x11, + YCBCR_422_I = 0x14, + RGBA_FP16 = 0x16, + RAW16 = 0x20, + BLOB = 0x21, + IMPLEMENTATION_DEFINED = 0x22, + YCBCR_420_888 = 0x23, + RAW_OPAQUE = 0x24, + RAW10 = 0x25, + RAW12 = 0x26, + RGBA_1010102 = 0x2B, + Y8 = 0x20203859, + Y16 = 0x20363159, + YV12 = 0x32315659, + DEPTH_16 = 0x30, + DEPTH_24 = 0x31, + DEPTH_24_STENCIL_8 = 0x32, + DEPTH_32F = 0x33, + DEPTH_32F_STENCIL_8 = 0x34, + STENCIL_8 = 0x35, + YCBCR_P010 = 0x36, + HSV_888 = 0x37, + R_8 = 0x38, + R_16_UINT = 0x39, + RG_1616_UINT = 0x3a, + RGBA_10101010 = 0x3b, } diff --git a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/PlaneLayoutComponentType.aidl b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/PlaneLayoutComponentType.aidl index 8ba93811a4ed2bc85eff9a4fafeaac7f51211288..e3067515fdf2d9283c60e1f841f0a7730d232283 100644 --- a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/PlaneLayoutComponentType.aidl +++ b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/PlaneLayoutComponentType.aidl @@ -35,12 +35,12 @@ package android.hardware.graphics.common; /* @hide */ @Backing(type="long") @VintfStability enum PlaneLayoutComponentType { - Y = 1, - CB = 2, - CR = 4, - R = 1024, - G = 2048, - B = 4096, - RAW = 1048576, - A = 1073741824, + Y = (1 << 0) /* 1 */, + CB = (1 << 1) /* 2 */, + CR = (1 << 2) /* 4 */, + R = (1 << 10) /* 1024 */, + G = (1 << 11) /* 2048 */, + B = (1 << 12) /* 4096 */, + RAW = (1 << 20) /* 1048576 */, + A = (1 << 30) /* 1073741824 */, } diff --git a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/Transform.aidl b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/Transform.aidl index 986d08902722d16c85b1ffd5cef10ad05a2f9b22..dbed57dae6b7644c701c75543ba517be4bad6028 100644 --- a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/Transform.aidl +++ b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/Transform.aidl @@ -36,9 +36,9 @@ package android.hardware.graphics.common; @Backing(type="int") @VintfStability enum Transform { NONE = 0, - FLIP_H = 1, - FLIP_V = 2, - ROT_90 = 4, - ROT_180 = 3, - ROT_270 = 7, + FLIP_H = (1 << 0) /* 1 */, + FLIP_V = (1 << 1) /* 2 */, + ROT_90 = (1 << 2) /* 4 */, + ROT_180 = (FLIP_H | FLIP_V) /* 3 */, + ROT_270 = ((FLIP_H | FLIP_V) | ROT_90) /* 7 */, } diff --git a/graphics/common/aidl/android/hardware/graphics/common/BufferUsage.aidl b/graphics/common/aidl/android/hardware/graphics/common/BufferUsage.aidl index 12bc441b72cc57be11f4d56481a87059f3c578f3..0d1a094b3610263161733c7b6a5b3620d54ec90a 100644 --- a/graphics/common/aidl/android/hardware/graphics/common/BufferUsage.aidl +++ b/graphics/common/aidl/android/hardware/graphics/common/BufferUsage.aidl @@ -24,35 +24,47 @@ package android.hardware.graphics.common; @Backing(type="long") enum BufferUsage { /** bit 0-3 is an enum */ - CPU_READ_MASK = 0xf, + CPU_READ_MASK = 0xf, /** buffer is never read by CPU */ - CPU_READ_NEVER = 0, + CPU_READ_NEVER = 0, /** buffer is rarely read by CPU */ - CPU_READ_RARELY = 2, + CPU_READ_RARELY = 2, /** buffer is often read by CPU */ - CPU_READ_OFTEN = 3, + CPU_READ_OFTEN = 3, /** bit 4-7 is an enum */ - CPU_WRITE_MASK = 0xf << 4, + CPU_WRITE_MASK = 0xf << 4, /** buffer is never written by CPU */ - CPU_WRITE_NEVER = 0 << 4, + CPU_WRITE_NEVER = 0 << 4, /** buffer is rarely written by CPU */ - CPU_WRITE_RARELY = 2 << 4, + CPU_WRITE_RARELY = 2 << 4, /** buffer is often written by CPU */ - CPU_WRITE_OFTEN = 3 << 4, + CPU_WRITE_OFTEN = 3 << 4, - /** buffer is used as a GPU texture */ - GPU_TEXTURE = 1 << 8, + /** + * Buffer may be used as a GPU texture + * + * Buffers allocated with this flag must be + * texturable both in EGL/GL & Vulkan via + * their respective external memory extensions + */ + GPU_TEXTURE = 1 << 8, - /** buffer is used as a GPU render target */ - GPU_RENDER_TARGET = 1 << 9, + /** + * Buffer may be used as a GPU render target + * + * Buffers allocated with this flag must be + * renderable both in EGL/GL & Vulkan via + * their respective external memory extensions + */ + GPU_RENDER_TARGET = 1 << 9, /** bit 10 must be zero */ /** buffer is used as a composer HAL overlay layer */ - COMPOSER_OVERLAY = 1 << 11, + COMPOSER_OVERLAY = 1 << 11, /** buffer is used as a composer HAL client target */ - COMPOSER_CLIENT_TARGET = 1 << 12, + COMPOSER_CLIENT_TARGET = 1 << 12, /** bit 13 must be zero */ @@ -61,86 +73,86 @@ enum BufferUsage { * contents (or information derived from the contents) into unprotected * memory. */ - PROTECTED = 1 << 14, + PROTECTED = 1 << 14, /** buffer is used as a hwcomposer HAL cursor layer */ - COMPOSER_CURSOR = 1 << 15, + COMPOSER_CURSOR = 1 << 15, /** buffer is used as a video encoder input */ - VIDEO_ENCODER = 1 << 16, + VIDEO_ENCODER = 1 << 16, /** buffer is used as a camera HAL output */ - CAMERA_OUTPUT = 1 << 17, + CAMERA_OUTPUT = 1 << 17, /** buffer is used as a camera HAL input */ - CAMERA_INPUT = 1 << 18, + CAMERA_INPUT = 1 << 18, /** bit 19 must be zero */ /** buffer is used as a renderscript allocation */ - RENDERSCRIPT = 1 << 20, + RENDERSCRIPT = 1 << 20, /** bit 21 must be zero */ /** buffer is used as a video decoder output */ - VIDEO_DECODER = 1 << 22, + VIDEO_DECODER = 1 << 22, /** buffer is used as a sensor direct report output */ - SENSOR_DIRECT_DATA = 1 << 23, + SENSOR_DIRECT_DATA = 1 << 23, /** * buffer is used as as an OpenGL shader storage or uniform * buffer object */ - GPU_DATA_BUFFER = 1 << 24, + GPU_DATA_BUFFER = 1 << 24, /** buffer is used as a cube map texture */ - GPU_CUBE_MAP = 1 << 25, + GPU_CUBE_MAP = 1 << 25, /** buffer contains a complete mipmap hierarchy */ - GPU_MIPMAP_COMPLETE = 1 << 26, + GPU_MIPMAP_COMPLETE = 1 << 26, /** * Buffer is used as input for HEIC encoder. */ - HW_IMAGE_ENCODER = 1 << 27, + HW_IMAGE_ENCODER = 1 << 27, /* Bits 28-31 are reserved for vendor usage */ /** - * Buffer is used for front-buffer rendering. - * - * To satisfy an allocation with this usage, the resulting buffer - * must operate as equivalent to shared memory for all targets. - * - * For CPU_USAGE_* other than NEVER, this means the buffer must - * "lock in place". The buffers must be directly accessible via mapping. - * - * For GPU_RENDER_TARGET the buffer must behave equivalent to a - * single-buffered EGL surface. For example glFlush must perform - * a flush, same as if the default framebuffer was single-buffered. - * - * For COMPOSER_* the HWC must not perform any caching for this buffer - * when submitted for composition. HWCs do not need to do any form - * of auto-refresh, and they are allowed to cache composition results between - * presents from SF (such as for panel self-refresh), but for any given - * present the buffer must be composited from even if it otherwise appears - * to be the same as a previous composition. - * - * If the GPU & HWC supports EGL_SINGLE_BUFFER, then it is recommended that - * FRONT_BUFFER usage is supported for the same formats as supported by - * EGL_SINGLE_BUFFER. In particular, it is recommended that the following - * combination is supported when possible: - * Format = RGBA_8888 - * Usage = FRONT_BUFFER | GPU_RENDER_TARGET | COMPOSER_OVERLAY - * - */ - FRONT_BUFFER = 1L << 32, + * Buffer is used for front-buffer rendering. + * + * To satisfy an allocation with this usage, the resulting buffer + * must operate as equivalent to shared memory for all targets. + * + * For CPU_USAGE_* other than NEVER, this means the buffer must + * "lock in place". The buffers must be directly accessible via mapping. + * + * For GPU_RENDER_TARGET the buffer must behave equivalent to a + * single-buffered EGL surface. For example glFlush must perform + * a flush, same as if the default framebuffer was single-buffered. + * + * For COMPOSER_* the HWC must not perform any caching for this buffer + * when submitted for composition. HWCs do not need to do any form + * of auto-refresh, and they are allowed to cache composition results between + * presents from SF (such as for panel self-refresh), but for any given + * present the buffer must be composited from even if it otherwise appears + * to be the same as a previous composition. + * + * If the GPU & HWC supports EGL_SINGLE_BUFFER, then it is recommended that + * FRONT_BUFFER usage is supported for the same formats as supported by + * EGL_SINGLE_BUFFER. In particular, it is recommended that the following + * combination is supported when possible: + * Format = RGBA_8888 + * Usage = FRONT_BUFFER | GPU_RENDER_TARGET | COMPOSER_OVERLAY + * + */ + FRONT_BUFFER = 1L << 32, /** bits 28-31 are reserved for vendor extensions */ - VENDOR_MASK = 0xf << 28, + VENDOR_MASK = 0xf << 28, /** bits 33-47 must be zero and are reserved for future versions */ /** bits 48-63 are reserved for vendor extensions */ - VENDOR_MASK_HI = (1L * 0xffff) << 48, + VENDOR_MASK_HI = (1L * 0xffff) << 48, } diff --git a/graphics/common/aidl/android/hardware/graphics/common/ChromaSiting.aidl b/graphics/common/aidl/android/hardware/graphics/common/ChromaSiting.aidl index ac448535e865bfaf307d599a3ed6d36eb167182a..7da45daa6d469ae6c989273644cb66824ea2b810 100644 --- a/graphics/common/aidl/android/hardware/graphics/common/ChromaSiting.aidl +++ b/graphics/common/aidl/android/hardware/graphics/common/ChromaSiting.aidl @@ -37,4 +37,12 @@ enum ChromaSiting { * Cb and Cr are vertically sited interstitially. * This is used by 4:2:0 for MPEG-2 frame pictures. */ COSITED_HORIZONTAL = 3, + + /* Cb and Cr are horizontally sited interstitially with a luma sample. + * Cb and Cr are vertically sited coincident. */ + COSITED_VERTICAL = 4, + + /* Cb and Cr are both horizontally & vertically sited coincident + * with a luma sample. */ + COSITED_BOTH = 5, } diff --git a/graphics/common/aidl/android/hardware/graphics/common/Dataspace.aidl b/graphics/common/aidl/android/hardware/graphics/common/Dataspace.aidl index 3ff0a6534bb3b628ec27fa2714cd2d584808ea6e..79737eb8856d1c6a604be5e98ff1e0fbf07e0269 100644 --- a/graphics/common/aidl/android/hardware/graphics/common/Dataspace.aidl +++ b/graphics/common/aidl/android/hardware/graphics/common/Dataspace.aidl @@ -23,11 +23,26 @@ enum Dataspace { /** * Default-assumption data space, when not explicitly specified. * - * It is safest to assume the buffer is an image with sRGB primaries and - * encoding ranges, but the consumer and/or the producer of the data may - * simply be using defaults. No automatic gamma transform should be - * expected, except for a possible display gamma transform when drawn to a - * screen. + * IAllocator implementations must not assume a particular dataspace interpretation when + * allocating a buffer. That is, the dataspace stored on a buffer's metadata must + * explicitly be UNKNOWN at the time of allocation. All other vendor implementations (for + * example, IComposer) are suggested to assume that the buffer is an image that conforms + * to the recommendations outlined by STANDARD_UNSPECIFIED, TRANSFER_UNSPECIFIED, and + * RANGE_UNSPECIFIED in order to avoid obviously-broken behavior. + * + * This means: + * - RGB buffers may be assumed to follow sRGB (IEC 61966-2.1) + * - YCbCr buffers smaller than 720p may be assumed to follow BT. 601-7 + * - YCbCr buffers at least 720p may be assumed to follow BT. 709-6 + * - Y buffers are full range with an undefined transfer and primaries + * - All other buffer formats may be treated in an implementation-defined manner + * + * It is the framework's - and application's - responsibility to communicate + * an accurate dataspace for any buffers throughout the system to guarantee + * well-defined behavior. For the framework, this means translating UNKNOWN + * dataspaces to a chosen default, and setting gralloc metadata on the buffer + * accordingly. For the application, this means signaling a defined dataspace + * to any framework apis. */ UNKNOWN = 0x0, @@ -543,6 +558,13 @@ enum Dataspace { */ ADOBE_RGB = 11 << 16 | 4 << 22 | 1 << 27, // STANDARD_ADOBE_RGB | TRANSFER_GAMMA2_2 | RANGE_FULL + /** + * Adobe RGB LINEAR + * + * Use full range, linear transfer and Adobe RGB primaries + */ + ADOBE_RGB_LINEAR = 11 << 16 | 1 << 22 | 1 << 27, // STANDARD_ADOBE_RGB | TRANSFER_LINEAR | RANGE_FULL + /** * ITU-R Recommendation 2020 (BT.2020) * @@ -570,6 +592,15 @@ enum Dataspace { */ BT2020_PQ = 6 << 16 | 7 << 22 | 1 << 27, // STANDARD_BT2020 | TRANSFER_ST2084 | RANGE_FULL + /** + * ITU-R Recommendation 2020 (BT.2020) + * + * Ultra High-definition television + * + * Use extended range, linear transfer and BT2020 standard + */ + BT2020_LINEAR_EXTENDED = 6 << 16 | 1 << 22 | 3 << 27, // STANDARD_BT2020 | TRANSFER_LINEAR | RANGE_EXTENDED + /** * Data spaces for non-color formats */ diff --git a/graphics/common/aidl/android/hardware/graphics/common/DisplayHotplugEvent.aidl b/graphics/common/aidl/android/hardware/graphics/common/DisplayHotplugEvent.aidl new file mode 100644 index 0000000000000000000000000000000000000000..b35ada5bc9998d1973a7e6e323e52fd47cc5a474 --- /dev/null +++ b/graphics/common/aidl/android/hardware/graphics/common/DisplayHotplugEvent.aidl @@ -0,0 +1,46 @@ +/** + * Copyright (c) 2023, The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.hardware.graphics.common; + +/** + * Display hotplug events through onHotplugEvent callback. + */ +@VintfStability +@Backing(type="int") +enum DisplayHotplugEvent { + /** + * Display is successfully connected. + * Connected may be called more than once and the behavior of subsequent + * calls is that SurfaceFlinger queries the display properties again. + */ + CONNECTED = 0, + + /** Display is successfully disconnected */ + DISCONNECTED = 1, + + /** Display is plugged in, but an unknown error occurred */ + ERROR_UNKNOWN = -1, + + /** Display is plugged in, but incompatible cable error detected */ + ERROR_INCOMPATIBLE_CABLE = -2, + + /** + * Display is plugged in, but exceeds the max number of + * displays that can be simultaneously connected + */ + ERROR_TOO_MANY_DISPLAYS = -3, +} diff --git a/graphics/common/aidl/android/hardware/graphics/common/HardwareBuffer.aidl b/graphics/common/aidl/android/hardware/graphics/common/HardwareBuffer.aidl index 50306dcaddf3e3c0b2c9493fd091f5aac691a7bc..ac95b1c941a37c1e5e7d96106d32a40f1d91ff94 100644 --- a/graphics/common/aidl/android/hardware/graphics/common/HardwareBuffer.aidl +++ b/graphics/common/aidl/android/hardware/graphics/common/HardwareBuffer.aidl @@ -20,11 +20,13 @@ import android.hardware.common.NativeHandle; import android.hardware.graphics.common.HardwareBufferDescription; /** - * Stable AIDL counterpart of AHardwareBuffer. + * [Deprecated] Stable AIDL counterpart of AHardwareBuffer. * - * @note This is different from the public HardwareBuffer. - * @sa +ndk libnativewindow#AHardwareBuffer + * @note This is different from the public HardwareBuffer. As the public + HardwareBuffer now supports being used in stable-aidl interfaces, + that is strongly preferred for new usages. * @hide + * @deprecated: Use instead android.hardware.HardwareBuffer in frameworks/base */ @VintfStability parcelable HardwareBuffer { diff --git a/graphics/composer/2.1/utils/command-buffer/include/composer-command-buffer/2.1/ComposerCommandBuffer.h b/graphics/composer/2.1/utils/command-buffer/include/composer-command-buffer/2.1/ComposerCommandBuffer.h index 499d3b96e32cc740ca54657515da9cb5d67ffa21..336d15dc6c8676a6f2d52df12e6f74b2450985ca 100644 --- a/graphics/composer/2.1/utils/command-buffer/include/composer-command-buffer/2.1/ComposerCommandBuffer.h +++ b/graphics/composer/2.1/utils/command-buffer/include/composer-command-buffer/2.1/ComposerCommandBuffer.h @@ -679,6 +679,10 @@ class CommandReaderBase { uint32_t read() { return mData[mDataRead++]; } + bool isReadSizeValid(uint32_t size) const { + return mDataRead * sizeof(uint32_t) + size <= mDataSize; + } + int32_t readSigned() { int32_t val; memcpy(&val, &mData[mDataRead++], sizeof(val)); @@ -760,7 +764,7 @@ class CommandReaderBase { std::unique_ptr mData; uint32_t mDataRead; - private: + private: std::unique_ptr mQueue; uint32_t mDataMaxSize; diff --git a/graphics/composer/2.1/utils/resources/Android.bp b/graphics/composer/2.1/utils/resources/Android.bp index 9eb23fa82e830d22e7c63726a20dba6e7637ebc9..405200317f0f3c13451899400bb7c030b876b77c 100644 --- a/graphics/composer/2.1/utils/resources/Android.bp +++ b/graphics/composer/2.1/utils/resources/Android.bp @@ -29,20 +29,15 @@ cc_library { vendor_available: true, shared_libs: [ "android.hardware.graphics.composer@2.1", - "android.hardware.graphics.mapper@2.0", - "android.hardware.graphics.mapper@3.0", - "android.hardware.graphics.mapper@4.0", "libcutils", "libhardware", // TODO remove hwcomposer2.h dependency "libhidlbase", "liblog", + "libui", "libutils", ], export_shared_lib_headers: [ "android.hardware.graphics.composer@2.1", - "android.hardware.graphics.mapper@2.0", - "android.hardware.graphics.mapper@3.0", - "android.hardware.graphics.mapper@4.0", "libhardware", "libhidlbase", "liblog", diff --git a/graphics/composer/2.1/utils/resources/ComposerResources.cpp b/graphics/composer/2.1/utils/resources/ComposerResources.cpp index e52bf7124a5f0d5c6ae60db9d32778f04f9ac746..80bfb7a26ae1b4945d57f60bbedd64d5f6527db8 100644 --- a/graphics/composer/2.1/utils/resources/ComposerResources.cpp +++ b/graphics/composer/2.1/utils/resources/ComposerResources.cpp @@ -18,6 +18,8 @@ #include "composer-resources/2.1/ComposerResources.h" +#include + namespace android { namespace hardware { namespace graphics { @@ -25,23 +27,10 @@ namespace composer { namespace V2_1 { namespace hal { -bool ComposerHandleImporter::init() { - mMapper4 = mapper::V4_0::IMapper::getService(); - if (mMapper4) { - return true; - } - ALOGI_IF(!mMapper4, "failed to get mapper 4.0 service, falling back to mapper 3.0"); - - mMapper3 = mapper::V3_0::IMapper::getService(); - if (mMapper3) { - return true; - } - ALOGI_IF(!mMapper3, "failed to get mapper 3.0 service, falling back to mapper 2.0"); - - mMapper2 = mapper::V2_0::IMapper::getService(); - ALOGE_IF(!mMapper2, "failed to get mapper 2.0 service"); +ComposerHandleImporter::ComposerHandleImporter() : mMapper{GraphicBufferMapper::get()} {} - return mMapper2 != nullptr; +bool ComposerHandleImporter::init() { + return true; } Error ComposerHandleImporter::importBuffer(const native_handle_t* rawHandle, @@ -51,51 +40,17 @@ Error ComposerHandleImporter::importBuffer(const native_handle_t* rawHandle, return Error::NONE; } - const native_handle_t* bufferHandle; - if (mMapper2) { - mapper::V2_0::Error error; - mMapper2->importBuffer(rawHandle, [&](const auto& tmpError, const auto& tmpBufferHandle) { - error = tmpError; - bufferHandle = static_cast(tmpBufferHandle); - }); - if (error != mapper::V2_0::Error::NONE) { - return Error::NO_RESOURCES; - } - } - if (mMapper3) { - mapper::V3_0::Error error; - mMapper3->importBuffer(rawHandle, [&](const auto& tmpError, const auto& tmpBufferHandle) { - error = tmpError; - bufferHandle = static_cast(tmpBufferHandle); - }); - if (error != mapper::V3_0::Error::NONE) { - return Error::NO_RESOURCES; - } - } - if (mMapper4) { - mapper::V4_0::Error error; - mMapper4->importBuffer(rawHandle, [&](const auto& tmpError, const auto& tmpBufferHandle) { - error = tmpError; - bufferHandle = static_cast(tmpBufferHandle); - }); - if (error != mapper::V4_0::Error::NONE) { - return Error::NO_RESOURCES; - } + status_t status = mMapper.importBufferNoValidate(rawHandle, outBufferHandle); + if (status == STATUS_OK) { + return Error::NONE; + } else { + return Error::NO_RESOURCES; } - - *outBufferHandle = bufferHandle; - return Error::NONE; } void ComposerHandleImporter::freeBuffer(const native_handle_t* bufferHandle) { if (bufferHandle) { - if (mMapper2) { - mMapper2->freeBuffer(static_cast(const_cast(bufferHandle))); - } else if (mMapper3) { - mMapper3->freeBuffer(static_cast(const_cast(bufferHandle))); - } else if (mMapper4) { - mMapper4->freeBuffer(static_cast(const_cast(bufferHandle))); - } + mMapper.freeBuffer(bufferHandle); } } diff --git a/graphics/composer/2.1/utils/resources/include/composer-resources/2.1/ComposerResources.h b/graphics/composer/2.1/utils/resources/include/composer-resources/2.1/ComposerResources.h index de78a59e91330cca5be3cd6e8cc7899bf0e40806..983811859ebfc639145c4135beeaeb9d2b1dd6f1 100644 --- a/graphics/composer/2.1/utils/resources/include/composer-resources/2.1/ComposerResources.h +++ b/graphics/composer/2.1/utils/resources/include/composer-resources/2.1/ComposerResources.h @@ -27,12 +27,10 @@ #include -#include -#include -#include #include namespace android { +class GraphicBufferMapper; namespace hardware { namespace graphics { namespace composer { @@ -42,6 +40,7 @@ namespace hal { // wrapper for IMapper to import buffers and sideband streams class ComposerHandleImporter { public: + ComposerHandleImporter(); bool init(); Error importBuffer(const native_handle_t* rawHandle, const native_handle_t** outBufferHandle); @@ -50,9 +49,7 @@ class ComposerHandleImporter { void freeStream(const native_handle_t* streamHandle); private: - sp mMapper2; - sp mMapper3; - sp mMapper4; + GraphicBufferMapper& mMapper; }; class ComposerHandleCache { diff --git a/graphics/composer/2.1/utils/vts/Android.bp b/graphics/composer/2.1/utils/vts/Android.bp index 7b6a0e636748570e50f3bba700e7a3ecb2eace19..3bc127f0a965ef0cefff2237810f3e0e42746f5b 100644 --- a/graphics/composer/2.1/utils/vts/Android.bp +++ b/graphics/composer/2.1/utils/vts/Android.bp @@ -26,7 +26,6 @@ package { cc_library_static { name: "android.hardware.graphics.composer@2.1-vts", defaults: [ - "android.hardware.graphics.allocator-ndk_static", "hidl_defaults", ], srcs: [ @@ -34,18 +33,15 @@ cc_library_static { "GraphicsComposerCallback.cpp", "TestCommandReader.cpp", ], + shared_libs: [ + "libui", + ], static_libs: [ "android.hardware.graphics.composer@2.1", - "android.hardware.graphics.mapper@2.0-vts", - "android.hardware.graphics.mapper@3.0-vts", - "android.hardware.graphics.mapper@4.0-vts", "libgtest", ], export_static_lib_headers: [ "android.hardware.graphics.composer@2.1", - "android.hardware.graphics.mapper@2.0-vts", - "android.hardware.graphics.mapper@3.0-vts", - "android.hardware.graphics.mapper@4.0-vts", ], header_libs: [ "android.hardware.graphics.composer@2.1-command-buffer", diff --git a/graphics/composer/2.1/utils/vts/ComposerVts.cpp b/graphics/composer/2.1/utils/vts/ComposerVts.cpp index 4603dd1b8c4120ffe71555e375d528a42ee1dcc3..8b8978465c888a97e9a5efc84a5e4202c118dcae 100644 --- a/graphics/composer/2.1/utils/vts/ComposerVts.cpp +++ b/graphics/composer/2.1/utils/vts/ComposerVts.cpp @@ -308,113 +308,6 @@ void ComposerClient::execute(TestCommandReader* reader, CommandWriterBase* write writer->reset(); } -NativeHandleWrapper::~NativeHandleWrapper() { - if (mHandle) { - mGralloc.freeBuffer(mHandle); - } -} - -Gralloc::Gralloc() { - [this] { - ASSERT_NO_FATAL_FAILURE(mGralloc4 = std::make_shared( - /*aidlAllocatorServiceName*/ IAllocator::descriptor + - std::string("/default"), - /*hidlAllocatorServiceName*/ "default", - /*mapperServiceName*/ "default", - /*errOnFailure=*/false)); - if (!mGralloc4->hasAllocator() || mGralloc4->getMapper() == nullptr) { - mGralloc4 = nullptr; - ASSERT_NO_FATAL_FAILURE(mGralloc3 = std::make_shared("default", "default", - /*errOnFailure=*/false)); - if (mGralloc3->getAllocator() == nullptr || mGralloc3->getMapper() == nullptr) { - mGralloc3 = nullptr; - ASSERT_NO_FATAL_FAILURE(mGralloc2 = std::make_shared()); - } - } - }(); -} - -const NativeHandleWrapper Gralloc::allocate(uint32_t width, uint32_t height, uint32_t layerCount, - PixelFormat format, uint64_t usage, bool import, - uint32_t* outStride) { - const native_handle_t* handle; - if (mGralloc4) { - IMapper4::BufferDescriptorInfo info{}; - info.width = width; - info.height = height; - info.layerCount = layerCount; - info.format = static_cast(format); - info.usage = usage; - handle = mGralloc4->allocate(info, import, outStride); - } else if (mGralloc3) { - IMapper3::BufferDescriptorInfo info{}; - info.width = width; - info.height = height; - info.layerCount = layerCount; - info.format = static_cast(format); - info.usage = usage; - handle = mGralloc3->allocate(info, import, outStride); - } else { - IMapper2::BufferDescriptorInfo info{}; - info.width = width; - info.height = height; - info.layerCount = layerCount; - info.format = format; - info.usage = usage; - handle = mGralloc2->allocate(info, import, outStride); - } - return NativeHandleWrapper(*this, handle); -} - -void* Gralloc::lock(const native_handle_t* bufferHandle, uint64_t cpuUsage, - const AccessRegion& accessRegionRect, int acquireFence) { - if (mGralloc4) { - IMapper4::Rect accessRegion; - accessRegion.left = accessRegionRect.left; - accessRegion.top = accessRegionRect.top; - accessRegion.width = accessRegionRect.width; - accessRegion.height = accessRegionRect.height; - return mGralloc4->lock(bufferHandle, cpuUsage, accessRegion, acquireFence); - } else if (mGralloc3) { - IMapper3::Rect accessRegion; - accessRegion.left = accessRegionRect.left; - accessRegion.top = accessRegionRect.top; - accessRegion.width = accessRegionRect.width; - accessRegion.height = accessRegionRect.height; - int32_t bytesPerPixel; - int32_t bytesPerStride; - return mGralloc3->lock(bufferHandle, cpuUsage, accessRegion, acquireFence, &bytesPerPixel, - &bytesPerStride); - } else { - IMapper2::Rect accessRegion; - accessRegion.left = accessRegionRect.left; - accessRegion.top = accessRegionRect.top; - accessRegion.width = accessRegionRect.width; - accessRegion.height = accessRegionRect.height; - return mGralloc2->lock(bufferHandle, cpuUsage, accessRegion, acquireFence); - } -} - -int Gralloc::unlock(const native_handle_t* bufferHandle) { - if (mGralloc4) { - return mGralloc4->unlock(bufferHandle); - } else if (mGralloc3) { - return mGralloc3->unlock(bufferHandle); - } else { - return mGralloc2->unlock(bufferHandle); - } -} - -void Gralloc::freeBuffer(const native_handle_t* bufferHandle) { - if (mGralloc4) { - mGralloc4->freeBuffer(bufferHandle); - } else if (mGralloc3) { - mGralloc3->freeBuffer(bufferHandle); - } else { - mGralloc2->freeBuffer(bufferHandle); - } -} - } // namespace vts } // namespace V2_1 } // namespace composer diff --git a/graphics/composer/2.1/utils/vts/include/composer-vts/2.1/ComposerVts.h b/graphics/composer/2.1/utils/vts/include/composer-vts/2.1/ComposerVts.h index f8ea661f1245586a1a275e5a3ae5cbae9402b1f6..c0aacb57482b213d465479dcb091b789671b970f 100644 --- a/graphics/composer/2.1/utils/vts/include/composer-vts/2.1/ComposerVts.h +++ b/graphics/composer/2.1/utils/vts/include/composer-vts/2.1/ComposerVts.h @@ -25,9 +25,6 @@ #include #include #include -#include -#include -#include #include #include "gtest/gtest.h" @@ -43,13 +40,6 @@ using android::hardware::graphics::common::V1_0::ColorMode; using android::hardware::graphics::common::V1_0::Dataspace; using android::hardware::graphics::common::V1_0::Hdr; using android::hardware::graphics::common::V1_0::PixelFormat; -using IMapper2 = android::hardware::graphics::mapper::V2_0::IMapper; -using IMapper3 = android::hardware::graphics::mapper::V3_0::IMapper; -using IMapper4 = android::hardware::graphics::mapper::V4_0::IMapper; -using Gralloc2 = android::hardware::graphics::mapper::V2_0::vts::Gralloc; -using Gralloc3 = android::hardware::graphics::mapper::V3_0::vts::Gralloc; -using Gralloc4 = android::hardware::graphics::mapper::V4_0::vts::Gralloc; -using IAllocator = aidl::android::hardware::graphics::allocator::IAllocator; class ComposerClient; @@ -129,52 +119,6 @@ class ComposerClient { const sp mClient; }; -class AccessRegion { - public: - int32_t left; - int32_t top; - int32_t width; - int32_t height; -}; - -class Gralloc; - -// RAII wrapper around native_handle_t* -class NativeHandleWrapper { - public: - NativeHandleWrapper(Gralloc& gralloc, const native_handle_t* handle) - : mGralloc(gralloc), mHandle(handle) {} - - ~NativeHandleWrapper(); - - const native_handle_t* get() { return mHandle; } - - private: - Gralloc& mGralloc; - const native_handle_t* mHandle; -}; - -class Gralloc { - public: - explicit Gralloc(); - - const NativeHandleWrapper allocate(uint32_t width, uint32_t height, uint32_t layerCount, - PixelFormat format, uint64_t usage, bool import = true, - uint32_t* outStride = nullptr); - - void* lock(const native_handle_t* bufferHandle, uint64_t cpuUsage, - const AccessRegion& accessRegionRect, int acquireFence); - - int unlock(const native_handle_t* bufferHandle); - - void freeBuffer(const native_handle_t* bufferHandle); - - protected: - std::shared_ptr mGralloc2 = nullptr; - std::shared_ptr mGralloc3 = nullptr; - std::shared_ptr mGralloc4 = nullptr; -}; - } // namespace vts } // namespace V2_1 } // namespace composer diff --git a/graphics/composer/2.1/vts/functional/Android.bp b/graphics/composer/2.1/vts/functional/Android.bp index 0f6d7e8eba434528018d15e98a1c380e516b5039..0706341f2da435106f7e3e9eb9efc511d320f335 100644 --- a/graphics/composer/2.1/vts/functional/Android.bp +++ b/graphics/composer/2.1/vts/functional/Android.bp @@ -27,7 +27,6 @@ cc_test { name: "VtsHalGraphicsComposerV2_1TargetTest", defaults: [ "VtsHalTargetTestDefaults", - "android.hardware.graphics.allocator-ndk_static", ], tidy_timeout_srcs: ["VtsHalGraphicsComposerV2_1TargetTest.cpp"], srcs: ["VtsHalGraphicsComposerV2_1TargetTest.cpp"], @@ -38,22 +37,12 @@ cc_test { "libbinder_ndk", "libfmq", "libsync", + "libui", "android.hardware.common-V2-ndk", - "android.hardware.graphics.mapper@2.0", - "android.hardware.graphics.mapper@2.1", - "android.hardware.graphics.mapper@3.0", - "android.hardware.graphics.mapper@4.0", ], static_libs: [ - "android.hardware.graphics.allocator@2.0", - "android.hardware.graphics.allocator@3.0", - "android.hardware.graphics.allocator@4.0", "android.hardware.graphics.composer@2.1", "android.hardware.graphics.composer@2.1-vts", - "android.hardware.graphics.mapper@2.0-vts", - "android.hardware.graphics.mapper@2.1-vts", - "android.hardware.graphics.mapper@3.0-vts", - "android.hardware.graphics.mapper@4.0-vts", "libaidlcommonsupport", ], header_libs: [ diff --git a/graphics/composer/2.1/vts/functional/VtsHalGraphicsComposerV2_1TargetTest.cpp b/graphics/composer/2.1/vts/functional/VtsHalGraphicsComposerV2_1TargetTest.cpp index 9444d89f8074d5605199def4af0df31afb7eaa62..b67cfc21146d699791b9a079239598a533aa79c7 100644 --- a/graphics/composer/2.1/vts/functional/VtsHalGraphicsComposerV2_1TargetTest.cpp +++ b/graphics/composer/2.1/vts/functional/VtsHalGraphicsComposerV2_1TargetTest.cpp @@ -25,9 +25,7 @@ #include #include #include -#include -#include -#include +#include #include @@ -52,7 +50,6 @@ using android::hardware::graphics::common::V1_0::ColorTransform; using android::hardware::graphics::common::V1_0::Dataspace; using android::hardware::graphics::common::V1_0::PixelFormat; using android::hardware::graphics::common::V1_0::Transform; -using GrallocError = android::hardware::graphics::mapper::V2_0::Error; class GraphicsComposerHidlTest : public ::testing::TestWithParam { protected: @@ -651,7 +648,6 @@ class GraphicsComposerHidlCommandTest : public GraphicsComposerHidlTest { void SetUp() override { ASSERT_NO_FATAL_FAILURE(GraphicsComposerHidlTest::SetUp()); - ASSERT_NO_FATAL_FAILURE(mGralloc = std::make_unique()); Config activeConfig = mComposerClient->getActiveConfig(mPrimaryDisplay); mDisplayWidth = mComposerClient->getDisplayAttribute(mPrimaryDisplay, activeConfig, IComposerClient::Attribute::WIDTH); @@ -666,13 +662,17 @@ class GraphicsComposerHidlCommandTest : public GraphicsComposerHidlTest { ASSERT_NO_FATAL_FAILURE(GraphicsComposerHidlTest::TearDown()); } - NativeHandleWrapper allocate() { return allocate(mDisplayWidth, mDisplayHeight); } + sp allocate() { return allocate(mDisplayWidth, mDisplayHeight); } - NativeHandleWrapper allocate(uint32_t width, uint32_t height) { - uint64_t usage = + sp allocate(int32_t width, int32_t height) { + auto result = sp::make( + width, height, static_cast(PixelFormat::RGBA_8888), /*layerCount*/ 1, static_cast(BufferUsage::CPU_WRITE_OFTEN | BufferUsage::CPU_READ_OFTEN | - BufferUsage::COMPOSER_OVERLAY); - return mGralloc->allocate(width, height, 1, PixelFormat::RGBA_8888, usage); + BufferUsage::COMPOSER_OVERLAY)); + if (result->initCheck() != STATUS_OK) { + return nullptr; + } + return result; } void execute() { mComposerClient->execute(mReader.get(), mWriter.get()); } @@ -681,9 +681,6 @@ class GraphicsComposerHidlCommandTest : public GraphicsComposerHidlTest { std::unique_ptr mReader; int32_t mDisplayWidth; int32_t mDisplayHeight; - - private: - std::unique_ptr mGralloc; }; /** @@ -729,11 +726,11 @@ TEST_P(GraphicsComposerHidlCommandTest, SET_OUTPUT_BUFFER) { display = mComposerClient->createVirtualDisplay(64, 64, PixelFormat::IMPLEMENTATION_DEFINED, kBufferSlotCount, &format)); - std::unique_ptr handle; - ASSERT_NO_FATAL_FAILURE(handle.reset(new NativeHandleWrapper(allocate()))); + auto handle = allocate(); + ASSERT_TRUE(handle); mWriter->selectDisplay(display); - mWriter->setOutputBuffer(0, handle->get(), -1); + mWriter->setOutputBuffer(0, handle->handle, -1); execute(); } @@ -802,7 +799,7 @@ TEST_P(GraphicsComposerHidlCommandTest, PRESENT_DISPLAY_NO_LAYER_STATE_CHANGES) mWriter->setLayerZOrder(10); mWriter->setLayerBlendMode(IComposerClient::BlendMode::NONE); mWriter->setLayerSurfaceDamage(std::vector(1, displayFrame)); - mWriter->setLayerBuffer(0, handle.get(), -1); + mWriter->setLayerBuffer(0, handle->handle, -1); mWriter->setLayerDataspace(Dataspace::UNKNOWN); mWriter->validateDisplay(); @@ -820,7 +817,7 @@ TEST_P(GraphicsComposerHidlCommandTest, PRESENT_DISPLAY_NO_LAYER_STATE_CHANGES) mWriter->selectLayer(layer); auto handle2 = allocate(); ASSERT_NE(nullptr, handle2.get()); - mWriter->setLayerBuffer(0, handle2.get(), -1); + mWriter->setLayerBuffer(0, handle2->handle, -1); mWriter->setLayerSurfaceDamage(std::vector(1, {0, 0, 10, 10})); mWriter->presentDisplay(); execute(); @@ -840,7 +837,7 @@ TEST_P(GraphicsComposerHidlCommandTest, SET_LAYER_CURSOR_POSITION) { mWriter->selectDisplay(mPrimaryDisplay); mWriter->selectLayer(layer); - mWriter->setLayerBuffer(0, handle.get(), -1); + mWriter->setLayerBuffer(0, handle->handle, -1); mWriter->setLayerCompositionType(IComposerClient::Composition::CURSOR); mWriter->setLayerDisplayFrame(displayFrame); mWriter->setLayerPlaneAlpha(1); @@ -881,7 +878,7 @@ TEST_P(GraphicsComposerHidlCommandTest, SET_LAYER_BUFFER) { mWriter->selectDisplay(mPrimaryDisplay); mWriter->selectLayer(layer); - mWriter->setLayerBuffer(0, handle.get(), -1); + mWriter->setLayerBuffer(0, handle->handle, -1); execute(); } @@ -905,7 +902,7 @@ TEST_P(GraphicsComposerHidlCommandTest, SET_LAYER_BUFFER_multipleTimes) { mWriter->selectLayer(layer); mWriter->setLayerCompositionType(IComposerClient::Composition::DEVICE); mWriter->setLayerDisplayFrame(displayFrame); - mWriter->setLayerBuffer(0, handle1.get(), -1); + mWriter->setLayerBuffer(0, handle1->handle, -1); mWriter->setLayerDataspace(Dataspace::UNKNOWN); mWriter->validateDisplay(); execute(); @@ -928,7 +925,7 @@ TEST_P(GraphicsComposerHidlCommandTest, SET_LAYER_BUFFER_multipleTimes) { mWriter->selectLayer(layer); mWriter->setLayerCompositionType(IComposerClient::Composition::DEVICE); mWriter->setLayerDisplayFrame(displayFrame); - mWriter->setLayerBuffer(1, handle2.get(), -1); + mWriter->setLayerBuffer(1, handle2->handle, -1); mWriter->setLayerDataspace(Dataspace::UNKNOWN); mWriter->validateDisplay(); execute(); @@ -951,7 +948,7 @@ TEST_P(GraphicsComposerHidlCommandTest, SET_LAYER_BUFFER_multipleTimes) { mWriter->selectLayer(layer); mWriter->setLayerCompositionType(IComposerClient::Composition::DEVICE); mWriter->setLayerDisplayFrame(displayFrame); - mWriter->setLayerBuffer(2, handle3.get(), -1); + mWriter->setLayerBuffer(2, handle3->handle, -1); mWriter->setLayerDataspace(Dataspace::UNKNOWN); mWriter->validateDisplay(); execute(); @@ -968,10 +965,10 @@ TEST_P(GraphicsComposerHidlCommandTest, SET_LAYER_BUFFER_multipleTimes) { // Ensure we can clear multiple buffer slots and then restore the active buffer at the end mWriter->selectDisplay(mPrimaryDisplay); mWriter->selectLayer(layer); - mWriter->setLayerBuffer(0, clearSlotBuffer.get(), -1); + mWriter->setLayerBuffer(0, clearSlotBuffer->handle, -1); mWriter->selectDisplay(mPrimaryDisplay); mWriter->selectLayer(layer); - mWriter->setLayerBuffer(1, clearSlotBuffer.get(), -1); + mWriter->setLayerBuffer(1, clearSlotBuffer->handle, -1); mWriter->selectDisplay(mPrimaryDisplay); mWriter->selectLayer(layer); mWriter->setLayerBuffer(2, nullptr, -1); @@ -1113,7 +1110,7 @@ TEST_P(GraphicsComposerHidlCommandTest, SET_LAYER_SIDEBAND_STREAM) { mWriter->selectDisplay(mPrimaryDisplay); mWriter->selectLayer(layer); - mWriter->setLayerSidebandStream(handle.get()); + mWriter->setLayerSidebandStream(handle->handle); execute(); } diff --git a/graphics/composer/2.2/utils/vts/Android.bp b/graphics/composer/2.2/utils/vts/Android.bp index d11592f512c500e4d0823ed8755c656150b4cdf0..a923923b3189bce6bb942c2ad8f47a5b85d444c7 100644 --- a/graphics/composer/2.2/utils/vts/Android.bp +++ b/graphics/composer/2.2/utils/vts/Android.bp @@ -26,7 +26,6 @@ package { cc_library_static { name: "android.hardware.graphics.composer@2.2-vts", defaults: [ - "android.hardware.graphics.allocator-ndk_static", "android.hardware.graphics.composer3-ndk_static", "hidl_defaults", "librenderengine_deps", @@ -42,7 +41,6 @@ cc_library_static { static_libs: [ "android.hardware.graphics.composer@2.1-vts", "android.hardware.graphics.composer@2.2", - "android.hardware.graphics.mapper@2.1-vts", "libarect", "libgtest", "libmath", @@ -50,15 +48,10 @@ cc_library_static { "librenderengine", "libshaders", "libtonemap", - "android.hardware.graphics.mapper@3.0", - "android.hardware.graphics.mapper@3.0-vts", - "android.hardware.graphics.mapper@4.0", - "android.hardware.graphics.mapper@4.0-vts", ], export_static_lib_headers: [ "android.hardware.graphics.composer@2.1-vts", "android.hardware.graphics.composer@2.2", - "android.hardware.graphics.mapper@2.1-vts", ], header_libs: [ "android.hardware.graphics.composer@2.2-command-buffer", diff --git a/graphics/composer/2.2/utils/vts/ComposerVts.cpp b/graphics/composer/2.2/utils/vts/ComposerVts.cpp index d4f028169f802a68d74aac60fe6f40cf38e79a52..d0410648ac6f649cabc7ff4c0087560e5e824b79 100644 --- a/graphics/composer/2.2/utils/vts/ComposerVts.cpp +++ b/graphics/composer/2.2/utils/vts/ComposerVts.cpp @@ -179,66 +179,6 @@ std::array ComposerClient::getDataspaceSaturationMatrix(Dataspace dat return matrix; } -Gralloc::Gralloc() { - [this] { - ALOGD("Attempting to initialize gralloc4"); - ASSERT_NO_FATAL_FAILURE(mGralloc4 = std::make_shared( - /*aidlAllocatorServiceName*/ IAllocator::descriptor + - std::string("/default"), - /*hidlAllocatorServiceName*/ "default", - /*mapperServiceName*/ "default", - /*errOnFailure=*/false)); - if (mGralloc4->getMapper() == nullptr || !mGralloc4->hasAllocator()) { - mGralloc4 = nullptr; - ALOGD("Failed to initialize gralloc4, initializing gralloc3"); - ASSERT_NO_FATAL_FAILURE(mGralloc3 = std::make_shared("default", "default", - /*errOnFailure=*/false)); - if (mGralloc3->getMapper() == nullptr || mGralloc3->getAllocator() == nullptr) { - mGralloc3 = nullptr; - ALOGD("Failed to initialize gralloc3, initializing gralloc2_1"); - mGralloc2_1 = std::make_shared(/*errOnFailure*/ false); - if (!mGralloc2_1->getMapper()) { - mGralloc2_1 = nullptr; - ALOGD("Failed to initialize gralloc2_1, initializing gralloc2"); - ASSERT_NO_FATAL_FAILURE(mGralloc2 = std::make_shared()); - } - } - } - }(); -} - -bool Gralloc::validateBufferSize(const native_handle_t* bufferHandle, uint32_t width, - uint32_t height, uint32_t layerCount, PixelFormat format, - uint64_t usage, uint32_t stride) { - if (mGralloc4) { - IMapper4::BufferDescriptorInfo info{}; - info.width = width; - info.height = height; - info.layerCount = layerCount; - info.format = static_cast(format); - info.usage = usage; - return mGralloc4->validateBufferSize(bufferHandle, info, stride); - } else if (mGralloc3) { - IMapper3::BufferDescriptorInfo info{}; - info.width = width; - info.height = height; - info.layerCount = layerCount; - info.format = static_cast(format); - info.usage = usage; - return mGralloc3->validateBufferSize(bufferHandle, info, stride); - } else if (mGralloc2_1) { - IMapper2_1::BufferDescriptorInfo info{}; - info.width = width; - info.height = height; - info.layerCount = layerCount; - info.format = static_cast(format); - info.usage = usage; - return mGralloc2_1->validateBufferSize(bufferHandle, info, stride); - } else { - return true; - } -} - } // namespace vts } // namespace V2_2 } // namespace composer diff --git a/graphics/composer/2.2/utils/vts/ReadbackVts.cpp b/graphics/composer/2.2/utils/vts/ReadbackVts.cpp index a1794afeed86bfea924cee0e6663b163c5cf78d3..9ba34f17c57420787c37e568295b62fd3e740aa9 100644 --- a/graphics/composer/2.2/utils/vts/ReadbackVts.cpp +++ b/graphics/composer/2.2/utils/vts/ReadbackVts.cpp @@ -187,12 +187,11 @@ void ReadbackHelper::compareColorBuffers(std::vector& ex } ReadbackBuffer::ReadbackBuffer(Display display, const std::shared_ptr& client, - const std::shared_ptr& gralloc, uint32_t width, - uint32_t height, PixelFormat pixelFormat, Dataspace dataspace) { + uint32_t width, uint32_t height, PixelFormat pixelFormat, + Dataspace dataspace) { mDisplay = display; mComposerClient = client; - mGralloc = gralloc; mPixelFormat = pixelFormat; mDataspace = dataspace; @@ -202,20 +201,12 @@ ReadbackBuffer::ReadbackBuffer(Display display, const std::shared_ptr(BufferUsage::CPU_READ_OFTEN | BufferUsage::GPU_TEXTURE); - - mAccessRegion.top = 0; - mAccessRegion.left = 0; - mAccessRegion.width = width; - mAccessRegion.height = height; } void ReadbackBuffer::setReadbackBuffer() { - mBufferHandle.reset(new Gralloc::NativeHandleWrapper( - mGralloc->allocate(mWidth, mHeight, mLayerCount, mFormat, mUsage, - /*import*/ true, &mStride))); - ASSERT_NE(false, mGralloc->validateBufferSize(mBufferHandle->get(), mWidth, mHeight, - mLayerCount, mFormat, mUsage, mStride)); - ASSERT_NO_FATAL_FAILURE(mComposerClient->setReadbackBuffer(mDisplay, mBufferHandle->get(), -1)); + mBuffer = sp::make(mWidth, mHeight, (int32_t)mFormat, mLayerCount, mUsage); + ASSERT_EQ(STATUS_OK, mBuffer->initCheck()); + ASSERT_NO_FATAL_FAILURE(mComposerClient->setReadbackBuffer(mDisplay, mBuffer->handle, -1)); } void ReadbackBuffer::checkReadbackBuffer(std::vector expectedColors) { @@ -223,15 +214,14 @@ void ReadbackBuffer::checkReadbackBuffer(std::vector exp int32_t fenceHandle; ASSERT_NO_FATAL_FAILURE(mComposerClient->getReadbackBufferFence(mDisplay, &fenceHandle)); - void* bufData = mGralloc->lock(mBufferHandle->get(), mUsage, mAccessRegion, fenceHandle); + void* bufData = nullptr; + int32_t stride = mBuffer->stride; + status_t status = mBuffer->lockAsync(mUsage, &bufData, fenceHandle); + ASSERT_EQ(STATUS_OK, status); ASSERT_TRUE(mPixelFormat == PixelFormat::RGB_888 || mPixelFormat == PixelFormat::RGBA_8888); - ReadbackHelper::compareColorBuffers(expectedColors, bufData, mStride, mWidth, mHeight, + ReadbackHelper::compareColorBuffers(expectedColors, bufData, stride, mWidth, mHeight, mPixelFormat); - int32_t unlockFence = mGralloc->unlock(mBufferHandle->get()); - if (unlockFence != -1) { - sync_wait(unlockFence, -1); - close(unlockFence); - } + EXPECT_EQ(STATUS_OK, mBuffer->unlock()); } void TestColorLayer::write(const std::shared_ptr& writer) { @@ -251,12 +241,10 @@ LayerSettings TestColorLayer::toRenderEngineLayerSettings() { } TestBufferLayer::TestBufferLayer(const std::shared_ptr& client, - const std::shared_ptr& gralloc, TestRenderEngine& renderEngine, Display display, int32_t width, int32_t height, PixelFormat format, IComposerClient::Composition composition) : TestLayer{client, display}, mRenderEngine(renderEngine) { - mGralloc = gralloc; mComposition = composition; mWidth = width; mHeight = height; @@ -265,11 +253,6 @@ TestBufferLayer::TestBufferLayer(const std::shared_ptr& client, mUsage = static_cast(BufferUsage::CPU_READ_OFTEN | BufferUsage::CPU_WRITE_OFTEN | BufferUsage::COMPOSER_OVERLAY | BufferUsage::GPU_TEXTURE); - mAccessRegion.top = 0; - mAccessRegion.left = 0; - mAccessRegion.width = width; - mAccessRegion.height = height; - setSourceCrop({0, 0, (float)width, (float)height}); } @@ -277,15 +260,13 @@ void TestBufferLayer::write(const std::shared_ptr& writer) { TestLayer::write(writer); writer->setLayerCompositionType(mComposition); writer->setLayerVisibleRegion(std::vector(1, mDisplayFrame)); - if (mBufferHandle != nullptr) writer->setLayerBuffer(0, mBufferHandle->get(), mFillFence); + if (mBuffer) writer->setLayerBuffer(0, mBuffer->handle, -1); } LayerSettings TestBufferLayer::toRenderEngineLayerSettings() { LayerSettings layerSettings = TestLayer::toRenderEngineLayerSettings(); layerSettings.source.buffer.buffer = std::make_shared( - new GraphicBuffer(mBufferHandle->get(), GraphicBuffer::CLONE_HANDLE, mWidth, mHeight, - static_cast(mFormat), 1, mUsage, mStride), - mRenderEngine.getInternalRenderEngine(), + mBuffer, mRenderEngine.getInternalRenderEngine(), renderengine::impl::ExternalTexture::Usage::READABLE); layerSettings.source.buffer.usePremultipliedAlpha = @@ -304,24 +285,18 @@ LayerSettings TestBufferLayer::toRenderEngineLayerSettings() { } void TestBufferLayer::fillBuffer(std::vector expectedColors) { - void* bufData = mGralloc->lock(mBufferHandle->get(), mUsage, mAccessRegion, -1); - ASSERT_NO_FATAL_FAILURE( - ReadbackHelper::fillBuffer(mWidth, mHeight, mStride, bufData, mFormat, expectedColors)); - mFillFence = mGralloc->unlock(mBufferHandle->get()); - if (mFillFence != -1) { - sync_wait(mFillFence, -1); - close(mFillFence); - } + void* bufData = nullptr; + status_t status = mBuffer->lock(mUsage, &bufData); + ASSERT_EQ(STATUS_OK, status); + ASSERT_NO_FATAL_FAILURE(ReadbackHelper::fillBuffer(mWidth, mHeight, mBuffer->stride, bufData, + mFormat, expectedColors)); + EXPECT_EQ(STATUS_OK, mBuffer->unlock()); } void TestBufferLayer::setBuffer(std::vector colors) { - mBufferHandle.reset(new Gralloc::NativeHandleWrapper( - mGralloc->allocate(mWidth, mHeight, mLayerCount, mFormat, mUsage, - /*import*/ true, &mStride))); - ASSERT_NE(nullptr, mBufferHandle->get()); + mBuffer = sp::make(mWidth, mHeight, (int32_t)mFormat, mLayerCount, mUsage); + ASSERT_EQ(STATUS_OK, mBuffer->initCheck()); ASSERT_NO_FATAL_FAILURE(fillBuffer(colors)); - ASSERT_NE(false, mGralloc->validateBufferSize(mBufferHandle->get(), mWidth, mHeight, - mLayerCount, mFormat, mUsage, mStride)); } void TestBufferLayer::setDataspace(Dataspace dataspace, diff --git a/graphics/composer/2.2/utils/vts/RenderEngineVts.cpp b/graphics/composer/2.2/utils/vts/RenderEngineVts.cpp index 1700b2ade97c65816994e2a1f87be82bde2ed2ae..6960d069f155fbf77b1176d946fb79c3c325ff7e 100644 --- a/graphics/composer/2.2/utils/vts/RenderEngineVts.cpp +++ b/graphics/composer/2.2/utils/vts/RenderEngineVts.cpp @@ -24,7 +24,6 @@ namespace composer { namespace V2_2 { namespace vts { -using mapper::V2_1::IMapper; using renderengine::DisplaySettings; using renderengine::LayerSettings; using renderengine::RenderEngineCreationArgs; @@ -72,7 +71,7 @@ void TestRenderEngine::drawLayers() { auto texture = std::make_shared( mGraphicBuffer, *mRenderEngine, renderengine::impl::ExternalTexture::Usage::WRITEABLE); auto result = mRenderEngine - ->drawLayers(mDisplaySettings, compositionLayers, texture, true, + ->drawLayers(mDisplaySettings, compositionLayers, texture, std::move(bufferFence)) .get(); if (result.ok()) { diff --git a/graphics/composer/2.2/utils/vts/include/composer-vts/2.2/ComposerVts.h b/graphics/composer/2.2/utils/vts/include/composer-vts/2.2/ComposerVts.h index 02d7bdb9dac5de49bb0dfb9a54a6c8d245d927c4..3e26d9483f79f1357c3a67e46c3a990b15862cf0 100644 --- a/graphics/composer/2.2/utils/vts/include/composer-vts/2.2/ComposerVts.h +++ b/graphics/composer/2.2/utils/vts/include/composer-vts/2.2/ComposerVts.h @@ -26,7 +26,6 @@ #include #include #include -#include #include namespace android { @@ -41,14 +40,6 @@ using common::V1_1::ColorMode; using common::V1_1::Dataspace; using common::V1_1::PixelFormat; using common::V1_1::RenderIntent; -using IMapper2_1 = android::hardware::graphics::mapper::V2_1::IMapper; -using IMapper3 = android::hardware::graphics::mapper::V3_0::IMapper; -using IMapper4 = android::hardware::graphics::mapper::V4_0::IMapper; -using Gralloc2 = android::hardware::graphics::mapper::V2_0::vts::Gralloc; -using Gralloc2_1 = android::hardware::graphics::mapper::V2_1::vts::Gralloc; -using Gralloc3 = android::hardware::graphics::mapper::V3_0::vts::Gralloc; -using Gralloc4 = android::hardware::graphics::mapper::V4_0::vts::Gralloc; -using IAllocator = aidl::android::hardware::graphics::allocator::IAllocator; class ComposerClient; @@ -92,28 +83,6 @@ class ComposerClient : public V2_1::vts::ComposerClient { const sp mClient; }; -class Gralloc : public V2_1::vts::Gralloc { - public: - using NativeHandleWrapper = V2_1::vts::NativeHandleWrapper; - - Gralloc(); - const NativeHandleWrapper allocate(uint32_t width, uint32_t height, uint32_t layerCount, - PixelFormat format, uint64_t usage, bool import = true, - uint32_t* outStride = nullptr) { - return V2_1::vts::Gralloc::allocate( - width, height, layerCount, - static_cast(format), usage, - import, outStride); - } - - bool validateBufferSize(const native_handle_t* bufferHandle, uint32_t width, uint32_t height, - uint32_t layerCount, PixelFormat format, uint64_t usage, - uint32_t stride); - - protected: - std::shared_ptr mGralloc2_1 = nullptr; -}; - } // namespace vts } // namespace V2_2 } // namespace composer diff --git a/graphics/composer/2.2/utils/vts/include/composer-vts/2.2/ReadbackVts.h b/graphics/composer/2.2/utils/vts/include/composer-vts/2.2/ReadbackVts.h index 58efde9b5ace8737e64706a944d36efe85d2d6b1..aa6932ad0dc8ef04db76e955b00c2f59e299a211 100644 --- a/graphics/composer/2.2/utils/vts/include/composer-vts/2.2/ReadbackVts.h +++ b/graphics/composer/2.2/utils/vts/include/composer-vts/2.2/ReadbackVts.h @@ -22,7 +22,6 @@ #include #include #include -#include #include #include @@ -38,12 +37,9 @@ using android::hardware::hidl_handle; using common::V1_1::BufferUsage; using common::V1_1::Dataspace; using common::V1_1::PixelFormat; -using IMapper2_1 = mapper::V2_1::IMapper; -using Gralloc2_1 = mapper::V2_1::vts::Gralloc; using renderengine::LayerSettings; using V2_1::Display; using V2_1::Layer; -using V2_1::vts::AccessRegion; using V2_1::vts::TestCommandReader; static const IComposerClient::Color BLACK = {0, 0, 0, 0xff}; @@ -113,9 +109,8 @@ class TestColorLayer : public TestLayer { class TestBufferLayer : public TestLayer { public: TestBufferLayer( - const std::shared_ptr& client, const std::shared_ptr& gralloc, - TestRenderEngine& renderEngine, Display display, int32_t width, int32_t height, - PixelFormat format, + const std::shared_ptr& client, TestRenderEngine& renderEngine, + Display display, int32_t width, int32_t height, PixelFormat format, IComposerClient::Composition composition = IComposerClient::Composition::DEVICE); void write(const std::shared_ptr& writer) override; @@ -135,15 +130,11 @@ class TestBufferLayer : public TestLayer { uint32_t mLayerCount; PixelFormat mFormat; uint64_t mUsage; - AccessRegion mAccessRegion; - uint32_t mStride; protected: IComposerClient::Composition mComposition; - std::shared_ptr mGralloc; TestRenderEngine& mRenderEngine; - int32_t mFillFence; - std::unique_ptr mBufferHandle; + sp mBuffer; }; class ReadbackHelper { @@ -179,9 +170,8 @@ class ReadbackHelper { class ReadbackBuffer { public: - ReadbackBuffer(Display display, const std::shared_ptr& client, - const std::shared_ptr& gralloc, uint32_t width, uint32_t height, - PixelFormat pixelFormat, Dataspace dataspace); + ReadbackBuffer(Display display, const std::shared_ptr& client, uint32_t width, + uint32_t height, PixelFormat pixelFormat, Dataspace dataspace); void setReadbackBuffer(); @@ -193,13 +183,10 @@ class ReadbackBuffer { uint32_t mLayerCount; PixelFormat mFormat; uint64_t mUsage; - AccessRegion mAccessRegion; - uint32_t mStride; - std::unique_ptr mBufferHandle = nullptr; + sp mBuffer; PixelFormat mPixelFormat; Dataspace mDataspace; Display mDisplay; - std::shared_ptr mGralloc; std::shared_ptr mComposerClient; }; diff --git a/graphics/composer/2.2/utils/vts/include/composer-vts/2.2/RenderEngineVts.h b/graphics/composer/2.2/utils/vts/include/composer-vts/2.2/RenderEngineVts.h index 26027d33a2573b8f072cbcdecd0b8281cd036b2a..09b89ffa234b3df1583cceb6e7d390f3aa519cfe 100644 --- a/graphics/composer/2.2/utils/vts/include/composer-vts/2.2/RenderEngineVts.h +++ b/graphics/composer/2.2/utils/vts/include/composer-vts/2.2/RenderEngineVts.h @@ -22,7 +22,6 @@ #include #include #include -#include #include #include #include @@ -34,10 +33,8 @@ namespace composer { namespace V2_2 { namespace vts { -using mapper::V2_1::IMapper; using renderengine::DisplaySettings; using renderengine::RenderEngineCreationArgs; -using vts::Gralloc; class TestRenderEngine { public: diff --git a/graphics/composer/2.2/vts/functional/Android.bp b/graphics/composer/2.2/vts/functional/Android.bp index 34763766dae7bf8f22146ba744379d3a85f7a107..a781712783c5de20a7b3af04774e3341b3aebbea 100644 --- a/graphics/composer/2.2/vts/functional/Android.bp +++ b/graphics/composer/2.2/vts/functional/Android.bp @@ -27,7 +27,6 @@ cc_test { name: "VtsHalGraphicsComposerV2_2TargetTest", defaults: [ "VtsHalTargetTestDefaults", - "android.hardware.graphics.allocator-ndk_static", "android.hardware.graphics.composer3-ndk_static", "librenderengine_deps", ], @@ -54,24 +53,13 @@ cc_test { "libsync", "libui", "android.hardware.common-V2-ndk", - "android.hardware.graphics.mapper@2.0", - "android.hardware.graphics.mapper@2.1", - "android.hardware.graphics.mapper@3.0", - "android.hardware.graphics.mapper@4.0", ], static_libs: [ - "android.hardware.graphics.allocator@2.0", - "android.hardware.graphics.allocator@3.0", - "android.hardware.graphics.allocator@4.0", "android.hardware.graphics.common@1.1", "android.hardware.graphics.composer@2.1", "android.hardware.graphics.composer@2.1-vts", "android.hardware.graphics.composer@2.2", "android.hardware.graphics.composer@2.2-vts", - "android.hardware.graphics.mapper@2.0-vts", - "android.hardware.graphics.mapper@2.1-vts", - "android.hardware.graphics.mapper@3.0-vts", - "android.hardware.graphics.mapper@4.0-vts", "libaidlcommonsupport", "libgtest", "librenderengine", diff --git a/graphics/composer/2.2/vts/functional/VtsHalGraphicsComposerV2_2ReadbackTest.cpp b/graphics/composer/2.2/vts/functional/VtsHalGraphicsComposerV2_2ReadbackTest.cpp index e2a0f4d22fa816d10d19c2ebf7c8298bfd3a3c7d..74d2f03ba373e6e49cae3fb0682ac0fd818b4be1 100644 --- a/graphics/composer/2.2/vts/functional/VtsHalGraphicsComposerV2_2ReadbackTest.cpp +++ b/graphics/composer/2.2/vts/functional/VtsHalGraphicsComposerV2_2ReadbackTest.cpp @@ -26,7 +26,6 @@ #include #include #include -#include #include #include #include @@ -45,9 +44,7 @@ using common::V1_1::Dataspace; using common::V1_1::PixelFormat; using V2_1::Config; using V2_1::Display; -using V2_1::vts::NativeHandleWrapper; using V2_1::vts::TestCommandReader; -using vts::Gralloc; class GraphicsCompositionTestBase : public ::testing::Test { protected: @@ -79,20 +76,19 @@ class GraphicsCompositionTestBase : public ::testing::Test { // set up command writer/reader and gralloc mWriter = std::make_shared(1024); mReader = std::make_unique(); - mGralloc = std::make_shared(); ASSERT_NO_FATAL_FAILURE(mComposerClient->setPowerMode(mPrimaryDisplay, PowerMode::ON)); ASSERT_NO_FATAL_FAILURE( mTestRenderEngine = std::unique_ptr(new TestRenderEngine( renderengine::RenderEngineCreationArgs::Builder() - .setPixelFormat(static_cast(ui::PixelFormat::RGBA_8888)) - .setImageCacheSize(TestRenderEngine::sMaxFrameBufferAcquireBuffers) - .setUseColorManagerment(true) - .setEnableProtectedContext(false) - .setPrecacheToneMapperShaderOnly(false) - .setContextPriority(renderengine::RenderEngine::ContextPriority::HIGH) - .build()))); + .setPixelFormat(static_cast(ui::PixelFormat::RGBA_8888)) + .setImageCacheSize(TestRenderEngine::sMaxFrameBufferAcquireBuffers) + .setEnableProtectedContext(false) + .setPrecacheToneMapperShaderOnly(false) + .setContextPriority( + renderengine::RenderEngine::ContextPriority::HIGH) + .build()))); renderengine::DisplaySettings clientCompositionDisplay; clientCompositionDisplay.physicalDisplay = Rect(mDisplayWidth, mDisplayHeight); @@ -143,7 +139,6 @@ class GraphicsCompositionTestBase : public ::testing::Test { std::vector mTestColorModes; std::shared_ptr mWriter; std::unique_ptr mReader; - std::shared_ptr mGralloc; std::unique_ptr mTestRenderEngine; bool mHasReadbackBuffer; @@ -220,7 +215,7 @@ TEST_P(GraphicsCompositionTest, SingleSolidColorLayer) { std::vector expectedColors(mDisplayWidth * mDisplayHeight); ReadbackHelper::fillColorsArea(expectedColors, mDisplayWidth, coloredSquare, BLUE); - ReadbackBuffer readbackBuffer(mPrimaryDisplay, mComposerClient, mGralloc, mDisplayWidth, + ReadbackBuffer readbackBuffer(mPrimaryDisplay, mComposerClient, mDisplayWidth, mDisplayHeight, mPixelFormat, mDataspace); ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer()); @@ -272,7 +267,7 @@ TEST_P(GraphicsCompositionTest, SetLayerBuffer) { mWriter->selectDisplay(mPrimaryDisplay); - ReadbackBuffer readbackBuffer(mPrimaryDisplay, mComposerClient, mGralloc, mDisplayWidth, + ReadbackBuffer readbackBuffer(mPrimaryDisplay, mComposerClient, mDisplayWidth, mDisplayHeight, mPixelFormat, mDataspace); ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer()); std::vector expectedColors(mDisplayWidth * mDisplayHeight); @@ -285,9 +280,9 @@ TEST_P(GraphicsCompositionTest, SetLayerBuffer) { {0, mDisplayHeight / 2, mDisplayWidth, mDisplayHeight}, BLUE); - auto layer = std::make_shared( - mComposerClient, mGralloc, *mTestRenderEngine, mPrimaryDisplay, mDisplayWidth, - mDisplayHeight, PixelFormat::RGBA_8888); + auto layer = std::make_shared(mComposerClient, *mTestRenderEngine, + mPrimaryDisplay, mDisplayWidth, + mDisplayHeight, PixelFormat::RGBA_8888); layer->setDisplayFrame({0, 0, mDisplayWidth, mDisplayHeight}); layer->setZOrder(10); layer->setDataspace(ReadbackHelper::getDataspaceForColorMode(mode), mWriter); @@ -352,15 +347,16 @@ TEST_P(GraphicsCompositionTest, SetLayerBufferNoEffect) { // This following buffer call should have no effect uint64_t usage = static_cast(BufferUsage::CPU_READ_OFTEN | BufferUsage::CPU_WRITE_OFTEN); - NativeHandleWrapper bufferHandle = - mGralloc->allocate(mDisplayWidth, mDisplayHeight, 1, PixelFormat::RGBA_8888, usage); - mWriter->setLayerBuffer(0, bufferHandle.get(), -1); + sp buffer = sp::make( + mDisplayWidth, mDisplayHeight, (int32_t)PixelFormat::RGBA_8888, 1, usage); + ASSERT_EQ(STATUS_OK, buffer->initCheck()); + mWriter->setLayerBuffer(0, buffer->handle, -1); // expected color for each pixel std::vector expectedColors(mDisplayWidth * mDisplayHeight); ReadbackHelper::fillColorsArea(expectedColors, mDisplayWidth, coloredSquare, BLUE); - ReadbackBuffer readbackBuffer(mPrimaryDisplay, mComposerClient, mGralloc, mDisplayWidth, + ReadbackBuffer readbackBuffer(mPrimaryDisplay, mComposerClient, mDisplayWidth, mDisplayHeight, mPixelFormat, mDataspace); ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer()); @@ -419,16 +415,16 @@ TEST_P(GraphicsCompositionTest, ClientComposition) { {0, mDisplayHeight / 2, mDisplayWidth, mDisplayHeight}, BLUE); - auto layer = std::make_shared( - mComposerClient, mGralloc, *mTestRenderEngine, mPrimaryDisplay, mDisplayWidth, - mDisplayHeight, PixelFormat::RGBA_FP16); + auto layer = std::make_shared(mComposerClient, *mTestRenderEngine, + mPrimaryDisplay, mDisplayWidth, + mDisplayHeight, PixelFormat::RGBA_FP16); layer->setDisplayFrame({0, 0, mDisplayWidth, mDisplayHeight}); layer->setZOrder(10); layer->setDataspace(ReadbackHelper::getDataspaceForColorMode(mode), mWriter); std::vector> layers = {layer}; - ReadbackBuffer readbackBuffer(mPrimaryDisplay, mComposerClient, mGralloc, mDisplayWidth, + ReadbackBuffer readbackBuffer(mPrimaryDisplay, mComposerClient, mDisplayWidth, mDisplayHeight, mPixelFormat, mDataspace); ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer()); writeLayers(layers); @@ -462,25 +458,20 @@ TEST_P(GraphicsCompositionTest, ClientComposition) { } // create client target buffer - uint32_t clientStride; - NativeHandleWrapper clientBufferHandle = - mGralloc->allocate(layer->mWidth, layer->mHeight, layer->mLayerCount, - clientFormat, clientUsage, /*import*/ true, &clientStride); - ASSERT_NE(nullptr, clientBufferHandle.get()); + sp clientBuffer = + sp::make(layer->mWidth, layer->mHeight, (int32_t)clientFormat, + layer->mLayerCount, clientUsage); + ASSERT_EQ(STATUS_OK, clientBuffer->initCheck()); - void* clientBufData = - mGralloc->lock(clientBufferHandle.get(), clientUsage, layer->mAccessRegion, -1); + void* clientBufData = nullptr; + ASSERT_EQ(STATUS_OK, clientBuffer->lock(clientUsage, &clientBufData)); ASSERT_NO_FATAL_FAILURE(ReadbackHelper::fillBuffer(layer->mWidth, layer->mHeight, - clientStride, clientBufData, + clientBuffer->stride, clientBufData, clientFormat, expectedColors)); - int clientFence = mGralloc->unlock(clientBufferHandle.get()); - if (clientFence != -1) { - sync_wait(clientFence, -1); - close(clientFence); - } + clientBuffer->unlock(); - mWriter->setClientTarget(0, clientBufferHandle.get(), clientFence, clientDataspace, + mWriter->setClientTarget(0, clientBuffer->handle, -1, clientDataspace, std::vector(1, damage)); layer->setToClientComposition(mWriter); @@ -531,12 +522,12 @@ TEST_P(GraphicsCompositionTest, DeviceAndClientComposition) { ReadbackHelper::fillColorsArea(expectedColors, mDisplayWidth, {0, mDisplayHeight / 2, mDisplayWidth, mDisplayHeight}, RED); - ReadbackBuffer readbackBuffer(mPrimaryDisplay, mComposerClient, mGralloc, mDisplayWidth, + ReadbackBuffer readbackBuffer(mPrimaryDisplay, mComposerClient, mDisplayWidth, mDisplayHeight, mPixelFormat, mDataspace); ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer()); auto deviceLayer = std::make_shared( - mComposerClient, mGralloc, *mTestRenderEngine, mPrimaryDisplay, mDisplayWidth, + mComposerClient, *mTestRenderEngine, mPrimaryDisplay, mDisplayWidth, mDisplayHeight / 2, PixelFormat::RGBA_8888); std::vector deviceColors(deviceLayer->mWidth * deviceLayer->mHeight); @@ -573,8 +564,8 @@ TEST_P(GraphicsCompositionTest, DeviceAndClientComposition) { } auto clientLayer = std::make_shared( - mComposerClient, mGralloc, *mTestRenderEngine, mPrimaryDisplay, clientWidth, - clientHeight, PixelFormat::RGBA_FP16, IComposerClient::Composition::DEVICE); + mComposerClient, *mTestRenderEngine, mPrimaryDisplay, clientWidth, clientHeight, + PixelFormat::RGBA_FP16, IComposerClient::Composition::DEVICE); IComposerClient::Rect clientFrame = {0, mDisplayHeight / 2, mDisplayWidth, mDisplayHeight}; clientLayer->setDisplayFrame(clientFrame); clientLayer->setZOrder(0); @@ -590,27 +581,22 @@ TEST_P(GraphicsCompositionTest, DeviceAndClientComposition) { } // create client target buffer ASSERT_EQ(1, mReader->mCompositionChanges[0].second); - uint32_t clientStride; - NativeHandleWrapper clientBufferHandle = - mGralloc->allocate(mDisplayWidth, mDisplayHeight, clientLayer->mLayerCount, - clientFormat, clientUsage, /*import*/ true, &clientStride); - ASSERT_NE(nullptr, clientBufferHandle.get()); + sp clientBuffer = + sp::make(mDisplayWidth, mDisplayHeight, (int32_t)clientFormat, + clientLayer->mLayerCount, clientUsage); + ASSERT_EQ(STATUS_OK, clientBuffer->initCheck()); - void* clientBufData = mGralloc->lock(clientBufferHandle.get(), clientUsage, - {0, 0, mDisplayWidth, mDisplayHeight}, -1); + void* clientBufData = nullptr; + ASSERT_EQ(STATUS_OK, clientBuffer->lock(clientUsage, &clientBufData)); std::vector clientColors(mDisplayWidth * mDisplayHeight); ReadbackHelper::fillColorsArea(clientColors, mDisplayWidth, clientFrame, RED); ASSERT_NO_FATAL_FAILURE(ReadbackHelper::fillBuffer(mDisplayWidth, mDisplayHeight, - clientStride, clientBufData, + clientBuffer->stride, clientBufData, clientFormat, clientColors)); - int clientFence = mGralloc->unlock(clientBufferHandle.get()); - if (clientFence != -1) { - sync_wait(clientFence, -1); - close(clientFence); - } + EXPECT_EQ(STATUS_OK, clientBuffer->unlock()); - mWriter->setClientTarget(0, clientBufferHandle.get(), clientFence, clientDataspace, + mWriter->setClientTarget(0, clientBuffer->handle, -1, clientDataspace, std::vector(1, clientFrame)); clientLayer->setToClientComposition(mWriter); mWriter->validateDisplay(); @@ -655,9 +641,9 @@ TEST_P(GraphicsCompositionTest, SetLayerDamage) { std::vector expectedColors(mDisplayWidth * mDisplayHeight); ReadbackHelper::fillColorsArea(expectedColors, mDisplayWidth, redRect, RED); - auto layer = std::make_shared( - mComposerClient, mGralloc, *mTestRenderEngine, mPrimaryDisplay, mDisplayWidth, - mDisplayHeight, PixelFormat::RGBA_8888); + auto layer = std::make_shared(mComposerClient, *mTestRenderEngine, + mPrimaryDisplay, mDisplayWidth, + mDisplayHeight, PixelFormat::RGBA_8888); layer->setDisplayFrame({0, 0, mDisplayWidth, mDisplayHeight}); layer->setZOrder(10); layer->setDataspace(ReadbackHelper::getDataspaceForColorMode(mode), mWriter); @@ -665,7 +651,7 @@ TEST_P(GraphicsCompositionTest, SetLayerDamage) { std::vector> layers = {layer}; - ReadbackBuffer readbackBuffer(mPrimaryDisplay, mComposerClient, mGralloc, mDisplayWidth, + ReadbackBuffer readbackBuffer(mPrimaryDisplay, mComposerClient, mDisplayWidth, mDisplayHeight, mPixelFormat, mDataspace); ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer()); @@ -742,7 +728,7 @@ TEST_P(GraphicsCompositionTest, SetLayerPlaneAlpha) { std::vector> layers = {layer}; - ReadbackBuffer readbackBuffer(mPrimaryDisplay, mComposerClient, mGralloc, mDisplayWidth, + ReadbackBuffer readbackBuffer(mPrimaryDisplay, mComposerClient, mDisplayWidth, mDisplayHeight, mPixelFormat, mDataspace); ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer()); @@ -803,9 +789,9 @@ TEST_P(GraphicsCompositionTest, SetLayerSourceCrop) { {0, mDisplayHeight / 2, mDisplayWidth, mDisplayHeight}, BLUE); - auto layer = std::make_shared( - mComposerClient, mGralloc, *mTestRenderEngine, mPrimaryDisplay, mDisplayWidth, - mDisplayHeight, PixelFormat::RGBA_8888); + auto layer = std::make_shared(mComposerClient, *mTestRenderEngine, + mPrimaryDisplay, mDisplayWidth, + mDisplayHeight, PixelFormat::RGBA_8888); layer->setDisplayFrame({0, 0, mDisplayWidth, mDisplayHeight}); layer->setZOrder(10); layer->setDataspace(ReadbackHelper::getDataspaceForColorMode(mode), mWriter); @@ -819,7 +805,7 @@ TEST_P(GraphicsCompositionTest, SetLayerSourceCrop) { // update expected colors to match crop ReadbackHelper::fillColorsArea(expectedColors, mDisplayWidth, {0, 0, mDisplayWidth, mDisplayHeight}, BLUE); - ReadbackBuffer readbackBuffer(mPrimaryDisplay, mComposerClient, mGralloc, mDisplayWidth, + ReadbackBuffer readbackBuffer(mPrimaryDisplay, mComposerClient, mDisplayWidth, mDisplayHeight, mPixelFormat, mDataspace); ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer()); writeLayers(layers); @@ -886,7 +872,7 @@ TEST_P(GraphicsCompositionTest, SetLayerZOrder) { ReadbackHelper::fillColorsArea(expectedColors, mDisplayWidth, blueRect, BLUE); ReadbackHelper::fillColorsArea(expectedColors, mDisplayWidth, redRect, RED); - ReadbackBuffer readbackBuffer(mPrimaryDisplay, mComposerClient, mGralloc, mDisplayWidth, + ReadbackBuffer readbackBuffer(mPrimaryDisplay, mComposerClient, mDisplayWidth, mDisplayHeight, mPixelFormat, mDataspace); ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer()); @@ -955,9 +941,9 @@ class GraphicsBlendModeCompositionTest backgroundLayer->setZOrder(0); backgroundLayer->setColor(mBackgroundColor); - auto layer = std::make_shared( - mComposerClient, mGralloc, *mTestRenderEngine, mPrimaryDisplay, mDisplayWidth, - mDisplayHeight, PixelFormat::RGBA_8888); + auto layer = std::make_shared(mComposerClient, *mTestRenderEngine, + mPrimaryDisplay, mDisplayWidth, + mDisplayHeight, PixelFormat::RGBA_8888); layer->setDisplayFrame({0, 0, mDisplayWidth, mDisplayHeight}); layer->setZOrder(10); layer->setDataspace(Dataspace::UNKNOWN, mWriter); @@ -1043,7 +1029,7 @@ TEST_P(GraphicsBlendModeCompositionTest, DISABLED_None) { setUpLayers(IComposerClient::BlendMode::NONE); setExpectedColors(expectedColors); - ReadbackBuffer readbackBuffer(mPrimaryDisplay, mComposerClient, mGralloc, mDisplayWidth, + ReadbackBuffer readbackBuffer(mPrimaryDisplay, mComposerClient, mDisplayWidth, mDisplayHeight, mPixelFormat, mDataspace); ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer()); writeLayers(mLayers); @@ -1102,7 +1088,7 @@ TEST_P(GraphicsBlendModeCompositionTest, DISABLED_Coverage) { setUpLayers(IComposerClient::BlendMode::COVERAGE); setExpectedColors(expectedColors); - ReadbackBuffer readbackBuffer(mPrimaryDisplay, mComposerClient, mGralloc, mDisplayWidth, + ReadbackBuffer readbackBuffer(mPrimaryDisplay, mComposerClient, mDisplayWidth, mDisplayHeight, mPixelFormat, mDataspace); ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer()); writeLayers(mLayers); @@ -1153,7 +1139,7 @@ TEST_P(GraphicsBlendModeCompositionTest, Premultiplied) { setUpLayers(IComposerClient::BlendMode::PREMULTIPLIED); setExpectedColors(expectedColors); - ReadbackBuffer readbackBuffer(mPrimaryDisplay, mComposerClient, mGralloc, mDisplayWidth, + ReadbackBuffer readbackBuffer(mPrimaryDisplay, mComposerClient, mDisplayWidth, mDisplayHeight, mPixelFormat, mDataspace); ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer()); writeLayers(mLayers); @@ -1193,7 +1179,7 @@ class GraphicsTransformCompositionTest : public GraphicsCompositionTest { IComposerClient::Rect blueRect = {mSideLength / 2, mSideLength / 2, mSideLength, mSideLength}; - mLayer = std::make_shared(mComposerClient, mGralloc, *mTestRenderEngine, + mLayer = std::make_shared(mComposerClient, *mTestRenderEngine, mPrimaryDisplay, mSideLength, mSideLength, PixelFormat::RGBA_8888); mLayer->setDisplayFrame({0, 0, mSideLength, mSideLength}); @@ -1236,7 +1222,7 @@ TEST_P(GraphicsTransformCompositionTest, FLIP_H) { GTEST_SUCCEED() << "Readback not supported or unsupported pixelFormat/dataspace"; return; } - ReadbackBuffer readbackBuffer(mPrimaryDisplay, mComposerClient, mGralloc, mDisplayWidth, + ReadbackBuffer readbackBuffer(mPrimaryDisplay, mComposerClient, mDisplayWidth, mDisplayHeight, mPixelFormat, mDataspace); ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer()); mLayer->setTransform(Transform::FLIP_H); @@ -1291,7 +1277,7 @@ TEST_P(GraphicsTransformCompositionTest, FLIP_V) { GTEST_SUCCEED() << "Readback not supported or unsupported pixelFormat/dataspace"; return; } - ReadbackBuffer readbackBuffer(mPrimaryDisplay, mComposerClient, mGralloc, mDisplayWidth, + ReadbackBuffer readbackBuffer(mPrimaryDisplay, mComposerClient, mDisplayWidth, mDisplayHeight, mPixelFormat, mDataspace); ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer()); @@ -1346,7 +1332,7 @@ TEST_P(GraphicsTransformCompositionTest, ROT_180) { GTEST_SUCCEED() << "Readback not supported or unsupported pixelFormat/dataspace"; return; } - ReadbackBuffer readbackBuffer(mPrimaryDisplay, mComposerClient, mGralloc, mDisplayWidth, + ReadbackBuffer readbackBuffer(mPrimaryDisplay, mComposerClient, mDisplayWidth, mDisplayHeight, mPixelFormat, mDataspace); ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer()); diff --git a/graphics/composer/2.2/vts/functional/VtsHalGraphicsComposerV2_2TargetTest.cpp b/graphics/composer/2.2/vts/functional/VtsHalGraphicsComposerV2_2TargetTest.cpp index 13ae089d65ba72ce98402714770f088d4a8efa85..2bd287b29dfd2e949269e27c0dcbeeab79ab0204 100644 --- a/graphics/composer/2.2/vts/functional/VtsHalGraphicsComposerV2_2TargetTest.cpp +++ b/graphics/composer/2.2/vts/functional/VtsHalGraphicsComposerV2_2TargetTest.cpp @@ -18,14 +18,13 @@ #include #include -#include #include #include #include #include #include #include -#include +#include namespace android { namespace hardware { @@ -40,7 +39,6 @@ using common::V1_1::ColorMode; using common::V1_1::Dataspace; using common::V1_1::PixelFormat; using common::V1_1::RenderIntent; -using V2_1::vts::NativeHandleWrapper; class GraphicsComposerHidlTest : public ::testing::TestWithParam { protected: @@ -141,8 +139,6 @@ class GraphicsComposerHidlCommandTest : public GraphicsComposerHidlTest { void SetUp() override { ASSERT_NO_FATAL_FAILURE(GraphicsComposerHidlTest::SetUp()); - ASSERT_NO_FATAL_FAILURE(mGralloc = std::make_unique()); - mWriter = std::make_unique(1024); mReader = std::make_unique(); } @@ -152,20 +148,10 @@ class GraphicsComposerHidlCommandTest : public GraphicsComposerHidlTest { ASSERT_NO_FATAL_FAILURE(GraphicsComposerHidlTest::TearDown()); } - NativeHandleWrapper allocate() { - uint64_t usage = - static_cast(BufferUsage::CPU_WRITE_OFTEN | BufferUsage::CPU_READ_OFTEN); - return mGralloc->allocate(/*width*/ 64, /*height*/ 64, /*layerCount*/ 1, - PixelFormat::RGBA_8888, usage); - } - void execute() { mComposerClient->execute(mReader.get(), mWriter.get()); } std::unique_ptr mWriter; std::unique_ptr mReader; - - private: - std::unique_ptr mGralloc; }; /** @@ -437,13 +423,11 @@ TEST_P(GraphicsComposerHidlTest, SetReadbackBuffer) { uint64_t usage = static_cast(BufferUsage::COMPOSER_OVERLAY | BufferUsage::CPU_READ_OFTEN); - std::unique_ptr gralloc; - std::unique_ptr buffer; - ASSERT_NO_FATAL_FAILURE(gralloc = std::make_unique()); - ASSERT_NO_FATAL_FAILURE(buffer.reset(new NativeHandleWrapper( - gralloc->allocate(mDisplayWidth, mDisplayHeight, 1, mReadbackPixelFormat, usage)))); + sp buffer = sp::make(mDisplayWidth, mDisplayHeight, + (int32_t)mReadbackPixelFormat, 1, usage); + ASSERT_EQ(STATUS_OK, buffer->initCheck()); - mComposerClient->setReadbackBuffer(mPrimaryDisplay, buffer->get(), -1); + mComposerClient->setReadbackBuffer(mPrimaryDisplay, buffer->handle, -1); } /** @@ -460,14 +444,12 @@ TEST_P(GraphicsComposerHidlTest, SetReadbackBufferBadDisplay) { uint64_t usage = static_cast(BufferUsage::COMPOSER_OVERLAY | BufferUsage::CPU_READ_OFTEN); - std::unique_ptr gralloc; - std::unique_ptr buffer; - ASSERT_NO_FATAL_FAILURE(gralloc = std::make_unique()); - ASSERT_NO_FATAL_FAILURE(buffer.reset(new NativeHandleWrapper( - gralloc->allocate(mDisplayWidth, mDisplayHeight, 1, mReadbackPixelFormat, usage)))); + sp buffer = sp::make(mDisplayWidth, mDisplayHeight, + (int32_t)mReadbackPixelFormat, 1, usage); + ASSERT_EQ(STATUS_OK, buffer->initCheck()); - Error error = - mComposerClient->getRaw()->setReadbackBuffer(mInvalidDisplayId, buffer->get(), nullptr); + Error error = mComposerClient->getRaw()->setReadbackBuffer(mInvalidDisplayId, buffer->handle, + nullptr); ASSERT_EQ(Error::BAD_DISPLAY, error); } diff --git a/graphics/composer/2.3/utils/vts/Android.bp b/graphics/composer/2.3/utils/vts/Android.bp index b372804341bd033cba7a1e594d691cfe8c23dbbe..99429db887aa3a39fbe5faa7b2f776d278724f77 100644 --- a/graphics/composer/2.3/utils/vts/Android.bp +++ b/graphics/composer/2.3/utils/vts/Android.bp @@ -26,7 +26,6 @@ package { cc_library_static { name: "android.hardware.graphics.composer@2.3-vts", defaults: [ - "android.hardware.graphics.allocator-ndk_static", "hidl_defaults", ], srcs: [ diff --git a/graphics/composer/2.3/vts/functional/Android.bp b/graphics/composer/2.3/vts/functional/Android.bp index 13f2b113ab74a4a60e03b78439c84f911808c7c7..0d3c27df02d9a7d419de9d8a63e542f77aecd0e1 100644 --- a/graphics/composer/2.3/vts/functional/Android.bp +++ b/graphics/composer/2.3/vts/functional/Android.bp @@ -27,7 +27,6 @@ cc_test { name: "VtsHalGraphicsComposerV2_3TargetTest", defaults: [ "VtsHalTargetTestDefaults", - "android.hardware.graphics.allocator-ndk_static", ], tidy_timeout_srcs: ["VtsHalGraphicsComposerV2_3TargetTest.cpp"], srcs: ["VtsHalGraphicsComposerV2_3TargetTest.cpp"], @@ -40,25 +39,14 @@ cc_test { "libhidlbase", "libsync", "android.hardware.common-V2-ndk", - "android.hardware.graphics.mapper@2.0", - "android.hardware.graphics.mapper@2.1", - "android.hardware.graphics.mapper@3.0", - "android.hardware.graphics.mapper@4.0", ], static_libs: [ - "android.hardware.graphics.allocator@2.0", - "android.hardware.graphics.allocator@3.0", - "android.hardware.graphics.allocator@4.0", "android.hardware.graphics.composer@2.1", "android.hardware.graphics.composer@2.1-vts", "android.hardware.graphics.composer@2.2", "android.hardware.graphics.composer@2.2-vts", "android.hardware.graphics.composer@2.3", "android.hardware.graphics.composer@2.3-vts", - "android.hardware.graphics.mapper@2.0-vts", - "android.hardware.graphics.mapper@2.1-vts", - "android.hardware.graphics.mapper@3.0-vts", - "android.hardware.graphics.mapper@4.0-vts", "libaidlcommonsupport", ], header_libs: [ diff --git a/graphics/composer/2.3/vts/functional/VtsHalGraphicsComposerV2_3TargetTest.cpp b/graphics/composer/2.3/vts/functional/VtsHalGraphicsComposerV2_3TargetTest.cpp index ecfe66c80d0985efafb85a759878873f8ff362ad..c072ef08a94fb9254bb12413567c98806fb85ac8 100644 --- a/graphics/composer/2.3/vts/functional/VtsHalGraphicsComposerV2_3TargetTest.cpp +++ b/graphics/composer/2.3/vts/functional/VtsHalGraphicsComposerV2_3TargetTest.cpp @@ -21,7 +21,6 @@ #include #include -#include #include #include #include @@ -29,7 +28,6 @@ #include #include #include -#include namespace android { namespace hardware { @@ -43,7 +41,6 @@ using common::V1_1::RenderIntent; using common::V1_2::ColorMode; using common::V1_2::Dataspace; using common::V1_2::PixelFormat; -using V2_2::vts::Gralloc; class GraphicsComposerHidlTest : public ::testing::TestWithParam { protected: @@ -128,8 +125,6 @@ class GraphicsComposerHidlCommandTest : public GraphicsComposerHidlTest { void SetUp() override { ASSERT_NO_FATAL_FAILURE(GraphicsComposerHidlTest::SetUp()); - ASSERT_NO_FATAL_FAILURE(mGralloc = std::make_unique()); - mWriter = std::make_unique(1024); mReader = std::make_unique(); } @@ -143,9 +138,6 @@ class GraphicsComposerHidlCommandTest : public GraphicsComposerHidlTest { std::unique_ptr mWriter; std::unique_ptr mReader; - - private: - std::unique_ptr mGralloc; }; /** diff --git a/graphics/composer/2.4/utils/hal/include/composer-hal/2.4/ComposerCommandEngine.h b/graphics/composer/2.4/utils/hal/include/composer-hal/2.4/ComposerCommandEngine.h index 697d6b8a6b4d4e95857724679c26d502f5169202..3b5ce5a70beae2fddf3b2dba9a92390deba093dd 100644 --- a/graphics/composer/2.4/utils/hal/include/composer-hal/2.4/ComposerCommandEngine.h +++ b/graphics/composer/2.4/utils/hal/include/composer-hal/2.4/ComposerCommandEngine.h @@ -90,6 +90,9 @@ class ComposerCommandEngine : public V2_3::hal::ComposerCommandEngine { } const uint32_t keySize = read(); + if (!isReadSizeValid(keySize)) { + return false; + } std::string key; key.resize(keySize); readBlob(keySize, key.data()); @@ -97,6 +100,9 @@ class ComposerCommandEngine : public V2_3::hal::ComposerCommandEngine { const bool mandatory = read(); const uint32_t valueSize = read(); + if (!isReadSizeValid(valueSize)) { + return false; + } std::vector value(valueSize); readBlob(valueSize, value.data()); diff --git a/graphics/composer/2.4/utils/vts/Android.bp b/graphics/composer/2.4/utils/vts/Android.bp index d2b2ffab9a6b138056e189306413e9078182c5a6..c39b5eb1d18bdb13673bcb0544e5e59b7317eff6 100644 --- a/graphics/composer/2.4/utils/vts/Android.bp +++ b/graphics/composer/2.4/utils/vts/Android.bp @@ -26,7 +26,6 @@ package { cc_library_static { name: "android.hardware.graphics.composer@2.4-vts", defaults: [ - "android.hardware.graphics.allocator-ndk_static", "hidl_defaults", ], srcs: [ diff --git a/graphics/composer/2.4/vts/functional/Android.bp b/graphics/composer/2.4/vts/functional/Android.bp index b4ab259dd6dbdd0eee2f1998adc15175b4effe48..52624b4dec774f8f0f56655b1038348ebf8b551c 100644 --- a/graphics/composer/2.4/vts/functional/Android.bp +++ b/graphics/composer/2.4/vts/functional/Android.bp @@ -27,7 +27,6 @@ cc_test { name: "VtsHalGraphicsComposerV2_4TargetTest", defaults: [ "VtsHalTargetTestDefaults", - "android.hardware.graphics.allocator-ndk_static", ], tidy_timeout_srcs: ["VtsHalGraphicsComposerV2_4TargetTest.cpp"], srcs: ["VtsHalGraphicsComposerV2_4TargetTest.cpp"], @@ -38,16 +37,10 @@ cc_test { "libbinder_ndk", "libfmq", "libsync", + "libui", "android.hardware.common-V2-ndk", - "android.hardware.graphics.mapper@2.0", - "android.hardware.graphics.mapper@2.1", - "android.hardware.graphics.mapper@3.0", - "android.hardware.graphics.mapper@4.0", ], static_libs: [ - "android.hardware.graphics.allocator@2.0", - "android.hardware.graphics.allocator@3.0", - "android.hardware.graphics.allocator@4.0", "android.hardware.graphics.composer@2.1", "android.hardware.graphics.composer@2.1-vts", "android.hardware.graphics.composer@2.2", @@ -56,10 +49,6 @@ cc_test { "android.hardware.graphics.composer@2.3-vts", "android.hardware.graphics.composer@2.4", "android.hardware.graphics.composer@2.4-vts", - "android.hardware.graphics.mapper@2.0-vts", - "android.hardware.graphics.mapper@2.1-vts", - "android.hardware.graphics.mapper@3.0-vts", - "android.hardware.graphics.mapper@4.0-vts", "libaidlcommonsupport", ], header_libs: [ diff --git a/graphics/composer/2.4/vts/functional/AndroidTest.xml b/graphics/composer/2.4/vts/functional/AndroidTest.xml index 773db932557ef3f097ff44a1a6131f824dcb2ef0..76269952a220173b08069489f07a9e0f8ff0b258 100644 --- a/graphics/composer/2.4/vts/functional/AndroidTest.xml +++ b/graphics/composer/2.4/vts/functional/AndroidTest.xml @@ -31,6 +31,6 @@ diff --git a/graphics/composer/2.4/vts/functional/VtsHalGraphicsComposerV2_4TargetTest.cpp b/graphics/composer/2.4/vts/functional/VtsHalGraphicsComposerV2_4TargetTest.cpp index 35225d9a030d9f1c1687b05c0eb677216f8ea22a..7ae917b4edf170457b71e406845adcda4ecb065a 100644 --- a/graphics/composer/2.4/vts/functional/VtsHalGraphicsComposerV2_4TargetTest.cpp +++ b/graphics/composer/2.4/vts/functional/VtsHalGraphicsComposerV2_4TargetTest.cpp @@ -22,7 +22,6 @@ #include #include -#include #include #include #include @@ -30,9 +29,7 @@ #include #include #include -#include -#include -#include +#include #include namespace android { @@ -51,9 +48,7 @@ using common::V1_2::ColorMode; using common::V1_2::Dataspace; using common::V1_2::PixelFormat; using V2_1::Layer; -using V2_1::vts::NativeHandleWrapper; using V2_2::Transform; -using V2_2::vts::Gralloc; using ContentType = IComposerClient::ContentType; using DisplayCapability = IComposerClient::DisplayCapability; @@ -103,8 +98,6 @@ class GraphicsComposerHidlTest : public ::testing::TestWithParam { } mComposerCallback->setVsyncAllowed(false); - ASSERT_NO_FATAL_FAILURE(mGralloc = std::make_unique()); - mWriter = std::make_unique(1024); mReader = std::make_unique(); } @@ -157,12 +150,15 @@ class GraphicsComposerHidlTest : public ::testing::TestWithParam { void execute() { mComposerClient->execute(mReader.get(), mWriter.get()); } - NativeHandleWrapper allocate(int32_t width, int32_t height) { - return mGralloc->allocate( - width, height, /*layerCount*/ 1, - static_cast(PixelFormat::RGBA_8888), + sp allocate(int32_t width, int32_t height) { + auto result = sp::make( + width, height, static_cast(PixelFormat::RGBA_8888), /*layerCount*/ 1, static_cast(BufferUsage::CPU_WRITE_OFTEN | BufferUsage::CPU_READ_OFTEN | BufferUsage::COMPOSER_OVERLAY)); + if (result->initCheck() != STATUS_OK) { + return nullptr; + } + return result; } struct TestParameters { @@ -256,7 +252,6 @@ class GraphicsComposerHidlTest : public ::testing::TestWithParam { std::unique_ptr mWriter; std::unique_ptr mReader; sp mComposerCallback; - std::unique_ptr mGralloc; }; TEST_P(GraphicsComposerHidlTest, getDisplayCapabilitiesBadDisplay) { @@ -458,7 +453,7 @@ void GraphicsComposerHidlTest::sendRefreshFrame(const VtsDisplay& display, mWriter->setLayerBlendMode(IComposerClient::BlendMode::NONE); mWriter->setLayerSurfaceDamage( std::vector(1, display.getFrameRect())); - mWriter->setLayerBuffer(0, handle.get(), -1); + mWriter->setLayerBuffer(0, handle->handle, -1); mWriter->setLayerDataspace(Dataspace::UNKNOWN); mWriter->validateDisplay(); @@ -476,7 +471,7 @@ void GraphicsComposerHidlTest::sendRefreshFrame(const VtsDisplay& display, ASSERT_NE(nullptr, handle.get()); mWriter->selectLayer(layer); - mWriter->setLayerBuffer(0, handle.get(), -1); + mWriter->setLayerBuffer(0, handle->handle, -1); mWriter->setLayerSurfaceDamage(std::vector(1, {0, 0, 10, 10})); mWriter->validateDisplay(); execute(); @@ -544,10 +539,12 @@ void GraphicsComposerHidlTest::Test_setActiveConfigWithConstraints(const TestPar setActiveConfigWithConstraints(display, config2, constraints, &timeline)); EXPECT_TRUE(timeline.newVsyncAppliedTimeNanos >= constraints.desiredTimeNanos); - // Refresh rate should change within a reasonable time - constexpr std::chrono::nanoseconds kReasonableTimeForChange = 1s; // 1 second - EXPECT_TRUE(timeline.newVsyncAppliedTimeNanos - constraints.desiredTimeNanos <= - kReasonableTimeForChange.count()); + if (configGroup1 == configGroup2) { + // Refresh rate should change within a reasonable time + constexpr std::chrono::nanoseconds kReasonableTimeForChange = 1s; + EXPECT_TRUE(timeline.newVsyncAppliedTimeNanos - constraints.desiredTimeNanos <= + kReasonableTimeForChange.count()); + } if (timeline.refreshRequired) { if (params.refreshMiss) { diff --git a/graphics/composer/aidl/Android.bp b/graphics/composer/aidl/Android.bp index 40448ec43e86e8e20526812655a2ce9cee4b3aeb..5699895693b7fae684db94221a8181ced0e82592 100644 --- a/graphics/composer/aidl/Android.bp +++ b/graphics/composer/aidl/Android.bp @@ -31,14 +31,14 @@ aidl_interface { enabled: true, support_system_process: true, }, - frozen: true, + frozen: false, vndk_use_version: "1", srcs: [ "android/hardware/graphics/composer3/*.aidl", ], stability: "vintf", imports: [ - "android.hardware.graphics.common-V4", + "android.hardware.graphics.common-V5", "android.hardware.common-V2", ], backend: { @@ -54,19 +54,22 @@ aidl_interface { enabled: true, }, }, + rust: { + enabled: true, + }, }, versions_with_info: [ { version: "1", imports: [ - "android.hardware.graphics.common-V4", + "android.hardware.graphics.common-V5", "android.hardware.common-V2", ], }, { version: "2", imports: [ - "android.hardware.graphics.common-V4", + "android.hardware.graphics.common-V5", "android.hardware.common-V2", ], }, diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/Capability.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/Capability.aidl index f02f8aaa776d6518227d953d7c2a393a4091fec7..ee004d6ef29950b48e359df30badfd6b4d97492b 100644 --- a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/Capability.aidl +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/Capability.aidl @@ -45,4 +45,5 @@ enum Capability { BOOT_DISPLAY_CONFIG = 5, HDR_OUTPUT_CONVERSION_CONFIG = 6, REFRESH_RATE_CHANGED_CALLBACK_DEBUG = 7, + LAYER_LIFECYCLE_BATCH_COMMAND = 8, } diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/ClientTarget.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/ClientTarget.aidl index 7632707ec2ae198cbfb76f838a2bbdd9fae37496..06ed922e94e3408a2a3c87766f7d1ccc81fe0168 100644 --- a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/ClientTarget.aidl +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/ClientTarget.aidl @@ -37,4 +37,5 @@ parcelable ClientTarget { android.hardware.graphics.composer3.Buffer buffer; android.hardware.graphics.common.Dataspace dataspace; android.hardware.graphics.common.Rect[] damage; + float hdrSdrRatio = 1.0f; } diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/DisplayCapability.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/DisplayCapability.aidl index 6eba887aef5e5f1802fdbb0c6c97954af9d80e88..0e2d72bae0b568f00eb34b449363b341e471b1da 100644 --- a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/DisplayCapability.aidl +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/DisplayCapability.aidl @@ -42,4 +42,5 @@ enum DisplayCapability { AUTO_LOW_LATENCY_MODE = 5, SUSPEND = 6, DISPLAY_IDLE_TIMER = 7, + MULTI_THREADED_PRESENT = 8, } diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/DisplayCommand.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/DisplayCommand.aidl index 662240e96ba835e344caac2ed18061acb14a0e89..cce35e79ab78edc8a3df45bbc0602399793ec4c9 100644 --- a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/DisplayCommand.aidl +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/DisplayCommand.aidl @@ -45,4 +45,5 @@ parcelable DisplayCommand { boolean acceptDisplayChanges; boolean presentDisplay; boolean presentOrValidateDisplay; + int frameIntervalNs; } diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/DisplayConfiguration.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/DisplayConfiguration.aidl new file mode 100644 index 0000000000000000000000000000000000000000..040afd786651f2beec4d660377dfeb7056e92555 --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/DisplayConfiguration.aidl @@ -0,0 +1,48 @@ +/** + * Copyright 2023, The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/////////////////////////////////////////////////////////////////////////////// +// THIS 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 -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.graphics.composer3; +@VintfStability +parcelable DisplayConfiguration { + int configId; + int width; + int height; + @nullable android.hardware.graphics.composer3.DisplayConfiguration.Dpi dpi; + int configGroup; + int vsyncPeriod; + @nullable android.hardware.graphics.composer3.VrrConfig vrrConfig; + parcelable Dpi { + float x; + float y; + } +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/DisplayRequest.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/DisplayRequest.aidl index 00598eb9b140777102e4711d1ee9602367a5cb2e..e6db1163989e10da4a4c235c94c058c803c29416 100644 --- a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/DisplayRequest.aidl +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/DisplayRequest.aidl @@ -37,12 +37,12 @@ parcelable DisplayRequest { long display; int mask; android.hardware.graphics.composer3.DisplayRequest.LayerRequest[] layerRequests; - const int FLIP_CLIENT_TARGET = (1 << 0); - const int WRITE_CLIENT_TARGET_TO_OUTPUT = (1 << 1); + const int FLIP_CLIENT_TARGET = (1 << 0) /* 1 */; + const int WRITE_CLIENT_TARGET_TO_OUTPUT = (1 << 1) /* 2 */; @VintfStability parcelable LayerRequest { long layer; int mask; - const int CLEAR_CLIENT_TARGET = (1 << 0); + const int CLEAR_CLIENT_TARGET = (1 << 0) /* 1 */; } } diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/FormatColorComponent.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/FormatColorComponent.aidl index 1990350fa788c2453333f0feb20b8307b65bd28a..89dae83bbe539df7241d97d7cdc8f2185666b252 100644 --- a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/FormatColorComponent.aidl +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/FormatColorComponent.aidl @@ -34,8 +34,8 @@ package android.hardware.graphics.composer3; @Backing(type="byte") @VintfStability enum FormatColorComponent { - FORMAT_COMPONENT_0 = (1 << 0), - FORMAT_COMPONENT_1 = (1 << 1), - FORMAT_COMPONENT_2 = (1 << 2), - FORMAT_COMPONENT_3 = (1 << 3), + FORMAT_COMPONENT_0 = (1 << 0) /* 1 */, + FORMAT_COMPONENT_1 = (1 << 1) /* 2 */, + FORMAT_COMPONENT_2 = (1 << 2) /* 4 */, + FORMAT_COMPONENT_3 = (1 << 3) /* 8 */, } 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 2c08cbeffdd0f5c2fdcccb047eff87ef2fed118f..e64bd5273ee1e90f42e0a2035e385fe44f6314f9 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 @@ -34,6 +34,9 @@ package android.hardware.graphics.composer3; @VintfStability interface IComposerCallback { + /** + * @deprecated : Use instead onHotplugEvent + */ void onHotplug(long display, boolean connected); oneway void onRefresh(long display); oneway void onSeamlessPossible(long display); @@ -41,4 +44,5 @@ interface IComposerCallback { oneway void onVsyncPeriodTimingChanged(long display, in android.hardware.graphics.composer3.VsyncPeriodChangeTimeline updatedTimeline); 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); } diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/IComposerClient.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/IComposerClient.aidl index cb85a88995a56b7810e8da20b4a3a33f4cd035cd..bc27cc7ec4450d44fcac06140904eab15836957f 100644 --- a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/IComposerClient.aidl +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/IComposerClient.aidl @@ -42,8 +42,14 @@ interface IComposerClient { int getActiveConfig(long display); android.hardware.graphics.composer3.ColorMode[] getColorModes(long display); float[] getDataspaceSaturationMatrix(android.hardware.graphics.common.Dataspace dataspace); + /** + * @deprecated use getDisplayConfigurations instead. Returns a display attribute value for a particular display configuration. For legacy support getDisplayAttribute should return valid values for any requested DisplayAttribute, and for all of the configs obtained either through getDisplayConfigs or getDisplayConfigurations. + */ int getDisplayAttribute(long display, int config, android.hardware.graphics.composer3.DisplayAttribute attribute); android.hardware.graphics.composer3.DisplayCapability[] getDisplayCapabilities(long display); + /** + * @deprecated use getDisplayConfigurations instead. For legacy support getDisplayConfigs should return at least one valid config. All the configs returned from the getDisplayConfigs should also be returned from getDisplayConfigurations. + */ int[] getDisplayConfigs(long display); android.hardware.graphics.composer3.DisplayConnectionType getDisplayConnectionType(long display); android.hardware.graphics.composer3.DisplayIdentification getDisplayIdentificationData(long display); @@ -79,6 +85,8 @@ interface IComposerClient { android.hardware.graphics.common.HdrConversionCapability[] getHdrConversionCapabilities(); android.hardware.graphics.common.Hdr setHdrConversionStrategy(in android.hardware.graphics.common.HdrConversionStrategy conversionStrategy); void setRefreshRateChangedCallbackDebugEnabled(long display, boolean enabled); + android.hardware.graphics.composer3.DisplayConfiguration[] getDisplayConfigurations(long display, int maxFrameIntervalNs); + oneway void notifyExpectedPresent(long display, in android.hardware.graphics.composer3.ClockMonotonicTimestamp expectedPresentTime, int frameIntervalNs); const int EX_BAD_CONFIG = 1; const int EX_BAD_DISPLAY = 2; const int EX_BAD_LAYER = 3; diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/LayerCommand.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/LayerCommand.aidl index 6d32218af1cd657a4ecb19631ae00ef89314d0c1..87c8c184438e4c7329c3ea06654843feddab656f 100644 --- a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/LayerCommand.aidl +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/LayerCommand.aidl @@ -55,4 +55,6 @@ parcelable LayerCommand { @nullable android.hardware.graphics.composer3.PerFrameMetadataBlob[] perFrameMetadataBlob; @nullable android.hardware.graphics.common.Rect[] blockingRegion; @nullable int[] bufferSlotsToClear; + android.hardware.graphics.composer3.LayerLifecycleBatchCommandType layerLifecycleBatchCommandType; + int newBufferSlotCount; } diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/LayerLifecycleBatchCommandType.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/LayerLifecycleBatchCommandType.aidl new file mode 100644 index 0000000000000000000000000000000000000000..ac78cd51f9443d67e73366d13586ddb6d6a77bf6 --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/LayerLifecycleBatchCommandType.aidl @@ -0,0 +1,40 @@ +/** + * Copyright (c) 2023, The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/////////////////////////////////////////////////////////////////////////////// +// THIS 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 -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.graphics.composer3; +@Backing(type="int") @VintfStability +enum LayerLifecycleBatchCommandType { + MODIFY = 0, + CREATE = 1, + DESTROY = 2, +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/RefreshRateChangedDebugData.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/RefreshRateChangedDebugData.aidl index 2b9801a4aa4c8eb0e60b8e9299843612b13f66eb..e9305e152c7aef6ebbdfeeb2036534d4006b33db 100644 --- a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/RefreshRateChangedDebugData.aidl +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/RefreshRateChangedDebugData.aidl @@ -36,4 +36,5 @@ package android.hardware.graphics.composer3; parcelable RefreshRateChangedDebugData { long display; int vsyncPeriodNanos; + int refreshPeriodNanos; } diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/VrrConfig.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/VrrConfig.aidl new file mode 100644 index 0000000000000000000000000000000000000000..bb2569f342375b5e8c14742d00c5e5a75df46da1 --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/VrrConfig.aidl @@ -0,0 +1,48 @@ +/** + * Copyright 2023, The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/////////////////////////////////////////////////////////////////////////////// +// THIS 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 -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.graphics.composer3; +@VintfStability +parcelable VrrConfig { + int minFrameIntervalNs; + @nullable android.hardware.graphics.composer3.VrrConfig.FrameIntervalPowerHint[] frameIntervalPowerHints; + @nullable android.hardware.graphics.composer3.VrrConfig.NotifyExpectedPresentConfig notifyExpectedPresentConfig; + parcelable FrameIntervalPowerHint { + int frameIntervalNs; + int averageRefreshPeriodNs; + } + parcelable NotifyExpectedPresentConfig { + int notifyExpectedPresentHeadsUpNs; + int notifyExpectedPresentTimeoutNs; + } +} diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/Capability.aidl b/graphics/composer/aidl/android/hardware/graphics/composer3/Capability.aidl index 4638610955ec18f5072abec5d6e2cda9b043f8b6..1dfc074e73aed2144afa54aec8adf4601e3c5e39 100644 --- a/graphics/composer/aidl/android/hardware/graphics/composer3/Capability.aidl +++ b/graphics/composer/aidl/android/hardware/graphics/composer3/Capability.aidl @@ -86,4 +86,14 @@ enum Capability { * @see IComposerCallback.onRefreshRateChangedDebug */ REFRESH_RATE_CHANGED_CALLBACK_DEBUG = 7, + + /** + * Specifies that the device HAL supports the batching of layer creation and destruction + * for better performance. + * + * @see IComposerClient.executeCommands + * @see LayerCommand.layerLifecycleBatchCommandType + * @see LayerCommand.newBufferSlotCount + */ + LAYER_LIFECYCLE_BATCH_COMMAND = 8, } diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/ClientTarget.aidl b/graphics/composer/aidl/android/hardware/graphics/composer3/ClientTarget.aidl index 56488d56c3abef56f4f8f22e96c0bbcdfa50bf1f..bc9f63a3a240c89042cee39622d495c2efdd5aaf 100644 --- a/graphics/composer/aidl/android/hardware/graphics/composer3/ClientTarget.aidl +++ b/graphics/composer/aidl/android/hardware/graphics/composer3/ClientTarget.aidl @@ -36,4 +36,14 @@ parcelable ClientTarget { * The surface damage regions. */ Rect[] damage; + + /** + * The HDR/SDR ratio. + * Only meaningful for extended_range client targets to communicate the amount of HDR heaedroom + * inside the client target. For floating point client targets, this means that for each color + * channel the maximum SDR luminance is 1.0, and the maximum display relative luminance is + * the hdrSdrRatio. + * Note that this ratio is meant to be >= 1.0. + */ + float hdrSdrRatio = 1.0f; } diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/DisplayCapability.aidl b/graphics/composer/aidl/android/hardware/graphics/composer3/DisplayCapability.aidl index f4b29843b8d200834a962197cff2c6bc3159bcc0..7154d7449937db28c2d9e5f45c40ef8a5a53efd5 100644 --- a/graphics/composer/aidl/android/hardware/graphics/composer3/DisplayCapability.aidl +++ b/graphics/composer/aidl/android/hardware/graphics/composer3/DisplayCapability.aidl @@ -80,4 +80,20 @@ enum DisplayCapability { * IComposerCallback.onVsyncIdle. */ DISPLAY_IDLE_TIMER = 7, + /** + * Indicates that both the composer HAL implementation and the given display + * support calling executeCommands concurrently from separate threads. + * executeCommands for a particular display will never run concurrently to + * any other executeCommands for the same display. In addition, the + * CommandResultPayload must only reference displays included in the + * DisplayCommands passed to executeCommands. Displays referenced from + * separate threads must have minimal interference with one another. If a + * HWC-managed display has this capability, SurfaceFlinger can run + * executeCommands for this display concurrently with other displays with the + * same capability. + * @see IComposerClient.executeCommands + * @see DisplayCommand.presentDisplay + * @see DisplayCommand.validateDisplay + */ + MULTI_THREADED_PRESENT = 8, } diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/DisplayCommand.aidl b/graphics/composer/aidl/android/hardware/graphics/composer3/DisplayCommand.aidl index 4f69aeeab7dd914da1e4d7617d5620a3c80f78a5..02c1389de1ea41417326f591c4d5be27b597f5ab 100644 --- a/graphics/composer/aidl/android/hardware/graphics/composer3/DisplayCommand.aidl +++ b/graphics/composer/aidl/android/hardware/graphics/composer3/DisplayCommand.aidl @@ -174,4 +174,15 @@ parcelable DisplayCommand { * or perform a VALIDATE_DISPLAY action instead. */ boolean presentOrValidateDisplay; + + /** + * If a value greater than 0 is set, it provides a hint about the next frame(s) + * cadence. This parameter represents the time in nanoseconds of when to expect the + * next frames to arrive. For example. frameIntervalNs=33333333 indicates that the + * cadence of the next frames is 30Hz. + * + * The implementation should take the necessary steps to present the next frames as + * close as possible to the cadence. + */ + int frameIntervalNs; } diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/DisplayConfiguration.aidl b/graphics/composer/aidl/android/hardware/graphics/composer3/DisplayConfiguration.aidl new file mode 100644 index 0000000000000000000000000000000000000000..09c42dcc8a4bedb3588fab754fbb78ebac5653e4 --- /dev/null +++ b/graphics/composer/aidl/android/hardware/graphics/composer3/DisplayConfiguration.aidl @@ -0,0 +1,70 @@ +/** + * Copyright 2023, The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.hardware.graphics.composer3; +import android.hardware.graphics.composer3.VrrConfig; + +@VintfStability +parcelable DisplayConfiguration { + /** + * The config id, to be used with IComposerClient.setActiveConfig. + */ + int configId; + + /** + * Dimensions in pixels + */ + int width; + int height; + + /** + * Dots per inch. + * If the DPI for a configuration is unavailable or is + * considered unreliable, the device may set null instead. + */ + parcelable Dpi { + float x; + float y; + } + @nullable Dpi dpi; + + /** + * The configuration group ID this config is associated to. + * Switching between configurations within the same group may be + * done seamlessly in some conditions via + * setActiveConfigWithConstraints. Configurations which share the + * same config group are similar in all attributes except for the + * vsync period. + */ + int configGroup; + + /** + * Vsync period in nanoseconds. This period represents the internal + * frequency of the display. IComposerCallback.onVsync is expected + * to be called on each vsync event. For non-VRR configurations, a + * frame can be presented on each vsync event. + * + * A present fence, retrieved from CommandResultPayload.presentFence + * must be signaled on a vsync boundary. + */ + int vsyncPeriod; + + /** + * Represents the specific configurations for VRR (Variable Refresh Rate) display modes. + * Non-VRR modes should set this to null. + */ + @nullable VrrConfig vrrConfig; +} diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/IComposerCallback.aidl b/graphics/composer/aidl/android/hardware/graphics/composer3/IComposerCallback.aidl index f4384b7a5aea3f74c659630de62fe5066202a350..96eccd79bd83c04add7680206178353a807a9ae2 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.graphics.common.DisplayHotplugEvent; import android.hardware.graphics.composer3.RefreshRateChangedDebugData; import android.hardware.graphics.composer3.VsyncPeriodChangeTimeline; @@ -38,6 +39,7 @@ interface IComposerCallback { * @param display is the display that triggers the hotplug event. * @param connected indicates whether the display is connected or * disconnected. + * @deprecated: Use instead onHotplugEvent */ void onHotplug(long display, boolean connected); @@ -118,4 +120,23 @@ interface IComposerCallback { * @param data is the data for the callback when refresh rate changed. */ oneway void onRefreshRateChangedDebug(in RefreshRateChangedDebugData data); + + /** + * Notifies the client that a DisplayHotplugEvent has occurred for the + * given display. Every active display (even a built-in physical display) + * must trigger at least one hotplug notification, even if it only occurs + * immediately after callback registration. + * + * Displays which have been connected are assumed to be in PowerMode.OFF, + * and the onVsync callback should not be called for a display until vsync + * has been enabled with setVsyncEnabled. + * + * The client may call back into the device while the callback is in + * progress. The device must serialize calls to this callback such that + * only one thread is calling it at a time. + * + * @param display is the display that triggers the hotplug event. + * @param event is the type of event that occurred. + */ + void onHotplugEvent(long display, DisplayHotplugEvent event); } diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/IComposerClient.aidl b/graphics/composer/aidl/android/hardware/graphics/composer3/IComposerClient.aidl index 4e77f86cf42595aebb9e3f371bfaf528eed62069..725c9475c96e3dc9ec7b934cc7fadd8b2ea8dd2a 100644 --- a/graphics/composer/aidl/android/hardware/graphics/composer3/IComposerClient.aidl +++ b/graphics/composer/aidl/android/hardware/graphics/composer3/IComposerClient.aidl @@ -22,12 +22,14 @@ import android.hardware.graphics.common.HdrConversionCapability; import android.hardware.graphics.common.HdrConversionStrategy; import android.hardware.graphics.common.Transform; import android.hardware.graphics.composer3.ClientTargetProperty; +import android.hardware.graphics.composer3.ClockMonotonicTimestamp; import android.hardware.graphics.composer3.ColorMode; import android.hardware.graphics.composer3.CommandResultPayload; import android.hardware.graphics.composer3.ContentType; import android.hardware.graphics.composer3.DisplayAttribute; import android.hardware.graphics.composer3.DisplayCapability; import android.hardware.graphics.composer3.DisplayCommand; +import android.hardware.graphics.composer3.DisplayConfiguration; import android.hardware.graphics.composer3.DisplayConnectionType; import android.hardware.graphics.composer3.DisplayContentSample; import android.hardware.graphics.composer3.DisplayContentSamplingAttributes; @@ -234,9 +236,18 @@ interface IComposerClient { float[] getDataspaceSaturationMatrix(android.hardware.graphics.common.Dataspace dataspace); /** + * @deprecated use getDisplayConfigurations instead. + * * Returns a display attribute value for a particular display * configuration. * + * For legacy support getDisplayAttribute should return valid values for any requested + * DisplayAttribute, and for all of the configs obtained either through getDisplayConfigs + * or getDisplayConfigurations. + * + * @see getDisplayConfigurations + * @see getDisplayConfigs + * * @param display is the display to query. * @param config is the display configuration for which to return * attribute values. @@ -263,15 +274,12 @@ interface IComposerClient { DisplayCapability[] getDisplayCapabilities(long display); /** - * Returns handles for all of the valid display configurations on this - * display. - * This should never return INVALID_CONFIGURATION as a valid value. - * - * @param display is the display to query. + * @deprecated use getDisplayConfigurations instead. + * For legacy support getDisplayConfigs should return at least one valid config. + * All the configs returned from the getDisplayConfigs should also be returned + * from getDisplayConfigurations. * - * @return is an array of configuration handles. - * - * @exception EX_BAD_DISPLAY when an invalid display handle was passed in. + * @see getDisplayConfigurations */ int[] getDisplayConfigs(long display); @@ -864,4 +872,45 @@ interface IComposerClient { * false when refresh rate callback is disabled. */ void setRefreshRateChangedCallbackDebugEnabled(long display, boolean enabled); + + /** + * Returns all of the valid display configurations. + * getDisplayConfigurations is the superset of getDisplayConfigs and + * getDisplayConfigs should return at least one config. + * + * @param display is the display for which the configurations are requested. + * @param maxFrameIntervalNs refers to the largest frameInterval to be set for + * VrrConfig.frameIntervalPowerHints in nanoseconds + * + * @see getDisplayConfigs + */ + DisplayConfiguration[] getDisplayConfigurations(long display, int maxFrameIntervalNs); + + /** + * Provides an early hint for a frame that is likely to be presented. + * This is used for the implementation to take the necessary steps to ensure that + * the next frame(s) could be presented as close as possible to the expectedPresentTime and + * according to the frameIntervalNs cadence. + * See DisplayCommand.expectedPresentTime and DisplayCommand.frameIntervalNs. + * + * The framework will call this function based on the parameters specified in + * DisplayConfiguration.VrrConfig: + * - notifyExpectedPresentTimeoutNs specifies the idle time from the previous present command + * where the framework must send the early hint for the next frame. + * - notifyExpectedPresentHeadsUpNs specifies minimal time that framework must send + * the early hint before the next frame. + * + * The framework can omit calling this API when the next present command matches + * the cadence of the previous present command frameIntervalNs. + * + * If DisplayConfiguration.notifyExpectedPresentConfig is null, this function will never be + * called. + * + * @param display is the display for which the notifyExpectedPresent is called. + * @param expectedPresentTime is the expectedPresentTime that will be provided in the next + * present command + * @param frameIntervalNs is a hint about the cadence of the next frames in nanoseconds. + */ + oneway void notifyExpectedPresent( + long display, in ClockMonotonicTimestamp expectedPresentTime, int frameIntervalNs); } diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/LayerCommand.aidl b/graphics/composer/aidl/android/hardware/graphics/composer3/LayerCommand.aidl index fd50be9cfe226edc2e61679df6ccb40b9b7337c8..e961c48700c0b4065e4d5f7f9d2f81aca4f6e67a 100644 --- a/graphics/composer/aidl/android/hardware/graphics/composer3/LayerCommand.aidl +++ b/graphics/composer/aidl/android/hardware/graphics/composer3/LayerCommand.aidl @@ -23,6 +23,7 @@ import android.hardware.graphics.common.Rect; import android.hardware.graphics.composer3.Buffer; import android.hardware.graphics.composer3.Color; import android.hardware.graphics.composer3.LayerBrightness; +import android.hardware.graphics.composer3.LayerLifecycleBatchCommandType; import android.hardware.graphics.composer3.ParcelableBlendMode; import android.hardware.graphics.composer3.ParcelableComposition; import android.hardware.graphics.composer3.ParcelableDataspace; @@ -265,4 +266,17 @@ parcelable LayerCommand { * be freed. */ @nullable int[] bufferSlotsToClear; + + /** + * Specifies if this layer command is on type modify, create or destroy. + * This command is replacing the older IComposerClient.createLayer and destroyLayer + * and making it more efficient with reduced aidls to the HAL. + * The HAL will report the errors by setting CommandResultPayload::CommandError. + */ + LayerLifecycleBatchCommandType layerLifecycleBatchCommandType; + + /** + * Specifies the number of buffer slot to be reserved. + */ + int newBufferSlotCount; } diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/LayerLifecycleBatchCommandType.aidl b/graphics/composer/aidl/android/hardware/graphics/composer3/LayerLifecycleBatchCommandType.aidl new file mode 100644 index 0000000000000000000000000000000000000000..ec2d55f791b2ec735d043cde1696721fc4b4edbd --- /dev/null +++ b/graphics/composer/aidl/android/hardware/graphics/composer3/LayerLifecycleBatchCommandType.aidl @@ -0,0 +1,39 @@ +/** + * Copyright (c) 2023, The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.hardware.graphics.composer3; + +/** + * Possible batch command types for a given layer. + */ +@VintfStability +@Backing(type="int") +enum LayerLifecycleBatchCommandType { + /** + * Layer attributes are being modified for already created layer. + */ + MODIFY = 0, + /** + * This indicates that the current LayerCommand should also create the layer, + * before processing the other attributes in the LayerCommand. + */ + CREATE = 1, + /** + * This indicates that the current LayerCommand should also destroyes the layer, + * after processing the other attributes in the LayerCommand. + */ + DESTROY = 2, +} diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/RefreshRateChangedDebugData.aidl b/graphics/composer/aidl/android/hardware/graphics/composer3/RefreshRateChangedDebugData.aidl index c1f78d6f5ea54bbae35d9f87b1157783e4f4fd23..11c0112dfdcc6a6294e25c63b10672abc1acd81a 100644 --- a/graphics/composer/aidl/android/hardware/graphics/composer3/RefreshRateChangedDebugData.aidl +++ b/graphics/composer/aidl/android/hardware/graphics/composer3/RefreshRateChangedDebugData.aidl @@ -27,4 +27,15 @@ parcelable RefreshRateChangedDebugData { * The display vsync period in nanoseconds. */ int vsyncPeriodNanos; + + /** + * The refresh period of the display in nanoseconds. + * On VRR (Variable Refresh Rate) displays, refreshPeriodNanos can be different from the + * vsyncPeriodNanos because not every vsync cycle of the display is a refresh cycle. + * This should be set to the current refresh period. + * On non-VRR displays this value should be equal to vsyncPeriodNanos + * + * @see vsyncPeriodNanos + */ + int refreshPeriodNanos; } diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/VrrConfig.aidl b/graphics/composer/aidl/android/hardware/graphics/composer3/VrrConfig.aidl new file mode 100644 index 0000000000000000000000000000000000000000..3b241ba0c973521225bd85f899825b1ce7088538 --- /dev/null +++ b/graphics/composer/aidl/android/hardware/graphics/composer3/VrrConfig.aidl @@ -0,0 +1,65 @@ +/** + * Copyright 2023, The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.hardware.graphics.composer3; + +@VintfStability +parcelable VrrConfig { + /** + * The minimal time (in nanoseconds) that needs to pass between the previously presented frame + * and when the next frame can be presented. + */ + int minFrameIntervalNs; + + /** + * An optional mapping between frame intervals, and the physical display refresh period on + * average. This provides useful information to the framework when picking a specific frame rate + * (which is a divisor of the vsync rate) about the real display refresh rate, which could be + * used for power optimizations. The implementation should populate this map for frame rates + * that requires the display to run at a higher refresh rate due to self refresh frames. The + * lowest frame rate provided should be according to the parameter `maxFrameIntervalNs` + * specified in IComposerClient.getDisplayConfigurations, as the framework would generally not + * try to run at a lower frame rate. + */ + parcelable FrameIntervalPowerHint { + int frameIntervalNs; + int averageRefreshPeriodNs; + } + @nullable FrameIntervalPowerHint[] frameIntervalPowerHints; + + parcelable NotifyExpectedPresentConfig { + /** + * The minimal time in nanoseconds that IComposerClient.notifyExpectedPresent needs to be + * called ahead of an expectedPresentTime provided on a presentDisplay command. + */ + int notifyExpectedPresentHeadsUpNs; + + /** + * The time in nanoseconds that represents a timeout from the previous presentDisplay, which + * after this point the display needs a call to IComposerClient.notifyExpectedPresent before + * sending the next frame. If set to 0, there is no need to call + * IComposerClient.notifyExpectedPresent for timeout. + */ + int notifyExpectedPresentTimeoutNs; + } + + /** + * Parameters for when to call IComposerClient.notifyExpectedPresent. + * + * When set to null, the framework will not call IComposerClient.notifyExpectedPresent. + */ + @nullable NotifyExpectedPresentConfig notifyExpectedPresentConfig; +} diff --git a/graphics/composer/aidl/include/android/hardware/graphics/composer3/ComposerClientWriter.h b/graphics/composer/aidl/include/android/hardware/graphics/composer3/ComposerClientWriter.h index 2e902e548b203b805f247da609e00ad53e9464f3..a1ccbfe0478ed8260b648fc27b5b13260e1c901a 100644 --- a/graphics/composer/aidl/include/android/hardware/graphics/composer3/ComposerClientWriter.h +++ b/graphics/composer/aidl/include/android/hardware/graphics/composer3/ComposerClientWriter.h @@ -29,6 +29,7 @@ #include #include #include +#include #include #include @@ -83,11 +84,13 @@ class ComposerClientWriter final { } void setClientTarget(int64_t display, uint32_t slot, const native_handle_t* target, - int acquireFence, Dataspace dataspace, const std::vector& damage) { + int acquireFence, Dataspace dataspace, const std::vector& damage, + float hdrSdrRatio) { ClientTarget clientTargetCommand; clientTargetCommand.buffer = getBufferCommand(slot, target, acquireFence); clientTargetCommand.dataspace = dataspace; clientTargetCommand.damage.assign(damage.begin(), damage.end()); + clientTargetCommand.hdrSdrRatio = hdrSdrRatio; getDisplayCommand(display).clientTarget.emplace(std::move(clientTargetCommand)); } @@ -97,18 +100,31 @@ class ComposerClientWriter final { getBufferCommand(slot, buffer, releaseFence)); } + void setLayerLifecycleBatchCommandType(int64_t display, int64_t layer, + LayerLifecycleBatchCommandType cmd) { + getLayerCommand(display, layer).layerLifecycleBatchCommandType = cmd; + } + + void setNewBufferSlotCount(int64_t display, int64_t layer, int32_t newBufferSlotToCount) { + getLayerCommand(display, layer).newBufferSlotCount = newBufferSlotToCount; + } + void validateDisplay(int64_t display, - std::optional expectedPresentTime) { + std::optional expectedPresentTime, + int32_t frameIntervalNs) { auto& command = getDisplayCommand(display); command.expectedPresentTime = expectedPresentTime; command.validateDisplay = true; + command.frameIntervalNs = frameIntervalNs; } void presentOrvalidateDisplay(int64_t display, - std::optional expectedPresentTime) { + std::optional expectedPresentTime, + int32_t frameIntervalNs) { auto& command = getDisplayCommand(display); command.expectedPresentTime = expectedPresentTime; command.presentOrValidateDisplay = true; + command.frameIntervalNs = frameIntervalNs; } void acceptDisplayChanges(int64_t display) { diff --git a/graphics/composer/aidl/vts/Android.bp b/graphics/composer/aidl/vts/Android.bp index 60360fd5963e75f268f7c6daf601c59ee6fd9545..d71999df6e4fb979111f4988bf2244c199acc439 100644 --- a/graphics/composer/aidl/vts/Android.bp +++ b/graphics/composer/aidl/vts/Android.bp @@ -54,13 +54,6 @@ cc_test { "libgui", "libhidlbase", "libprocessgroup", - "android.hardware.graphics.mapper@2.0", - "android.hardware.graphics.mapper@2.1", - "android.hardware.graphics.mapper@3.0", - "android.hardware.graphics.mapper@4.0", - "android.hardware.graphics.allocator@2.0", - "android.hardware.graphics.allocator@3.0", - "android.hardware.graphics.allocator@4.0", "libvndksupport", ], header_libs: [ @@ -70,13 +63,6 @@ cc_test { "android.hardware.graphics.common@1.2", "android.hardware.common-V2-ndk", "android.hardware.common.fmq-V1-ndk", - "android.hardware.graphics.allocator@2.0", - "android.hardware.graphics.allocator@3.0", - "android.hardware.graphics.allocator@4.0", - "android.hardware.graphics.mapper@2.0-vts", - "android.hardware.graphics.mapper@2.1-vts", - "android.hardware.graphics.mapper@3.0-vts", - "android.hardware.graphics.mapper@4.0-vts", "libaidlcommonsupport", "libarect", "libbase", diff --git a/graphics/composer/aidl/vts/GraphicsComposerCallback.cpp b/graphics/composer/aidl/vts/GraphicsComposerCallback.cpp index 7b3a2b431f27a4c033bc2c36eab9c8c700744d71..544f69297a25fd7cb541b2de9121f7f2c5fa59d0 100644 --- a/graphics/composer/aidl/vts/GraphicsComposerCallback.cpp +++ b/graphics/composer/aidl/vts/GraphicsComposerCallback.cpp @@ -17,6 +17,7 @@ #include "GraphicsComposerCallback.h" #include #include +#include #pragma push_macro("LOG_TAG") #undef LOG_TAG @@ -193,4 +194,18 @@ int32_t GraphicsComposerCallback::getInvalidRefreshRateDebugEnabledCallbackCount return ::ndk::ScopedAStatus::ok(); } +::ndk::ScopedAStatus GraphicsComposerCallback::onHotplugEvent(int64_t in_display, + common::DisplayHotplugEvent event) { + switch (event) { + case common::DisplayHotplugEvent::CONNECTED: + return onHotplug(in_display, true); + case common::DisplayHotplugEvent::DISCONNECTED: + return onHotplug(in_display, false); + default: + ALOGE("%s(): display:%" PRIu64 ", event:%d", __func__, in_display, + static_cast(event)); + 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 13e992a4e1e743c7aeb97807548d2cad9c65a375..7a8d4a35b8410a30341ce6e70ce227a4cf6f183c 100644 --- a/graphics/composer/aidl/vts/GraphicsComposerCallback.h +++ b/graphics/composer/aidl/vts/GraphicsComposerCallback.h @@ -63,6 +63,8 @@ class GraphicsComposerCallback : public BnComposerCallback { virtual ::ndk::ScopedAStatus onVsyncIdle(int64_t in_display) override; virtual ::ndk::ScopedAStatus onRefreshRateChangedDebug( const RefreshRateChangedDebugData&) override; + virtual ::ndk::ScopedAStatus onHotplugEvent(int64_t in_display, + common::DisplayHotplugEvent) override; mutable std::mutex mMutex; // the set of all currently connected displays diff --git a/graphics/composer/aidl/vts/ReadbackVts.cpp b/graphics/composer/aidl/vts/ReadbackVts.cpp index abb58e25dde0a2ad342785c6733fe13502b7b0d0..860562809838a4daaefe324240e94019f5ab64ff 100644 --- a/graphics/composer/aidl/vts/ReadbackVts.cpp +++ b/graphics/composer/aidl/vts/ReadbackVts.cpp @@ -35,6 +35,7 @@ void TestLayer::write(ComposerClientWriter& writer) { writer.setLayerPlaneAlpha(mDisplay, mLayer, mAlpha); writer.setLayerBlendMode(mDisplay, mLayer, mBlendMode); writer.setLayerBrightness(mDisplay, mLayer, mBrightness); + writer.setLayerDataspace(mDisplay, mLayer, mDataspace); } std::string ReadbackHelper::getColorModeString(ColorMode mode) { @@ -99,6 +100,7 @@ LayerSettings TestLayer::toRenderEngineLayerSettings() { layerSettings.geometry.positionTransform = scale * translation; layerSettings.whitePointNits = mWhitePointNits; + layerSettings.sourceDataspace = static_cast<::android::ui::Dataspace>(mDataspace); return layerSettings; } @@ -189,6 +191,23 @@ void ReadbackHelper::compareColorBuffers(const std::vector& expectedColor } } +void ReadbackHelper::compareColorBuffers(void* expectedBuffer, void* actualBuffer, + const uint32_t stride, const uint32_t width, + const uint32_t height, common::PixelFormat pixelFormat) { + const int32_t bytesPerPixel = ReadbackHelper::GetBytesPerPixel(pixelFormat); + ASSERT_NE(-1, bytesPerPixel); + for (int row = 0; row < height; row++) { + for (int col = 0; col < width; col++) { + int offset = (row * static_cast(stride) + col) * bytesPerPixel; + uint8_t* expectedColor = (uint8_t*)expectedBuffer + offset; + uint8_t* actualColor = (uint8_t*)actualBuffer + offset; + ASSERT_EQ(expectedColor[0], actualColor[0]); + ASSERT_EQ(expectedColor[1], actualColor[1]); + ASSERT_EQ(expectedColor[2], actualColor[2]); + } + } +} + ReadbackBuffer::ReadbackBuffer(int64_t display, const std::shared_ptr& client, int32_t width, int32_t height, common::PixelFormat pixelFormat, common::Dataspace dataspace) @@ -248,6 +267,15 @@ void ReadbackBuffer::checkReadbackBuffer(const std::vector& expectedColor EXPECT_EQ(::android::OK, status); } +::android::sp<::android::GraphicBuffer> ReadbackBuffer::getBuffer() { + const auto& [fenceStatus, bufferFence] = mComposerClient->getReadbackBufferFence(mDisplay); + EXPECT_TRUE(fenceStatus.isOk()); + if (bufferFence.get() != -1) { + sync_wait(bufferFence.get(), -1); + } + return mGraphicBuffer; +} + void TestColorLayer::write(ComposerClientWriter& writer) { TestLayer::write(writer); writer.setLayerCompositionType(mDisplay, mLayer, Composition::SOLID_COLOR); @@ -344,10 +372,6 @@ void TestBufferLayer::setBuffer(std::vector colors) { "TestBufferLayer"); } -void TestBufferLayer::setDataspace(common::Dataspace dataspace, ComposerClientWriter& writer) { - writer.setLayerDataspace(mDisplay, mLayer, dataspace); -} - void TestBufferLayer::setToClientComposition(ComposerClientWriter& writer) { writer.setLayerCompositionType(mDisplay, mLayer, Composition::CLIENT); } diff --git a/graphics/composer/aidl/vts/ReadbackVts.h b/graphics/composer/aidl/vts/ReadbackVts.h index ee9f0d58ad4d772e76cf78798780cbb646a8eadd..ee205735f199c732b4da21c4b2f4646388ec9334 100644 --- a/graphics/composer/aidl/vts/ReadbackVts.h +++ b/graphics/composer/aidl/vts/ReadbackVts.h @@ -20,7 +20,6 @@ #include #include #include -#include #include #include #include @@ -32,7 +31,6 @@ namespace aidl::android::hardware::graphics::composer3::vts { using ::android::renderengine::LayerSettings; using common::Dataspace; using common::PixelFormat; -using IMapper2_1 = ::android::hardware::graphics::mapper::V2_1::IMapper; static const Color BLACK = {0.0f, 0.0f, 0.0f, 1.0f}; static const Color RED = {1.0f, 0.0f, 0.0f, 1.0f}; @@ -44,6 +42,9 @@ static const Color TRANSLUCENT_RED = {1.0f, 0.0f, 0.0f, 0.3f}; static const Color GREEN = {0.0f, 1.0f, 0.0f, 1.0f}; static const Color BLUE = {0.0f, 0.0f, 1.0f, 1.0f}; static const Color WHITE = {1.0f, 1.0f, 1.0f, 1.0f}; +static const Color LIGHT_RED = {0.5f, 0.0f, 0.0f, 1.0f}; +static const Color LIGHT_GREEN = {0.0f, 0.5f, 0.0f, 1.0f}; +static const Color LIGHT_BLUE = {0.0f, 0.0f, 0.5f, 1.0f}; class TestRenderEngine; @@ -73,6 +74,8 @@ class TestLayer { mSurfaceDamage = std::move(surfaceDamage); } + void setDataspace(Dataspace dataspace) { mDataspace = dataspace; } + void setTransform(Transform transform) { mTransform = transform; } void setAlpha(float alpha) { mAlpha = alpha; } void setBlendMode(BlendMode blendMode) { mBlendMode = blendMode; } @@ -100,6 +103,7 @@ class TestLayer { float mAlpha = 1.0; BlendMode mBlendMode = BlendMode::NONE; uint32_t mZOrder = 0; + Dataspace mDataspace = Dataspace::UNKNOWN; }; class TestColorLayer : public TestLayer { @@ -132,8 +136,6 @@ class TestBufferLayer : public TestLayer { void setBuffer(std::vector colors); - void setDataspace(Dataspace dataspace, ComposerClientWriter& writer); - void setToClientComposition(ComposerClientWriter& writer); uint32_t getWidth() const { return mWidth; } @@ -187,6 +189,9 @@ class ReadbackHelper { static void compareColorBuffers(const std::vector& expectedColors, void* bufferData, const uint32_t stride, const uint32_t width, const uint32_t height, PixelFormat pixelFormat); + static void compareColorBuffers(void* expectedBuffer, void* actualBuffer, const uint32_t stride, + const uint32_t width, const uint32_t height, + PixelFormat pixelFormat); }; class ReadbackBuffer { @@ -198,6 +203,8 @@ class ReadbackBuffer { void checkReadbackBuffer(const std::vector& expectedColors); + ::android::sp<::android::GraphicBuffer> getBuffer(); + protected: uint32_t mWidth; uint32_t mHeight; diff --git a/graphics/composer/aidl/vts/RenderEngineVts.cpp b/graphics/composer/aidl/vts/RenderEngineVts.cpp index 66779c8cad9315942696dcbe0611b268a88340d8..4e7f7735ea61b1776ca79ab1997416d43f8d391d 100644 --- a/graphics/composer/aidl/vts/RenderEngineVts.cpp +++ b/graphics/composer/aidl/vts/RenderEngineVts.cpp @@ -19,7 +19,6 @@ namespace aidl::android::hardware::graphics::composer3::vts { -using ::android::hardware::graphics::mapper::V2_1::IMapper; using ::android::renderengine::DisplaySettings; using ::android::renderengine::LayerSettings; using ::android::renderengine::RenderEngineCreationArgs; @@ -67,7 +66,7 @@ void TestRenderEngine::drawLayers() { mGraphicBuffer, *mRenderEngine, ::android::renderengine::impl::ExternalTexture::Usage::WRITEABLE); auto result = mRenderEngine - ->drawLayers(mDisplaySettings, compositionLayers, texture, true, + ->drawLayers(mDisplaySettings, compositionLayers, texture, std::move(bufferFence)) .get(); if (result.ok()) { @@ -90,4 +89,32 @@ void TestRenderEngine::checkColorBuffer(const std::vector& expectedColors ASSERT_EQ(::android::OK, mGraphicBuffer->unlock()); } +void TestRenderEngine::checkColorBuffer(const ::android::sp<::android::GraphicBuffer>& buffer) { + ASSERT_EQ(mGraphicBuffer->getWidth(), buffer->getWidth()); + ASSERT_EQ(mGraphicBuffer->getHeight(), buffer->getHeight()); + void* renderedBufferData; + int32_t bytesPerPixel = -1; + int32_t bytesPerStride = -1; + ASSERT_EQ(0, mGraphicBuffer->lock(static_cast(mGraphicBuffer->getUsage()), + &renderedBufferData, &bytesPerPixel, &bytesPerStride)); + const uint32_t renderedStride = (bytesPerPixel > 0 && bytesPerStride > 0) + ? static_cast(bytesPerStride / bytesPerPixel) + : mGraphicBuffer->getStride(); + + void* bufferData; + ASSERT_EQ(0, buffer->lock(static_cast(buffer->getUsage()), &bufferData, + &bytesPerPixel, &bytesPerStride)); + const uint32_t bufferStride = (bytesPerPixel > 0 && bytesPerStride > 0) + ? static_cast(bytesPerStride / bytesPerPixel) + : buffer->getStride(); + + ASSERT_EQ(renderedStride, bufferStride); + + ReadbackHelper::compareColorBuffers(renderedBufferData, bufferData, bufferStride, + mGraphicBuffer->getWidth(), mGraphicBuffer->getHeight(), + mFormat); + ASSERT_EQ(::android::OK, buffer->unlock()); + ASSERT_EQ(::android::OK, mGraphicBuffer->unlock()); +} + } // namespace aidl::android::hardware::graphics::composer3::vts diff --git a/graphics/composer/aidl/vts/RenderEngineVts.h b/graphics/composer/aidl/vts/RenderEngineVts.h index 43d3a42808ee53bd89480393170b3233b8b77d52..bbe508f620ad999e3d719769c8f1d36b242292a9 100644 --- a/graphics/composer/aidl/vts/RenderEngineVts.h +++ b/graphics/composer/aidl/vts/RenderEngineVts.h @@ -15,13 +15,11 @@ */ #pragma once -#include #include #include #include #include #include -#include #include #include #include @@ -29,7 +27,6 @@ namespace aidl::android::hardware::graphics::composer3::vts { -using ::android::hardware::graphics::mapper::V2_1::IMapper; using ::android::renderengine::DisplaySettings; using ::android::renderengine::ExternalTexture; using ::android::renderengine::RenderEngineCreationArgs; @@ -48,6 +45,7 @@ class TestRenderEngine { }; void drawLayers(); void checkColorBuffer(const std::vector& expectedColors); + void checkColorBuffer(const ::android::sp<::android::GraphicBuffer>& buffer); ::android::renderengine::RenderEngine& getInternalRenderEngine() { return *mRenderEngine; } diff --git a/graphics/composer/aidl/vts/VtsComposerClient.cpp b/graphics/composer/aidl/vts/VtsComposerClient.cpp index 25b0ca0a17228e9b0235cebda65d53cae5165079..ac08cd151f7a762678ab50a2e25a76c3c97cb763 100644 --- a/graphics/composer/aidl/vts/VtsComposerClient.cpp +++ b/graphics/composer/aidl/vts/VtsComposerClient.cpp @@ -58,7 +58,7 @@ bool VtsComposerClient::tearDown() { return verifyComposerCallbackParams() && destroyAllLayers(); } -std::pair VtsComposerClient::getInterfaceVersion() { +std::pair VtsComposerClient::getInterfaceVersion() const { int32_t version = 1; auto status = mComposerClient->getInterfaceVersion(&version); return {std::move(status), version}; @@ -295,7 +295,31 @@ std::pair VtsComposerClient::getDisplayCon std::pair> VtsComposerClient::getDisplayConfigs( int64_t display) { std::vector outConfigs; - return {mComposerClient->getDisplayConfigs(display, &outConfigs), outConfigs}; + if (!getDisplayConfigurationSupported()) { + return {mComposerClient->getDisplayConfigs(display, &outConfigs), outConfigs}; + } + + auto [status, configs] = getDisplayConfigurations(display); + if (!status.isOk()) { + return {std::move(status), outConfigs}; + } + for (const auto& config : configs) { + outConfigs.emplace_back(config.configId); + } + return {std::move(status), outConfigs}; +} + +std::pair> +VtsComposerClient::getDisplayConfigurations(int64_t display) { + std::vector outConfigs; + return {mComposerClient->getDisplayConfigurations(display, kMaxFrameIntervalNs, &outConfigs), + outConfigs}; +} + +ScopedAStatus VtsComposerClient::notifyExpectedPresent(int64_t display, + ClockMonotonicTimestamp expectedPresentTime, + int frameIntervalNs) { + return mComposerClient->notifyExpectedPresent(display, expectedPresentTime, frameIntervalNs); } std::pair VtsComposerClient::getDisplayVsyncPeriod(int64_t display) { @@ -439,31 +463,41 @@ std::pair> VtsComposerClient::getDisplays vtsDisplays.reserve(displays.size()); for (int64_t display : displays) { auto vtsDisplay = VtsDisplay{display}; - auto configs = getDisplayConfigs(display); - if (!configs.first.isOk()) { - ALOGE("Unable to get the displays for test, failed to get the configs " - "for display %" PRId64, - display); - return {std::move(configs.first), vtsDisplays}; - } - for (int config : configs.second) { - auto status = addDisplayConfig(&vtsDisplay, config); + if (getDisplayConfigurationSupported()) { + auto [status, configs] = getDisplayConfigurations(display); + if (!status.isOk()) { + ALOGE("Unable to get the displays for test, failed to get the DisplayConfigs " + "for display %" PRId64, + display); + return {std::move(status), vtsDisplays}; + } + addDisplayConfigs(&vtsDisplay, configs); + } else { + auto [status, configs] = getDisplayConfigs(display); if (!status.isOk()) { - ALOGE("Unable to get the displays for test, failed to add config " + ALOGE("Unable to get the displays for test, failed to get the configs " "for display %" PRId64, display); return {std::move(status), vtsDisplays}; } + for (int config : configs) { + status = addDisplayConfigLegacy(&vtsDisplay, config); + if (!status.isOk()) { + ALOGE("Unable to get the displays for test, failed to add config " + "for display %" PRId64, + display); + return {std::move(status), vtsDisplays}; + } + } } - - auto config = getActiveConfig(display); - if (!config.first.isOk()) { + auto activeConfig = getActiveConfig(display); + if (!activeConfig.first.isOk()) { ALOGE("Unable to get the displays for test, failed to get active config " - "for display %" PRId64, display); - return {std::move(config.first), vtsDisplays}; + "for display %" PRId64, + display); + return {std::move(activeConfig.first), vtsDisplays}; } - - auto status = updateDisplayProperties(&vtsDisplay, config.second); + auto status = updateDisplayProperties(&vtsDisplay, activeConfig.second); if (!status.isOk()) { ALOGE("Unable to get the displays for test, " "failed to update the properties " @@ -480,39 +514,54 @@ std::pair> VtsComposerClient::getDisplays } } -ScopedAStatus VtsComposerClient::addDisplayConfig(VtsDisplay* vtsDisplay, int32_t config) { - const auto width = - getDisplayAttribute(vtsDisplay->getDisplayId(), config, DisplayAttribute::WIDTH); - const auto height = - getDisplayAttribute(vtsDisplay->getDisplayId(), config, DisplayAttribute::HEIGHT); +void VtsComposerClient::addDisplayConfigs(VtsDisplay* vtsDisplay, + const std::vector& configs) { + for (const auto& config : configs) { + vtsDisplay->addDisplayConfig(config.configId, + {config.vsyncPeriod, config.configGroup, config.vrrConfig}); + } +} + +ScopedAStatus VtsComposerClient::addDisplayConfigLegacy(VtsDisplay* vtsDisplay, int32_t config) { const auto vsyncPeriod = getDisplayAttribute(vtsDisplay->getDisplayId(), config, DisplayAttribute::VSYNC_PERIOD); const auto configGroup = getDisplayAttribute(vtsDisplay->getDisplayId(), config, DisplayAttribute::CONFIG_GROUP); - if (width.first.isOk() && height.first.isOk() && vsyncPeriod.first.isOk() && - configGroup.first.isOk()) { + if (vsyncPeriod.first.isOk() && configGroup.first.isOk()) { vtsDisplay->addDisplayConfig(config, {vsyncPeriod.second, configGroup.second}); return ScopedAStatus::ok(); } - LOG(ERROR) << "Failed to update display property for width: " << width.first.isOk() - << ", height: " << height.first.isOk() << ", vsync: " << vsyncPeriod.first.isOk() + LOG(ERROR) << "Failed to update display property vsync: " << vsyncPeriod.first.isOk() << ", config: " << configGroup.first.isOk(); return ScopedAStatus::fromServiceSpecificError(IComposerClient::EX_BAD_CONFIG); } ScopedAStatus VtsComposerClient::updateDisplayProperties(VtsDisplay* vtsDisplay, int32_t config) { - const auto width = - getDisplayAttribute(vtsDisplay->getDisplayId(), config, DisplayAttribute::WIDTH); - const auto height = - getDisplayAttribute(vtsDisplay->getDisplayId(), config, DisplayAttribute::HEIGHT); - if (width.first.isOk() && height.first.isOk()) { - vtsDisplay->setDimensions(width.second, height.second); - return ScopedAStatus::ok(); - } + if (getDisplayConfigurationSupported()) { + auto [status, configs] = getDisplayConfigurations(vtsDisplay->getDisplayId()); + if (status.isOk()) { + for (const auto& displayConfig : configs) { + if (displayConfig.configId == config) { + vtsDisplay->setDimensions(displayConfig.width, displayConfig.height); + return ScopedAStatus::ok(); + } + } + } + LOG(ERROR) << "Failed to update display property with DisplayConfig"; + } else { + const auto width = + getDisplayAttribute(vtsDisplay->getDisplayId(), config, DisplayAttribute::WIDTH); + const auto height = + getDisplayAttribute(vtsDisplay->getDisplayId(), config, DisplayAttribute::HEIGHT); + if (width.first.isOk() && height.first.isOk()) { + vtsDisplay->setDimensions(width.second, height.second); + return ScopedAStatus::ok(); + } - LOG(ERROR) << "Failed to update display property for width: " << width.first.isOk() - << ", height: " << height.first.isOk(); + LOG(ERROR) << "Failed to update display property for width: " << width.first.isOk() + << ", height: " << height.first.isOk(); + } return ScopedAStatus::fromServiceSpecificError(IComposerClient::EX_BAD_CONFIG); } @@ -576,6 +625,13 @@ bool VtsComposerClient::verifyComposerCallbackParams() { return isValid; } +bool VtsComposerClient::getDisplayConfigurationSupported() const { + auto [status, interfaceVersion] = getInterfaceVersion(); + EXPECT_TRUE(status.isOk()); + // getDisplayConfigurations api is supported starting interface version 3 + return interfaceVersion >= 3; +} + bool VtsComposerClient::destroyAllLayers() { std::unordered_map physicalDisplays; while (!mDisplayResources.empty()) { diff --git a/graphics/composer/aidl/vts/VtsComposerClient.h b/graphics/composer/aidl/vts/VtsComposerClient.h index ea3318c2cea07b882a55177f560e4e26a63d6b4e..292bc407f8317709419f3470cc24f4e90fd962a3 100644 --- a/graphics/composer/aidl/vts/VtsComposerClient.h +++ b/graphics/composer/aidl/vts/VtsComposerClient.h @@ -61,7 +61,7 @@ class VtsComposerClient { bool tearDown(); - std::pair getInterfaceVersion(); + std::pair getInterfaceVersion() const; std::pair createVirtualDisplay(int32_t width, int32_t height, PixelFormat pixelFormat, @@ -142,6 +142,13 @@ class VtsComposerClient { std::pair> getDisplayConfigs(int64_t display); + std::pair> getDisplayConfigurations( + int64_t display); + + ScopedAStatus notifyExpectedPresent(int64_t display, + ClockMonotonicTimestamp expectedPresentTime, + int frameIntervalNs); + std::pair getDisplayVsyncPeriod(int64_t display); ScopedAStatus setAutoLowLatencyMode(int64_t display, bool isEnabled); @@ -189,8 +196,13 @@ class VtsComposerClient { std::vector takeListOfRefreshRateChangedDebugData(); + static constexpr int32_t kMaxFrameIntervalNs = 50000000; // 20fps + static constexpr int32_t kNoFrameIntervalNs = 0; + private: - ScopedAStatus addDisplayConfig(VtsDisplay* vtsDisplay, int32_t config); + void addDisplayConfigs(VtsDisplay*, const std::vector&); + ScopedAStatus addDisplayConfigLegacy(VtsDisplay*, int32_t config); + bool getDisplayConfigurationSupported() const; ScopedAStatus updateDisplayProperties(VtsDisplay* vtsDisplay, int32_t config); ScopedAStatus addDisplayToDisplayResources(int64_t display, bool isVirtual); @@ -241,10 +253,14 @@ class VtsDisplay { int32_t getDisplayHeight() const { return mDisplayHeight; } struct DisplayConfig { - DisplayConfig(int32_t vsyncPeriod_, int32_t configGroup_) - : vsyncPeriod(vsyncPeriod_), configGroup(configGroup_) {} + DisplayConfig(int32_t vsyncPeriod_, int32_t configGroup_, + std::optional vrrConfig_ = {}) + : vsyncPeriod(vsyncPeriod_), + configGroup(configGroup_), + vrrConfig(std::move(vrrConfig_)) {} int32_t vsyncPeriod; int32_t configGroup; + std::optional vrrConfig; }; void addDisplayConfig(int32_t config, DisplayConfig displayConfig) { diff --git a/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_ReadbackTest.cpp b/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_ReadbackTest.cpp index 9b849cc133ba6c3d630e43edc89f3d8e5ba056a3..2e3f4df01502598d180ff4bb1117d4d3fc30b61c 100644 --- a/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_ReadbackTest.cpp +++ b/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_ReadbackTest.cpp @@ -64,16 +64,15 @@ class GraphicsCompositionTestBase : public ::testing::Test { ::android::renderengine::RenderEngineCreationArgs::Builder() .setPixelFormat(static_cast(common::PixelFormat::RGBA_8888)) .setImageCacheSize(TestRenderEngine::sMaxFrameBufferAcquireBuffers) - .setUseColorManagerment(true) .setEnableProtectedContext(false) .setPrecacheToneMapperShaderOnly(false) .setContextPriority(::android::renderengine::RenderEngine:: ContextPriority::HIGH) .build()))); - ::android::renderengine::DisplaySettings clientCompositionDisplay; - clientCompositionDisplay.physicalDisplay = Rect(getDisplayWidth(), getDisplayHeight()); - clientCompositionDisplay.clip = clientCompositionDisplay.physicalDisplay; + mClientCompositionDisplaySettings.physicalDisplay = + Rect(getDisplayWidth(), getDisplayHeight()); + mClientCompositionDisplaySettings.clip = mClientCompositionDisplaySettings.physicalDisplay; mTestRenderEngine->initGraphicBuffer( static_cast(getDisplayWidth()), static_cast(getDisplayHeight()), @@ -82,7 +81,7 @@ class GraphicsCompositionTestBase : public ::testing::Test { static_cast(common::BufferUsage::CPU_READ_OFTEN) | static_cast(common::BufferUsage::CPU_WRITE_OFTEN) | static_cast(common::BufferUsage::GPU_RENDER_TARGET))); - mTestRenderEngine->setDisplaySettings(clientCompositionDisplay); + mTestRenderEngine->setDisplaySettings(mClientCompositionDisplaySettings); } void TearDown() override { @@ -164,6 +163,7 @@ class GraphicsCompositionTestBase : public ::testing::Test { std::unique_ptr mTestRenderEngine; common::PixelFormat mPixelFormat; common::Dataspace mDataspace; + ::android::renderengine::DisplaySettings mClientCompositionDisplaySettings; static constexpr uint32_t kClientTargetSlotCount = 64; @@ -220,7 +220,8 @@ TEST_P(GraphicsCompositionTest, SingleSolidColorLayer) { writeLayers(layers); ASSERT_TRUE(mReader.takeErrors().empty()); - mWriter->validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp); + mWriter->validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp, + VtsComposerClient::kNoFrameIntervalNs); execute(); // if hwc cannot handle and asks for composition change, // just succeed the test @@ -272,14 +273,15 @@ TEST_P(GraphicsCompositionTest, SetLayerBuffer) { getDisplayHeight(), common::PixelFormat::RGBA_8888); layer->setDisplayFrame({0, 0, getDisplayWidth(), getDisplayHeight()}); layer->setZOrder(10); - layer->setDataspace(ReadbackHelper::getDataspaceForColorMode(mode), *mWriter); + layer->setDataspace(ReadbackHelper::getDataspaceForColorMode(mode)); ASSERT_NO_FATAL_FAILURE(layer->setBuffer(expectedColors)); std::vector> layers = {layer}; writeLayers(layers); ASSERT_TRUE(mReader.takeErrors().empty()); - mWriter->validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp); + mWriter->validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp, + VtsComposerClient::kNoFrameIntervalNs); execute(); if (!mReader.takeChangedCompositionTypes(getPrimaryDisplayId()).empty()) { @@ -338,7 +340,8 @@ TEST_P(GraphicsCompositionTest, SetLayerBufferNoEffect) { getDisplayHeight(), mPixelFormat, mDataspace); ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer()); - mWriter->validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp); + mWriter->validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp, + VtsComposerClient::kNoFrameIntervalNs); execute(); if (!mReader.takeChangedCompositionTypes(getPrimaryDisplayId()).empty()) { @@ -456,7 +459,7 @@ TEST_P(GraphicsCompositionTest, ClientComposition) { getDisplayHeight(), PixelFormat::RGBA_FP16); layer->setDisplayFrame({0, 0, getDisplayWidth(), getDisplayHeight()}); layer->setZOrder(10); - layer->setDataspace(ReadbackHelper::getDataspaceForColorMode(mode), *mWriter); + layer->setDataspace(ReadbackHelper::getDataspaceForColorMode(mode)); std::vector> layers = {layer}; @@ -465,7 +468,8 @@ TEST_P(GraphicsCompositionTest, ClientComposition) { ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer()); writeLayers(layers); ASSERT_TRUE(mReader.takeErrors().empty()); - mWriter->validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp); + mWriter->validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp, + VtsComposerClient::kNoFrameIntervalNs); execute(); auto changedCompositionTypes = mReader.takeChangedCompositionTypes(getPrimaryDisplayId()); @@ -496,9 +500,10 @@ TEST_P(GraphicsCompositionTest, ClientComposition) { const auto unlockStatus = graphicBuffer->unlockAsync(&clientFence); ASSERT_EQ(::android::OK, unlockStatus); mWriter->setClientTarget(getPrimaryDisplayId(), /*slot*/ 0, buffer, clientFence, - clientDataspace, std::vector(1, damage)); + clientDataspace, std::vector(1, damage), 1.f); layer->setToClientComposition(*mWriter); - mWriter->validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp); + mWriter->validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp, + VtsComposerClient::kNoFrameIntervalNs); execute(); changedCompositionTypes = mReader.takeChangedCompositionTypes(getPrimaryDisplayId()); ASSERT_TRUE(changedCompositionTypes.empty()); @@ -554,7 +559,7 @@ TEST_P(GraphicsCompositionTest, DeviceAndClientComposition) { deviceLayer->setDisplayFrame({0, 0, static_cast(deviceLayer->getWidth()), static_cast(deviceLayer->getHeight())}); deviceLayer->setZOrder(10); - deviceLayer->setDataspace(ReadbackHelper::getDataspaceForColorMode(mode), *mWriter); + deviceLayer->setDataspace(ReadbackHelper::getDataspaceForColorMode(mode)); ASSERT_NO_FATAL_FAILURE(deviceLayer->setBuffer(deviceColors)); deviceLayer->write(*mWriter); @@ -575,7 +580,8 @@ TEST_P(GraphicsCompositionTest, DeviceAndClientComposition) { clientLayer->setDisplayFrame(clientFrame); clientLayer->setZOrder(0); clientLayer->write(*mWriter); - mWriter->validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp); + mWriter->validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp, + VtsComposerClient::kNoFrameIntervalNs); execute(); auto changedCompositionTypes = mReader.takeChangedCompositionTypes(getPrimaryDisplayId()); @@ -602,9 +608,10 @@ TEST_P(GraphicsCompositionTest, DeviceAndClientComposition) { const auto unlockStatus = graphicBuffer->unlockAsync(&clientFence); ASSERT_EQ(::android::OK, unlockStatus); mWriter->setClientTarget(getPrimaryDisplayId(), /*slot*/ 0, buffer, clientFence, - clientDataspace, std::vector(1, clientFrame)); + clientDataspace, std::vector(1, clientFrame), 1.f); clientLayer->setToClientComposition(*mWriter); - mWriter->validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp); + mWriter->validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp, + VtsComposerClient::kNoFrameIntervalNs); execute(); changedCompositionTypes = mReader.takeChangedCompositionTypes(getPrimaryDisplayId()); ASSERT_TRUE(changedCompositionTypes.empty()); @@ -641,7 +648,7 @@ TEST_P(GraphicsCompositionTest, SetLayerDamage) { getDisplayHeight(), PixelFormat::RGBA_8888); layer->setDisplayFrame({0, 0, getDisplayWidth(), getDisplayHeight()}); layer->setZOrder(10); - layer->setDataspace(ReadbackHelper::getDataspaceForColorMode(mode), *mWriter); + layer->setDataspace(ReadbackHelper::getDataspaceForColorMode(mode)); ASSERT_NO_FATAL_FAILURE(layer->setBuffer(expectedColors)); std::vector> layers = {layer}; @@ -652,7 +659,8 @@ TEST_P(GraphicsCompositionTest, SetLayerDamage) { writeLayers(layers); ASSERT_TRUE(mReader.takeErrors().empty()); - mWriter->validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp); + mWriter->validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp, + VtsComposerClient::kNoFrameIntervalNs); execute(); if (!mReader.takeChangedCompositionTypes(getPrimaryDisplayId()).empty()) { GTEST_SUCCEED(); @@ -680,7 +688,8 @@ TEST_P(GraphicsCompositionTest, SetLayerDamage) { writeLayers(layers); ASSERT_TRUE(mReader.takeErrors().empty()); - mWriter->validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp); + mWriter->validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp, + VtsComposerClient::kNoFrameIntervalNs); execute(); ASSERT_TRUE(mReader.takeErrors().empty()); ASSERT_TRUE(mReader.takeChangedCompositionTypes(getPrimaryDisplayId()).empty()); @@ -721,7 +730,8 @@ TEST_P(GraphicsCompositionTest, SetLayerPlaneAlpha) { writeLayers(layers); ASSERT_TRUE(mReader.takeErrors().empty()); - mWriter->validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp); + mWriter->validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp, + VtsComposerClient::kNoFrameIntervalNs); execute(); if (!mReader.takeChangedCompositionTypes(getPrimaryDisplayId()).empty()) { GTEST_SUCCEED(); @@ -769,7 +779,7 @@ TEST_P(GraphicsCompositionTest, SetLayerSourceCrop) { getDisplayHeight(), PixelFormat::RGBA_8888); layer->setDisplayFrame({0, 0, getDisplayWidth(), getDisplayHeight()}); layer->setZOrder(10); - layer->setDataspace(ReadbackHelper::getDataspaceForColorMode(mode), *mWriter); + layer->setDataspace(ReadbackHelper::getDataspaceForColorMode(mode)); layer->setSourceCrop({0, static_cast(getDisplayHeight() / 2), static_cast(getDisplayWidth()), static_cast(getDisplayHeight())}); @@ -785,7 +795,8 @@ TEST_P(GraphicsCompositionTest, SetLayerSourceCrop) { ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer()); writeLayers(layers); ASSERT_TRUE(mReader.takeErrors().empty()); - mWriter->validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp); + mWriter->validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp, + VtsComposerClient::kNoFrameIntervalNs); execute(); if (!mReader.takeChangedCompositionTypes(getPrimaryDisplayId()).empty()) { GTEST_SUCCEED(); @@ -843,7 +854,8 @@ TEST_P(GraphicsCompositionTest, SetLayerZOrder) { writeLayers(layers); ASSERT_TRUE(mReader.takeErrors().empty()); - mWriter->validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp); + mWriter->validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp, + VtsComposerClient::kNoFrameIntervalNs); execute(); if (!mReader.takeChangedCompositionTypes(getPrimaryDisplayId()).empty()) { GTEST_SUCCEED(); @@ -865,7 +877,8 @@ TEST_P(GraphicsCompositionTest, SetLayerZOrder) { writeLayers(layers); ASSERT_TRUE(mReader.takeErrors().empty()); - mWriter->validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp); + mWriter->validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp, + VtsComposerClient::kNoFrameIntervalNs); execute(); ASSERT_TRUE(mReader.takeChangedCompositionTypes(getPrimaryDisplayId()).empty()); ASSERT_TRUE(mReader.takeErrors().empty()); @@ -930,7 +943,8 @@ TEST_P(GraphicsCompositionTest, SetLayerBrightnessDims) { writeLayers(layers); ASSERT_TRUE(mReader.takeErrors().empty()); - mWriter->validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp); + mWriter->validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp, + VtsComposerClient::kNoFrameIntervalNs); execute(); if (!mReader.takeChangedCompositionTypes(getPrimaryDisplayId()).empty()) { GTEST_SUCCEED() @@ -988,7 +1002,7 @@ class GraphicsBlendModeCompositionTest getDisplayHeight(), PixelFormat::RGBA_8888); layer->setDisplayFrame({0, 0, getDisplayWidth(), getDisplayHeight()}); layer->setZOrder(10); - layer->setDataspace(Dataspace::UNKNOWN, *mWriter); + layer->setDataspace(Dataspace::UNKNOWN); ASSERT_NO_FATAL_FAILURE(layer->setBuffer(topLayerPixelColors)); layer->setBlendMode(blendMode); @@ -1065,7 +1079,8 @@ TEST_P(GraphicsBlendModeCompositionTest, None) { ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer()); writeLayers(mLayers); ASSERT_TRUE(mReader.takeErrors().empty()); - mWriter->validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp); + mWriter->validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp, + VtsComposerClient::kNoFrameIntervalNs); execute(); if (!mReader.takeChangedCompositionTypes(getPrimaryDisplayId()).empty()) { GTEST_SUCCEED(); @@ -1110,7 +1125,8 @@ TEST_P(GraphicsBlendModeCompositionTest, Coverage) { ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer()); writeLayers(mLayers); ASSERT_TRUE(mReader.takeErrors().empty()); - mWriter->validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp); + mWriter->validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp, + VtsComposerClient::kNoFrameIntervalNs); execute(); if (!mReader.takeChangedCompositionTypes(getPrimaryDisplayId()).empty()) { GTEST_SUCCEED(); @@ -1150,7 +1166,8 @@ TEST_P(GraphicsBlendModeCompositionTest, Premultiplied) { ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer()); writeLayers(mLayers); ASSERT_TRUE(mReader.takeErrors().empty()); - mWriter->validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp); + mWriter->validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp, + VtsComposerClient::kNoFrameIntervalNs); execute(); if (!mReader.takeChangedCompositionTypes(getPrimaryDisplayId()).empty()) { GTEST_SUCCEED(); @@ -1223,7 +1240,7 @@ TEST_P(GraphicsTransformCompositionTest, FLIP_H) { getDisplayHeight(), mPixelFormat, mDataspace); ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer()); mLayer->setTransform(Transform::FLIP_H); - mLayer->setDataspace(ReadbackHelper::getDataspaceForColorMode(mode), *mWriter); + mLayer->setDataspace(ReadbackHelper::getDataspaceForColorMode(mode)); std::vector expectedColors( static_cast(getDisplayWidth() * getDisplayHeight())); @@ -1234,7 +1251,8 @@ TEST_P(GraphicsTransformCompositionTest, FLIP_H) { writeLayers(mLayers); ASSERT_TRUE(mReader.takeErrors().empty()); - mWriter->validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp); + mWriter->validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp, + VtsComposerClient::kNoFrameIntervalNs); execute(); if (!mReader.takeChangedCompositionTypes(getPrimaryDisplayId()).empty()) { GTEST_SUCCEED(); @@ -1269,7 +1287,7 @@ TEST_P(GraphicsTransformCompositionTest, FLIP_V) { ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer()); mLayer->setTransform(Transform::FLIP_V); - mLayer->setDataspace(ReadbackHelper::getDataspaceForColorMode(mode), *mWriter); + mLayer->setDataspace(ReadbackHelper::getDataspaceForColorMode(mode)); std::vector expectedColors( static_cast(getDisplayWidth() * getDisplayHeight())); @@ -1280,7 +1298,8 @@ TEST_P(GraphicsTransformCompositionTest, FLIP_V) { writeLayers(mLayers); ASSERT_TRUE(mReader.takeErrors().empty()); - mWriter->validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp); + mWriter->validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp, + VtsComposerClient::kNoFrameIntervalNs); execute(); if (!mReader.takeChangedCompositionTypes(getPrimaryDisplayId()).empty()) { GTEST_SUCCEED(); @@ -1314,7 +1333,7 @@ TEST_P(GraphicsTransformCompositionTest, ROT_180) { ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer()); mLayer->setTransform(Transform::ROT_180); - mLayer->setDataspace(ReadbackHelper::getDataspaceForColorMode(mode), *mWriter); + mLayer->setDataspace(ReadbackHelper::getDataspaceForColorMode(mode)); std::vector expectedColors( static_cast(getDisplayWidth() * getDisplayHeight())); @@ -1326,7 +1345,8 @@ TEST_P(GraphicsTransformCompositionTest, ROT_180) { writeLayers(mLayers); ASSERT_TRUE(mReader.takeErrors().empty()); - mWriter->validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp); + mWriter->validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp, + VtsComposerClient::kNoFrameIntervalNs); execute(); if (!mReader.takeChangedCompositionTypes(getPrimaryDisplayId()).empty()) { GTEST_SUCCEED(); @@ -1343,6 +1363,101 @@ TEST_P(GraphicsTransformCompositionTest, ROT_180) { } } +class GraphicsColorManagementCompositionTest + : public GraphicsCompositionTestBase, + public testing::WithParamInterface> { + public: + void SetUp() override { + SetUpBase(std::get<0>(GetParam())); + // for some reason only sRGB reliably works + mTestColorModes.erase( + std::remove_if(mTestColorModes.begin(), mTestColorModes.end(), + [](ColorMode mode) { return mode != ColorMode::SRGB; }), + mTestColorModes.end()); + auto standard = std::get<1>(GetParam()); + auto transfer = std::get<2>(GetParam()); + auto range = std::get<3>(GetParam()); + + mLayerDataspace = static_cast(static_cast(standard) | + static_cast(transfer) | + static_cast(range)); + ALOGD("Invoking test for dataspace: {%s, %s, %s}", toString(standard).c_str(), + toString(transfer).c_str(), toString(range).c_str()); + } + + void makeLayer() { + mLayer = std::make_shared( + mComposerClient, *mTestRenderEngine, getPrimaryDisplayId(), getDisplayWidth(), + getDisplayHeight(), common::PixelFormat::RGBA_8888); + mLayer->setDisplayFrame({0, 0, getDisplayWidth(), getDisplayHeight()}); + mLayer->setZOrder(10); + mLayer->setAlpha(1.f); + mLayer->setDataspace(mLayerDataspace); + } + + void fillColor(Color color) { + std::vector baseColors(static_cast(getDisplayWidth() * getDisplayHeight())); + ReadbackHelper::fillColorsArea(baseColors, getDisplayWidth(), + common::Rect{.left = 0, + .top = 0, + .right = getDisplayWidth(), + .bottom = getDisplayHeight()}, + color); + ASSERT_NO_FATAL_FAILURE(mLayer->setBuffer(baseColors)); + } + + Dataspace mLayerDataspace; + std::shared_ptr mLayer; +}; + +TEST_P(GraphicsColorManagementCompositionTest, ColorConversion) { + for (ColorMode mode : mTestColorModes) { + EXPECT_TRUE(mComposerClient + ->setColorMode(getPrimaryDisplayId(), mode, RenderIntent::COLORIMETRIC) + .isOk()); + + bool isSupported; + ASSERT_NO_FATAL_FAILURE(isSupported = getHasReadbackBuffer()); + if (!isSupported) { + GTEST_SUCCEED() << "Readback not supported or unsupported pixelFormat/dataspace"; + return; + } + + mClientCompositionDisplaySettings.outputDataspace = + static_cast<::android::ui::Dataspace>(mDataspace); + mTestRenderEngine->setDisplaySettings(mClientCompositionDisplaySettings); + + makeLayer(); + for (auto color : {LIGHT_RED, LIGHT_GREEN, LIGHT_BLUE}) { + ALOGD("Testing color: %f, %f, %f, %f with color mode: %d", color.r, color.g, color.b, + color.a, mode); + ReadbackBuffer readbackBuffer(getPrimaryDisplayId(), mComposerClient, getDisplayWidth(), + getDisplayHeight(), mPixelFormat, mDataspace); + ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer()); + fillColor(color); + writeLayers({mLayer}); + EXPECT_TRUE(mComposerClient->setPowerMode(getPrimaryDisplayId(), PowerMode::ON).isOk()); + + ASSERT_TRUE(mReader.takeErrors().empty()); + mWriter->validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp, + VtsComposerClient::kNoFrameIntervalNs); + execute(); + if (!mReader.takeChangedCompositionTypes(getPrimaryDisplayId()).empty()) { + continue; + } + ASSERT_TRUE(mReader.takeErrors().empty()); + mWriter->presentDisplay(getPrimaryDisplayId()); + execute(); + ASSERT_TRUE(mReader.takeErrors().empty()); + + mTestRenderEngine->setRenderLayers({mLayer}); + ASSERT_NO_FATAL_FAILURE(mTestRenderEngine->drawLayers()); + ASSERT_NO_FATAL_FAILURE( + mTestRenderEngine->checkColorBuffer(readbackBuffer.getBuffer())); + } + } +} + GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(GraphicsCompositionTest); INSTANTIATE_TEST_SUITE_P( PerInstance, GraphicsCompositionTest, @@ -1361,5 +1476,17 @@ INSTANTIATE_TEST_SUITE_P( testing::ValuesIn(::android::getAidlHalInstanceNames(IComposer::descriptor)), ::android::PrintInstanceNameToString); +GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(GraphicsColorManagementCompositionTest); +INSTANTIATE_TEST_SUITE_P(PerInstance, GraphicsColorManagementCompositionTest, + testing::Combine(testing::ValuesIn(::android::getAidlHalInstanceNames( + IComposer::descriptor)), + // Only check sRGB, but verify that extended range + // doesn't trigger any gamma shifts + testing::Values(Dataspace::STANDARD_BT709), + testing::Values(Dataspace::TRANSFER_SRGB), + // Don't test limited range until we send YUV overlays + testing::Values(Dataspace::RANGE_FULL, + Dataspace::RANGE_EXTENDED))); + } // namespace } // namespace aidl::android::hardware::graphics::composer3::vts diff --git a/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp b/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp index 323e35807d9c2c6aa974509dc35e36fa9a6bd986..086d2905e660daf6654e04ae5e5148edd5f1778b 100644 --- a/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp +++ b/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp @@ -34,6 +34,7 @@ #include #include #include +#include #include #include #include @@ -45,7 +46,6 @@ #define LOG_TAG "VtsHalGraphicsComposer3_TargetTest" namespace aidl::android::hardware::graphics::composer3::vts { -namespace { using namespace std::chrono_literals; @@ -891,39 +891,6 @@ TEST_P(GraphicsComposerAidlTest, GetDisplayName) { EXPECT_TRUE(status.isOk()); } -TEST_P(GraphicsComposerAidlTest, GetOverlaySupport) { - if (getInterfaceVersion() <= 1) { - GTEST_SUCCEED() << "Device does not support the new API for overlay support"; - return; - } - - const auto& [status, properties] = mComposerClient->getOverlaySupport(); - if (!status.isOk() && status.getExceptionCode() == EX_SERVICE_SPECIFIC && - status.getServiceSpecificError() == IComposerClient::EX_UNSUPPORTED) { - GTEST_SUCCEED() << "getOverlaySupport is not supported"; - return; - } - - ASSERT_TRUE(status.isOk()); - for (const auto& i : properties.combinations) { - for (const auto standard : i.standards) { - const auto val = static_cast(standard) & - static_cast(common::Dataspace::STANDARD_MASK); - ASSERT_TRUE(val == static_cast(standard)); - } - for (const auto transfer : i.transfers) { - const auto val = static_cast(transfer) & - static_cast(common::Dataspace::TRANSFER_MASK); - ASSERT_TRUE(val == static_cast(transfer)); - } - for (const auto range : i.ranges) { - const auto val = static_cast(range) & - static_cast(common::Dataspace::RANGE_MASK); - ASSERT_TRUE(val == static_cast(range)); - } - } -} - TEST_P(GraphicsComposerAidlTest, GetDisplayPhysicalOrientation_BadDisplay) { const auto& [status, _] = mComposerClient->getDisplayPhysicalOrientation(getInvalidDisplayId()); @@ -1169,6 +1136,238 @@ TEST_P(GraphicsComposerAidlTest, GetDataspaceSaturationMatrix_BadParameter) { EXPECT_NO_FATAL_FAILURE(assertServiceSpecificError(status, IComposerClient::EX_BAD_PARAMETER)); } +/* + * Test that no two display configs are exactly the same. + */ +TEST_P(GraphicsComposerAidlTest, GetDisplayConfigNoRepetitions) { + for (const auto& display : mDisplays) { + const auto& [status, configs] = mComposerClient->getDisplayConfigs(display.getDisplayId()); + for (std::vector::size_type i = 0; i < configs.size(); i++) { + for (std::vector::size_type j = i + 1; j < configs.size(); j++) { + const auto& [widthStatus1, width1] = mComposerClient->getDisplayAttribute( + display.getDisplayId(), configs[i], DisplayAttribute::WIDTH); + const auto& [heightStatus1, height1] = mComposerClient->getDisplayAttribute( + display.getDisplayId(), configs[i], DisplayAttribute::HEIGHT); + const auto& [vsyncPeriodStatus1, vsyncPeriod1] = + mComposerClient->getDisplayAttribute(display.getDisplayId(), configs[i], + DisplayAttribute::VSYNC_PERIOD); + const auto& [groupStatus1, group1] = mComposerClient->getDisplayAttribute( + display.getDisplayId(), configs[i], DisplayAttribute::CONFIG_GROUP); + + const auto& [widthStatus2, width2] = mComposerClient->getDisplayAttribute( + display.getDisplayId(), configs[j], DisplayAttribute::WIDTH); + const auto& [heightStatus2, height2] = mComposerClient->getDisplayAttribute( + display.getDisplayId(), configs[j], DisplayAttribute::HEIGHT); + const auto& [vsyncPeriodStatus2, vsyncPeriod2] = + mComposerClient->getDisplayAttribute(display.getDisplayId(), configs[j], + DisplayAttribute::VSYNC_PERIOD); + const auto& [groupStatus2, group2] = mComposerClient->getDisplayAttribute( + display.getDisplayId(), configs[j], DisplayAttribute::CONFIG_GROUP); + + ASSERT_FALSE(width1 == width2 && height1 == height2 && + vsyncPeriod1 == vsyncPeriod2 && group1 == group2); + } + } + } +} + +class GraphicsComposerAidlV2Test : public GraphicsComposerAidlTest { + protected: + void SetUp() override { + GraphicsComposerAidlTest::SetUp(); + if (getInterfaceVersion() <= 1) { + GTEST_SKIP() << "Device interface version is expected to be >= 2"; + } + } +}; + +TEST_P(GraphicsComposerAidlV2Test, GetOverlaySupport) { + const auto& [status, properties] = mComposerClient->getOverlaySupport(); + if (!status.isOk() && status.getExceptionCode() == EX_SERVICE_SPECIFIC && + status.getServiceSpecificError() == IComposerClient::EX_UNSUPPORTED) { + GTEST_SUCCEED() << "getOverlaySupport is not supported"; + return; + } + + ASSERT_TRUE(status.isOk()); + for (const auto& i : properties.combinations) { + for (const auto standard : i.standards) { + const auto val = static_cast(standard) & + static_cast(common::Dataspace::STANDARD_MASK); + ASSERT_TRUE(val == static_cast(standard)); + } + for (const auto transfer : i.transfers) { + const auto val = static_cast(transfer) & + static_cast(common::Dataspace::TRANSFER_MASK); + ASSERT_TRUE(val == static_cast(transfer)); + } + for (const auto range : i.ranges) { + const auto val = static_cast(range) & + static_cast(common::Dataspace::RANGE_MASK); + ASSERT_TRUE(val == static_cast(range)); + } + } +} + +class GraphicsComposerAidlV3Test : public GraphicsComposerAidlTest { + protected: + void SetUp() override { + GraphicsComposerAidlTest::SetUp(); + if (getInterfaceVersion() <= 2) { + GTEST_SKIP() << "Device interface version is expected to be >= 3"; + } + } +}; + +TEST_P(GraphicsComposerAidlV3Test, GetDisplayConfigurations) { + for (const auto& display : mDisplays) { + const auto& [status, displayConfigurations] = + mComposerClient->getDisplayConfigurations(display.getDisplayId()); + EXPECT_TRUE(status.isOk()); + EXPECT_FALSE(displayConfigurations.empty()); + + for (const auto& displayConfig : displayConfigurations) { + EXPECT_NE(-1, displayConfig.width); + EXPECT_NE(-1, displayConfig.height); + EXPECT_NE(-1, displayConfig.vsyncPeriod); + EXPECT_NE(-1, displayConfig.configGroup); + if (displayConfig.dpi) { + EXPECT_NE(-1.f, displayConfig.dpi->x); + EXPECT_NE(-1.f, displayConfig.dpi->y); + } + if (displayConfig.vrrConfig) { + const auto& vrrConfig = *displayConfig.vrrConfig; + EXPECT_GE(vrrConfig.minFrameIntervalNs, displayConfig.vsyncPeriod); + + EXPECT_EQ(1, std::count_if( + displayConfigurations.cbegin(), displayConfigurations.cend(), + [displayConfig](const auto& config) { + return config.configGroup == displayConfig.configGroup; + })) + << "There should be only one VRR mode in one ConfigGroup"; + + const auto verifyFrameIntervalIsDivisorOfVsync = [&](int32_t frameIntervalNs) { + constexpr auto kThreshold = 0.05f; // 5% + const auto ratio = + static_cast(frameIntervalNs) / displayConfig.vsyncPeriod; + return ratio - std::round(ratio) <= kThreshold; + }; + + EXPECT_TRUE(verifyFrameIntervalIsDivisorOfVsync(vrrConfig.minFrameIntervalNs)); + + if (vrrConfig.frameIntervalPowerHints) { + const auto& frameIntervalPowerHints = *vrrConfig.frameIntervalPowerHints; + EXPECT_FALSE(frameIntervalPowerHints.empty()); + + const auto minFrameInterval = *min_element(frameIntervalPowerHints.cbegin(), + frameIntervalPowerHints.cend()); + EXPECT_LE(minFrameInterval->frameIntervalNs, + VtsComposerClient::kMaxFrameIntervalNs); + + EXPECT_TRUE(std::all_of(frameIntervalPowerHints.cbegin(), + frameIntervalPowerHints.cend(), + [&](const auto& frameIntervalPowerHint) { + return verifyFrameIntervalIsDivisorOfVsync( + frameIntervalPowerHint->frameIntervalNs); + })); + } + + if (vrrConfig.notifyExpectedPresentConfig) { + const auto& notifyExpectedPresentConfig = + *vrrConfig.notifyExpectedPresentConfig; + EXPECT_GT(0, notifyExpectedPresentConfig.notifyExpectedPresentHeadsUpNs); + EXPECT_GE(0, notifyExpectedPresentConfig.notifyExpectedPresentTimeoutNs); + } + } + } + } +} + +TEST_P(GraphicsComposerAidlV3Test, GetDisplayConfigsIsSubsetOfGetDisplayConfigurations) { + for (const auto& display : mDisplays) { + const auto& [status, displayConfigurations] = + mComposerClient->getDisplayConfigurations(display.getDisplayId()); + EXPECT_TRUE(status.isOk()); + + const auto& [legacyConfigStatus, legacyConfigs] = + mComposerClient->getDisplayConfigs(display.getDisplayId()); + EXPECT_TRUE(legacyConfigStatus.isOk()); + EXPECT_FALSE(legacyConfigs.empty()); + EXPECT_TRUE(legacyConfigs.size() <= displayConfigurations.size()); + + for (const auto legacyConfigId : legacyConfigs) { + const auto& legacyWidth = mComposerClient->getDisplayAttribute( + display.getDisplayId(), legacyConfigId, DisplayAttribute::WIDTH); + const auto& legacyHeight = mComposerClient->getDisplayAttribute( + display.getDisplayId(), legacyConfigId, DisplayAttribute::HEIGHT); + const auto& legacyVsyncPeriod = mComposerClient->getDisplayAttribute( + display.getDisplayId(), legacyConfigId, DisplayAttribute::VSYNC_PERIOD); + const auto& legacyConfigGroup = mComposerClient->getDisplayAttribute( + display.getDisplayId(), legacyConfigId, DisplayAttribute::CONFIG_GROUP); + const auto& legacyDpiX = mComposerClient->getDisplayAttribute( + display.getDisplayId(), legacyConfigId, DisplayAttribute::DPI_X); + const auto& legacyDpiY = mComposerClient->getDisplayAttribute( + display.getDisplayId(), legacyConfigId, DisplayAttribute::DPI_Y); + + EXPECT_TRUE(legacyWidth.first.isOk() && legacyHeight.first.isOk() && + legacyVsyncPeriod.first.isOk() && legacyConfigGroup.first.isOk()); + + EXPECT_TRUE(std::any_of( + displayConfigurations.begin(), displayConfigurations.end(), + [&](const auto& displayConfiguration) { + const bool requiredAttributesPredicate = + displayConfiguration.configId == legacyConfigId && + displayConfiguration.width == legacyWidth.second && + displayConfiguration.height == legacyHeight.second && + displayConfiguration.vsyncPeriod == legacyVsyncPeriod.second && + displayConfiguration.configGroup == legacyConfigGroup.second; + + if (!requiredAttributesPredicate) { + // Required attributes did not match + return false; + } + + // Check optional attributes + const auto& [legacyDpiXStatus, legacyDpiXValue] = legacyDpiX; + const auto& [legacyDpiYStatus, legacyDpiYValue] = legacyDpiY; + if (displayConfiguration.dpi) { + if (!legacyDpiXStatus.isOk() || !legacyDpiYStatus.isOk()) { + // getDisplayAttribute failed for optional attributes + return false; + } + + // DPI values in DisplayConfigurations are not scaled (* 1000.f) + // the way they are in the legacy DisplayConfigs. + constexpr float kEpsilon = 0.001f; + return std::abs(displayConfiguration.dpi->x - + legacyDpiXValue / 1000.f) < kEpsilon && + std::abs(displayConfiguration.dpi->y - + legacyDpiYValue / 1000.f) < kEpsilon; + } else { + return !legacyDpiXStatus.isOk() && !legacyDpiYStatus.isOk() && + EX_SERVICE_SPECIFIC == legacyDpiXStatus.getExceptionCode() && + EX_SERVICE_SPECIFIC == legacyDpiYStatus.getExceptionCode() && + IComposerClient::EX_UNSUPPORTED == + legacyDpiXStatus.getServiceSpecificError() && + IComposerClient::EX_UNSUPPORTED == + legacyDpiYStatus.getServiceSpecificError(); + } + })); + } + } +} + +// TODO(b/291792736) Add detailed VTS test cases for NotifyExpectedPresent +TEST_P(GraphicsComposerAidlV3Test, NotifyExpectedPresent) { + for (const auto& display : mDisplays) { + EXPECT_TRUE(mComposerClient + ->notifyExpectedPresent(display.getDisplayId(), + ClockMonotonicTimestamp{0}, + std::chrono::nanoseconds{8ms}.count()) + .isOk()); + } +} + // Tests for Command. class GraphicsComposerAidlCommandTest : public GraphicsComposerAidlTest { protected: @@ -1183,21 +1382,17 @@ class GraphicsComposerAidlCommandTest : public GraphicsComposerAidlTest { void execute() { std::vector payloads; for (auto& [_, writer] : mWriters) { - auto commands = writer.takePendingCommands(); - if (commands.empty()) { - continue; - } - - auto [status, results] = mComposerClient->executeCommands(commands); - ASSERT_TRUE(status.isOk()) << "executeCommands failed " << status.getDescription(); - - payloads.reserve(payloads.size() + results.size()); - payloads.insert(payloads.end(), std::make_move_iterator(results.begin()), - std::make_move_iterator(results.end())); + executeInternal(writer, payloads); } mReader.parse(std::move(payloads)); } + void execute(ComposerClientWriter& writer, ComposerClientReader& reader) { + std::vector payloads; + executeInternal(writer, payloads); + reader.parse(std::move(payloads)); + } + static inline auto toTimePoint(nsecs_t time) { return std::chrono::time_point(std::chrono::nanoseconds(time)); } @@ -1284,7 +1479,8 @@ class GraphicsComposerAidlCommandTest : public GraphicsComposerAidlTest { /*acquireFence*/ -1); writer.setLayerDataspace(display.getDisplayId(), layer, common::Dataspace::UNKNOWN); - writer.validateDisplay(display.getDisplayId(), ComposerClientWriter::kNoTimestamp); + writer.validateDisplay(display.getDisplayId(), ComposerClientWriter::kNoTimestamp, + VtsComposerClient::kNoFrameIntervalNs); execute(); ASSERT_TRUE(mReader.takeErrors().empty()); @@ -1301,7 +1497,8 @@ class GraphicsComposerAidlCommandTest : public GraphicsComposerAidlTest { /*acquireFence*/ -1); writer.setLayerSurfaceDamage(display.getDisplayId(), layer, std::vector(1, {0, 0, 10, 10})); - writer.validateDisplay(display.getDisplayId(), ComposerClientWriter::kNoTimestamp); + writer.validateDisplay(display.getDisplayId(), ComposerClientWriter::kNoTimestamp, + VtsComposerClient::kNoFrameIntervalNs); execute(); ASSERT_TRUE(mReader.takeErrors().empty()); @@ -1315,7 +1512,8 @@ class GraphicsComposerAidlCommandTest : public GraphicsComposerAidlTest { sp<::android::Fence> presentAndGetFence( std::optional expectedPresentTime) { auto& writer = getWriter(getPrimaryDisplayId()); - writer.validateDisplay(getPrimaryDisplayId(), expectedPresentTime); + writer.validateDisplay(getPrimaryDisplayId(), expectedPresentTime, + VtsComposerClient::kNoFrameIntervalNs); execute(); EXPECT_TRUE(mReader.takeErrors().empty()); @@ -1522,6 +1720,7 @@ class GraphicsComposerAidlCommandTest : public GraphicsComposerAidlTest { // clang-format on ComposerClientWriter& getWriter(int64_t display) { + std::lock_guard guard{mWritersMutex}; auto [it, _] = mWriters.try_emplace(display, display); return it->second; } @@ -1529,7 +1728,27 @@ class GraphicsComposerAidlCommandTest : public GraphicsComposerAidlTest { ComposerClientReader mReader; private: - std::unordered_map mWriters; + void executeInternal(ComposerClientWriter& writer, + std::vector& payloads) { + auto commands = writer.takePendingCommands(); + if (commands.empty()) { + return; + } + + auto [status, results] = mComposerClient->executeCommands(commands); + ASSERT_TRUE(status.isOk()) << "executeCommands failed " << status.getDescription(); + + payloads.reserve(payloads.size() + results.size()); + payloads.insert(payloads.end(), std::make_move_iterator(results.begin()), + std::make_move_iterator(results.end())); + } + + // Guards access to the map itself. Callers must ensure not to attempt to + // - modify the same writer from multiple threads + // - insert a new writer into the map during concurrent access, which would invalidate + // references from other threads + std::mutex mWritersMutex; + std::unordered_map mWriters GUARDED_BY(mWritersMutex); }; TEST_P(GraphicsComposerAidlCommandTest, SetColorTransform) { @@ -1610,7 +1829,7 @@ TEST_P(GraphicsComposerAidlCommandTest, SetClientTarget) { auto& writer = getWriter(getPrimaryDisplayId()); writer.setClientTarget(getPrimaryDisplayId(), /*slot*/ 0, nullptr, /*acquireFence*/ -1, - Dataspace::UNKNOWN, std::vector()); + Dataspace::UNKNOWN, std::vector(), 1.0f); execute(); } @@ -1637,20 +1856,23 @@ TEST_P(GraphicsComposerAidlCommandTest, SetOutputBuffer) { TEST_P(GraphicsComposerAidlCommandTest, ValidDisplay) { auto& writer = getWriter(getPrimaryDisplayId()); - writer.validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp); + writer.validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp, + VtsComposerClient::kNoFrameIntervalNs); execute(); } TEST_P(GraphicsComposerAidlCommandTest, AcceptDisplayChanges) { auto& writer = getWriter(getPrimaryDisplayId()); - writer.validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp); + writer.validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp, + VtsComposerClient::kNoFrameIntervalNs); writer.acceptDisplayChanges(getPrimaryDisplayId()); execute(); } TEST_P(GraphicsComposerAidlCommandTest, PresentDisplay) { auto& writer = getWriter(getPrimaryDisplayId()); - writer.validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp); + writer.validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp, + VtsComposerClient::kNoFrameIntervalNs); writer.presentDisplay(getPrimaryDisplayId()); execute(); } @@ -1663,10 +1885,6 @@ TEST_P(GraphicsComposerAidlCommandTest, PresentDisplay) { * surface damage have been set */ TEST_P(GraphicsComposerAidlCommandTest, PresentDisplayNoLayerStateChanges) { - if (!hasCapability(Capability::SKIP_VALIDATE)) { - GTEST_SUCCEED() << "Device does not have skip validate capability, skipping"; - return; - } EXPECT_TRUE(mComposerClient->setPowerMode(getPrimaryDisplayId(), PowerMode::ON).isOk()); const auto& [renderIntentsStatus, renderIntents] = @@ -1693,7 +1911,8 @@ TEST_P(GraphicsComposerAidlCommandTest, PresentDisplayNoLayerStateChanges) { writer.setLayerBuffer(getPrimaryDisplayId(), layer, /*slot*/ 0, handle, /*acquireFence*/ -1); writer.setLayerDataspace(getPrimaryDisplayId(), layer, Dataspace::UNKNOWN); - writer.validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp); + writer.validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp, + VtsComposerClient::kNoFrameIntervalNs); execute(); if (!mReader.takeChangedCompositionTypes(getPrimaryDisplayId()).empty()) { GTEST_SUCCEED() << "Composition change requested, skipping test"; @@ -1735,7 +1954,8 @@ TEST_P(GraphicsComposerAidlCommandTest, SetLayerCursorPosition) { (float)getPrimaryDisplay().getDisplayHeight()}; configureLayer(getPrimaryDisplay(), layer, Composition::CURSOR, displayFrame, cropRect); writer.setLayerDataspace(getPrimaryDisplayId(), layer, Dataspace::UNKNOWN); - writer.validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp); + writer.validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp, + VtsComposerClient::kNoFrameIntervalNs); execute(); @@ -1750,7 +1970,8 @@ TEST_P(GraphicsComposerAidlCommandTest, SetLayerCursorPosition) { execute(); writer.setLayerCursorPosition(getPrimaryDisplayId(), layer, /*x*/ 0, /*y*/ 0); - writer.validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp); + writer.validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp, + VtsComposerClient::kNoFrameIntervalNs); writer.presentDisplay(getPrimaryDisplayId()); execute(); } @@ -1768,53 +1989,6 @@ TEST_P(GraphicsComposerAidlCommandTest, SetLayerBuffer) { execute(); } -TEST_P(GraphicsComposerAidlCommandTest, SetLayerBufferSlotsToClear) { - // Older HAL versions use a backwards compatible way of clearing buffer slots - const auto& [versionStatus, version] = mComposerClient->getInterfaceVersion(); - ASSERT_TRUE(versionStatus.isOk()); - if (version <= 1) { - GTEST_SUCCEED() << "HAL at version 1 or lower does not have " - "LayerCommand::bufferSlotsToClear."; - return; - } - - const auto& [layerStatus, layer] = - mComposerClient->createLayer(getPrimaryDisplayId(), kBufferSlotCount); - EXPECT_TRUE(layerStatus.isOk()); - auto& writer = getWriter(getPrimaryDisplayId()); - - // setup 3 buffers in the buffer cache, with the last buffer being active - // then emulate the Android platform code that clears all 3 buffer slots - - const auto buffer1 = allocate(::android::PIXEL_FORMAT_RGBA_8888); - ASSERT_NE(nullptr, buffer1); - const auto handle1 = buffer1->handle; - writer.setLayerBuffer(getPrimaryDisplayId(), layer, /*slot*/ 0, handle1, /*acquireFence*/ -1); - execute(); - ASSERT_TRUE(mReader.takeErrors().empty()); - - const auto buffer2 = allocate(::android::PIXEL_FORMAT_RGBA_8888); - ASSERT_NE(nullptr, buffer2); - const auto handle2 = buffer2->handle; - writer.setLayerBuffer(getPrimaryDisplayId(), layer, /*slot*/ 1, handle2, /*acquireFence*/ -1); - execute(); - ASSERT_TRUE(mReader.takeErrors().empty()); - - const auto buffer3 = allocate(::android::PIXEL_FORMAT_RGBA_8888); - ASSERT_NE(nullptr, buffer3); - const auto handle3 = buffer3->handle; - writer.setLayerBuffer(getPrimaryDisplayId(), layer, /*slot*/ 2, handle3, /*acquireFence*/ -1); - execute(); - ASSERT_TRUE(mReader.takeErrors().empty()); - - // Ensure we can clear all 3 buffer slots, even the active buffer - it is assumed the - // current active buffer's slot will be cleared, but still remain the active buffer and no - // errors will occur. - writer.setLayerBufferSlotsToClear(getPrimaryDisplayId(), layer, {0, 1, 2}); - execute(); - ASSERT_TRUE(mReader.takeErrors().empty()); -} - TEST_P(GraphicsComposerAidlCommandTest, SetLayerBufferMultipleTimes) { const auto& [layerStatus, layer] = mComposerClient->createLayer(getPrimaryDisplayId(), kBufferSlotCount); @@ -1996,7 +2170,8 @@ TEST_P(GraphicsComposerAidlCommandTest, DisplayDecoration) { auto& writer = getWriter(display.getDisplayId()); writer.setLayerBuffer(display.getDisplayId(), layer, /*slot*/ 0, decorBuffer->handle, /*acquireFence*/ -1); - writer.validateDisplay(display.getDisplayId(), ComposerClientWriter::kNoTimestamp); + writer.validateDisplay(display.getDisplayId(), ComposerClientWriter::kNoTimestamp, + VtsComposerClient::kNoFrameIntervalNs); execute(); if (support) { ASSERT_TRUE(mReader.takeErrors().empty()); @@ -2406,12 +2581,69 @@ TEST_P(GraphicsComposerAidlCommandTest, SetIdleTimerEnabled_Timeout_2) { EXPECT_TRUE(mComposerClient->setPowerMode(getPrimaryDisplayId(), PowerMode::OFF).isOk()); } -TEST_P(GraphicsComposerAidlCommandTest, SetRefreshRateChangedCallbackDebug_Unsupported) { - if (getInterfaceVersion() <= 1) { - GTEST_SUCCEED() << "Capability::REFRESH_RATE_CHANGED_CALLBACK_DEBUG is " - "not supported on older version of the service"; - return; +class GraphicsComposerAidlCommandV2Test : public GraphicsComposerAidlCommandTest { + protected: + void SetUp() override { + GraphicsComposerAidlTest::SetUp(); + if (getInterfaceVersion() <= 1) { + GTEST_SKIP() << "Device interface version is expected to be >= 2"; + } } +}; +/** + * Test Capability::SKIP_VALIDATE + * + * Capability::SKIP_VALIDATE has been deprecated and should not be enabled. + */ +TEST_P(GraphicsComposerAidlCommandV2Test, SkipValidateDeprecatedTest) { +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" + ASSERT_FALSE(hasCapability(Capability::SKIP_VALIDATE)) + << "Found Capability::SKIP_VALIDATE capability."; +#pragma clang diagnostic pop +} + +TEST_P(GraphicsComposerAidlCommandV2Test, SetLayerBufferSlotsToClear) { + // Older HAL versions use a backwards compatible way of clearing buffer slots + // HAL at version 1 or lower does not have LayerCommand::bufferSlotsToClear + const auto& [layerStatus, layer] = + mComposerClient->createLayer(getPrimaryDisplayId(), kBufferSlotCount); + EXPECT_TRUE(layerStatus.isOk()); + auto& writer = getWriter(getPrimaryDisplayId()); + + // setup 3 buffers in the buffer cache, with the last buffer being active + // then emulate the Android platform code that clears all 3 buffer slots + + const auto buffer1 = allocate(::android::PIXEL_FORMAT_RGBA_8888); + ASSERT_NE(nullptr, buffer1); + const auto handle1 = buffer1->handle; + writer.setLayerBuffer(getPrimaryDisplayId(), layer, /*slot*/ 0, handle1, /*acquireFence*/ -1); + execute(); + ASSERT_TRUE(mReader.takeErrors().empty()); + + const auto buffer2 = allocate(::android::PIXEL_FORMAT_RGBA_8888); + ASSERT_NE(nullptr, buffer2); + const auto handle2 = buffer2->handle; + writer.setLayerBuffer(getPrimaryDisplayId(), layer, /*slot*/ 1, handle2, /*acquireFence*/ -1); + execute(); + ASSERT_TRUE(mReader.takeErrors().empty()); + + const auto buffer3 = allocate(::android::PIXEL_FORMAT_RGBA_8888); + ASSERT_NE(nullptr, buffer3); + const auto handle3 = buffer3->handle; + writer.setLayerBuffer(getPrimaryDisplayId(), layer, /*slot*/ 2, handle3, /*acquireFence*/ -1); + execute(); + ASSERT_TRUE(mReader.takeErrors().empty()); + + // Ensure we can clear all 3 buffer slots, even the active buffer - it is assumed the + // current active buffer's slot will be cleared, but still remain the active buffer and no + // errors will occur. + writer.setLayerBufferSlotsToClear(getPrimaryDisplayId(), layer, {0, 1, 2}); + execute(); + ASSERT_TRUE(mReader.takeErrors().empty()); +} + +TEST_P(GraphicsComposerAidlCommandV2Test, SetRefreshRateChangedCallbackDebug_Unsupported) { if (!hasCapability(Capability::REFRESH_RATE_CHANGED_CALLBACK_DEBUG)) { auto status = mComposerClient->setRefreshRateChangedCallbackDebugEnabled( getPrimaryDisplayId(), /*enabled*/ true); @@ -2427,46 +2659,50 @@ TEST_P(GraphicsComposerAidlCommandTest, SetRefreshRateChangedCallbackDebug_Unsup } } -TEST_P(GraphicsComposerAidlCommandTest, SetRefreshRateChangedCallbackDebug_Enabled) { - if (getInterfaceVersion() <= 1) { - GTEST_SUCCEED() << "Capability::REFRESH_RATE_CHANGED_CALLBACK_DEBUG is " - "not supported on older version of the service"; - return; - } +TEST_P(GraphicsComposerAidlCommandV2Test, SetRefreshRateChangedCallbackDebug_Enabled) { if (!hasCapability(Capability::REFRESH_RATE_CHANGED_CALLBACK_DEBUG)) { GTEST_SUCCEED() << "Capability::REFRESH_RATE_CHANGED_CALLBACK_DEBUG is not supported"; return; } - const auto displayId = getPrimaryDisplayId(); - EXPECT_TRUE(mComposerClient->setPowerMode(displayId, PowerMode::ON).isOk()); - // Enable the callback - ASSERT_TRUE(mComposerClient - ->setRefreshRateChangedCallbackDebugEnabled(displayId, - /*enabled*/ true) - .isOk()); - std::this_thread::sleep_for(100ms); + for (VtsDisplay& display : mDisplays) { + const auto displayId = display.getDisplayId(); + EXPECT_TRUE(mComposerClient->setPowerMode(displayId, PowerMode::ON).isOk()); + // Enable the callback + ASSERT_TRUE(mComposerClient + ->setRefreshRateChangedCallbackDebugEnabled(displayId, + /*enabled*/ true) + .isOk()); + std::this_thread::sleep_for(100ms); - const auto displayFilter = [displayId](auto refreshRateChangedDebugData) { - return displayId == refreshRateChangedDebugData.display; - }; + const auto [status, configId] = mComposerClient->getActiveConfig(display.getDisplayId()); + EXPECT_TRUE(status.isOk()); - // Check that we immediately got a callback - EXPECT_TRUE(checkIfCallbackRefreshRateChangedDebugEnabledReceived(displayFilter)); + const auto displayFilter = [&](auto refreshRateChangedDebugData) { + bool nonVrrRateMatching = true; + if (std::optional vrrConfigOpt = + display.getDisplayConfig(configId).vrrConfig; + getInterfaceVersion() >= 3 && !vrrConfigOpt) { + nonVrrRateMatching = refreshRateChangedDebugData.refreshPeriodNanos == + refreshRateChangedDebugData.vsyncPeriodNanos; + } + const bool isDisplaySame = + display.getDisplayId() == refreshRateChangedDebugData.display; + return nonVrrRateMatching && isDisplaySame; + }; - ASSERT_TRUE(mComposerClient - ->setRefreshRateChangedCallbackDebugEnabled(displayId, - /*enabled*/ false) - .isOk()); + // Check that we immediately got a callback + EXPECT_TRUE(checkIfCallbackRefreshRateChangedDebugEnabledReceived(displayFilter)); + + ASSERT_TRUE(mComposerClient + ->setRefreshRateChangedCallbackDebugEnabled(displayId, + /*enabled*/ false) + .isOk()); + } } -TEST_P(GraphicsComposerAidlCommandTest, +TEST_P(GraphicsComposerAidlCommandV2Test, SetRefreshRateChangedCallbackDebugEnabled_noCallbackWhenIdle) { - if (getInterfaceVersion() <= 1) { - GTEST_SUCCEED() << "Capability::REFRESH_RATE_CHANGED_CALLBACK_DEBUG is " - "not supported on older version of the service"; - return; - } if (!hasCapability(Capability::REFRESH_RATE_CHANGED_CALLBACK_DEBUG)) { GTEST_SUCCEED() << "Capability::REFRESH_RATE_CHANGED_CALLBACK_DEBUG is not supported"; return; @@ -2522,13 +2758,8 @@ TEST_P(GraphicsComposerAidlCommandTest, .isOk()); } -TEST_P(GraphicsComposerAidlCommandTest, +TEST_P(GraphicsComposerAidlCommandV2Test, SetRefreshRateChangedCallbackDebugEnabled_SetActiveConfigWithConstraints) { - if (getInterfaceVersion() <= 1) { - GTEST_SUCCEED() << "Capability::REFRESH_RATE_CHANGED_CALLBACK_DEBUG is " - "not supported on older version of the service"; - return; - } if (!hasCapability(Capability::REFRESH_RATE_CHANGED_CALLBACK_DEBUG)) { GTEST_SUCCEED() << "Capability::REFRESH_RATE_CHANGED_CALLBACK_DEBUG is not supported"; return; @@ -2596,67 +2827,195 @@ TEST_P(GraphicsComposerAidlCommandTest, } } -/* - * Test that no two display configs are exactly the same. - */ -TEST_P(GraphicsComposerAidlTest, GetDisplayConfigNoRepetitions) { - for (const auto& display : mDisplays) { - const auto& [status, configs] = mComposerClient->getDisplayConfigs(display.getDisplayId()); - for (std::vector::size_type i = 0; i < configs.size(); i++) { - for (std::vector::size_type j = i + 1; j < configs.size(); j++) { - const auto& [widthStatus1, width1] = mComposerClient->getDisplayAttribute( - display.getDisplayId(), configs[i], DisplayAttribute::WIDTH); - const auto& [heightStatus1, height1] = mComposerClient->getDisplayAttribute( - display.getDisplayId(), configs[i], DisplayAttribute::HEIGHT); - const auto& [vsyncPeriodStatus1, vsyncPeriod1] = - mComposerClient->getDisplayAttribute(display.getDisplayId(), configs[i], - DisplayAttribute::VSYNC_PERIOD); - const auto& [groupStatus1, group1] = mComposerClient->getDisplayAttribute( - display.getDisplayId(), configs[i], DisplayAttribute::CONFIG_GROUP); +TEST_P(GraphicsComposerAidlCommandTest, MultiThreadedPresent) { + std::vector displays; + for (auto& display : mDisplays) { + if (hasDisplayCapability(display.getDisplayId(), + DisplayCapability::MULTI_THREADED_PRESENT)) { + displays.push_back(&display); + } + } - const auto& [widthStatus2, width2] = mComposerClient->getDisplayAttribute( - display.getDisplayId(), configs[j], DisplayAttribute::WIDTH); - const auto& [heightStatus2, height2] = mComposerClient->getDisplayAttribute( - display.getDisplayId(), configs[j], DisplayAttribute::HEIGHT); - const auto& [vsyncPeriodStatus2, vsyncPeriod2] = - mComposerClient->getDisplayAttribute(display.getDisplayId(), configs[j], - DisplayAttribute::VSYNC_PERIOD); - const auto& [groupStatus2, group2] = mComposerClient->getDisplayAttribute( - display.getDisplayId(), configs[j], DisplayAttribute::CONFIG_GROUP); + const size_t numDisplays = displays.size(); + if (numDisplays <= 1u) { + GTEST_SKIP(); + } - ASSERT_FALSE(width1 == width2 && height1 == height2 && - vsyncPeriod1 == vsyncPeriod2 && group1 == group2); - } + // When multi-threaded, use a reader per display. As with mWriters, this mutex + // guards access to the map. + std::mutex readersMutex; + std::unordered_map readers; + std::vector threads; + threads.reserve(numDisplays); + + // Each display will have a layer to present. This maps from the display to + // the layer, so we can properly destroy each layer at the end. + std::unordered_map layers; + + for (auto* const display : displays) { + const int64_t displayId = display->getDisplayId(); + + // Ensure that all writers and readers have been added to their respective + // maps initially, so that the following loop never modifies the maps. The + // maps are accessed from different threads, and if the maps were modified, + // this would invalidate their iterators, and therefore references to the + // writers and readers. + auto& writer = getWriter(displayId); + { + std::lock_guard guard{readersMutex}; + readers.try_emplace(displayId, displayId); } + + EXPECT_TRUE(mComposerClient->setPowerMode(displayId, PowerMode::ON).isOk()); + + const auto& [status, layer] = mComposerClient->createLayer(displayId, kBufferSlotCount); + const auto buffer = allocate(::android::PIXEL_FORMAT_RGBA_8888); + ASSERT_NE(nullptr, buffer); + ASSERT_EQ(::android::OK, buffer->initCheck()); + ASSERT_NE(nullptr, buffer->handle); + + configureLayer(*display, layer, Composition::DEVICE, display->getFrameRect(), + display->getCrop()); + writer.setLayerBuffer(displayId, layer, /*slot*/ 0, buffer->handle, + /*acquireFence*/ -1); + writer.setLayerDataspace(displayId, layer, common::Dataspace::UNKNOWN); + layers.try_emplace(displayId, layer); + } + + for (auto* const display : displays) { + const int64_t displayId = display->getDisplayId(); + auto& writer = getWriter(displayId); + std::unique_lock lock{readersMutex}; + auto& reader = readers.at(displayId); + lock.unlock(); + + writer.validateDisplay(displayId, ComposerClientWriter::kNoTimestamp, + VtsComposerClient::kNoFrameIntervalNs); + execute(writer, reader); + + threads.emplace_back([this, displayId, &readers, &readersMutex]() { + auto& writer = getWriter(displayId); + std::unique_lock lock{readersMutex}; + ComposerClientReader& reader = readers.at(displayId); + lock.unlock(); + + writer.presentDisplay(displayId); + execute(writer, reader); + ASSERT_TRUE(reader.takeErrors().empty()); + + auto presentFence = reader.takePresentFence(displayId); + // take ownership + const int fenceOwner = presentFence.get(); + *presentFence.getR() = -1; + EXPECT_NE(-1, fenceOwner); + const auto presentFence2 = sp<::android::Fence>::make(fenceOwner); + presentFence2->waitForever(LOG_TAG); + }); + } + + for (auto& thread : threads) { + thread.join(); + } + + for (auto& [displayId, layer] : layers) { + EXPECT_TRUE(mComposerClient->destroyLayer(displayId, layer).isOk()); + } + + std::lock_guard guard{readersMutex}; + for (auto& [displayId, reader] : readers) { + ASSERT_TRUE(reader.takeErrors().empty()); + ASSERT_TRUE(reader.takeChangedCompositionTypes(displayId).empty()); } } -/** - * Test Capability::SKIP_VALIDATE - * - * Capability::SKIP_VALIDATE has been deprecated and should not be enabled. - */ -TEST_P(GraphicsComposerAidlCommandTest, SkipValidateDeprecatedTest) { - if (getInterfaceVersion() <= 1) { - GTEST_SUCCEED() << "HAL at version 1 or lower can contain Capability::SKIP_VALIDATE."; - return; +class GraphicsComposerAidlBatchedCommandTest : public GraphicsComposerAidlCommandTest { + protected: + void SetUp() override { + GraphicsComposerAidlCommandTest::SetUp(); + if (getInterfaceVersion() <= 2) { + GTEST_SKIP() << "Device interface version is expected to be >= 3"; + } } - ASSERT_FALSE(hasCapability(Capability::SKIP_VALIDATE)) - << "Found Capability::SKIP_VALIDATE capability."; + void TearDown() override { + const auto errors = mReader.takeErrors(); + ASSERT_TRUE(mReader.takeErrors().empty()); + ASSERT_NO_FATAL_FAILURE(GraphicsComposerAidlTest::TearDown()); + } +}; + +TEST_P(GraphicsComposerAidlBatchedCommandTest, CreateBatchedCommand) { + auto& writer = getWriter(getPrimaryDisplayId()); + int64_t layer = 5; + writer.setLayerLifecycleBatchCommandType(getPrimaryDisplayId(), layer, + LayerLifecycleBatchCommandType::CREATE); + writer.setNewBufferSlotCount(getPrimaryDisplayId(), layer, 1); + writer.validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp, + VtsComposerClient::kNoFrameIntervalNs); + execute(); + ASSERT_TRUE(mReader.takeErrors().empty()); } +TEST_P(GraphicsComposerAidlBatchedCommandTest, DestroyBatchedCommand) { + auto& writer = getWriter(getPrimaryDisplayId()); + int64_t layer = 5; + writer.setLayerLifecycleBatchCommandType(getPrimaryDisplayId(), layer, + LayerLifecycleBatchCommandType::CREATE); + writer.setNewBufferSlotCount(getPrimaryDisplayId(), layer, 1); + writer.validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp, + VtsComposerClient::kNoFrameIntervalNs); + execute(); + ASSERT_TRUE(mReader.takeErrors().empty()); + writer.setLayerLifecycleBatchCommandType(getPrimaryDisplayId(), layer, + LayerLifecycleBatchCommandType::DESTROY); + layer++; + writer.setLayerLifecycleBatchCommandType(getPrimaryDisplayId(), layer, + LayerLifecycleBatchCommandType::CREATE); + writer.setNewBufferSlotCount(getPrimaryDisplayId(), layer, 1); + + execute(); + ASSERT_TRUE(mReader.takeErrors().empty()); +} + +TEST_P(GraphicsComposerAidlBatchedCommandTest, NoCreateDestroyBatchedCommandIncorrectLayer) { + auto& writer = getWriter(getPrimaryDisplayId()); + int64_t layer = 5; + writer.setLayerLifecycleBatchCommandType(getPrimaryDisplayId(), layer, + LayerLifecycleBatchCommandType::DESTROY); + execute(); + const auto errors = mReader.takeErrors(); + ASSERT_TRUE(errors.size() == 1 && errors[0].errorCode == IComposerClient::EX_BAD_LAYER); +} + +GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(GraphicsComposerAidlBatchedCommandTest); +INSTANTIATE_TEST_SUITE_P( + PerInstance, GraphicsComposerAidlBatchedCommandTest, + testing::ValuesIn(::android::getAidlHalInstanceNames(IComposer::descriptor)), + ::android::PrintInstanceNameToString); GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(GraphicsComposerAidlCommandTest); INSTANTIATE_TEST_SUITE_P( PerInstance, GraphicsComposerAidlCommandTest, testing::ValuesIn(::android::getAidlHalInstanceNames(IComposer::descriptor)), ::android::PrintInstanceNameToString); - GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(GraphicsComposerAidlTest); INSTANTIATE_TEST_SUITE_P( PerInstance, GraphicsComposerAidlTest, testing::ValuesIn(::android::getAidlHalInstanceNames(IComposer::descriptor)), ::android::PrintInstanceNameToString); -} // namespace +GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(GraphicsComposerAidlV2Test); +INSTANTIATE_TEST_SUITE_P( + PerInstance, GraphicsComposerAidlV2Test, + testing::ValuesIn(::android::getAidlHalInstanceNames(IComposer::descriptor)), + ::android::PrintInstanceNameToString); +GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(GraphicsComposerAidlV3Test); +INSTANTIATE_TEST_SUITE_P( + PerInstance, GraphicsComposerAidlV3Test, + testing::ValuesIn(::android::getAidlHalInstanceNames(IComposer::descriptor)), + ::android::PrintInstanceNameToString); +GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(GraphicsComposerAidlCommandV2Test); +INSTANTIATE_TEST_SUITE_P( + PerInstance, GraphicsComposerAidlCommandV2Test, + testing::ValuesIn(::android::getAidlHalInstanceNames(IComposer::descriptor)), + ::android::PrintInstanceNameToString); } // namespace aidl::android::hardware::graphics::composer3::vts int main(int argc, char** argv) { diff --git a/graphics/mapper/4.0/utils/vts/Android.bp b/graphics/mapper/4.0/utils/vts/Android.bp index 51e871b2d6031f259a3a1951f282c9afb66f82d2..7815d41b5bba846502bd5cb8e7eb5c83fa8f24fd 100644 --- a/graphics/mapper/4.0/utils/vts/Android.bp +++ b/graphics/mapper/4.0/utils/vts/Android.bp @@ -47,7 +47,7 @@ cc_library_static { ], export_static_lib_headers: [ "android.hardware.graphics.allocator@4.0", - "android.hardware.graphics.common-V4-ndk", + "android.hardware.graphics.common-V5-ndk", "android.hardware.graphics.mapper@4.0", ], export_include_dirs: ["include"], diff --git a/graphics/mapper/4.0/vts/functional/VtsHalGraphicsMapperV4_0TargetTest.cpp b/graphics/mapper/4.0/vts/functional/VtsHalGraphicsMapperV4_0TargetTest.cpp index 03d9041fd2a2aa5329451155b3c12ac1cbac213a..bae362f04e68995cdaa9d0b2cdb9ed6db4df980c 100644 --- a/graphics/mapper/4.0/vts/functional/VtsHalGraphicsMapperV4_0TargetTest.cpp +++ b/graphics/mapper/4.0/vts/functional/VtsHalGraphicsMapperV4_0TargetTest.cpp @@ -2223,11 +2223,14 @@ TEST_P(GraphicsMapperHidlTest, SetBadMetadata) { // Keep optional metadata types below and populate the encoded metadata vec // with some arbitrary different metadata because the common gralloc4::decode*() // functions do not distinguish between an empty vec and bad value. - ASSERT_EQ(NO_ERROR, gralloc4::encodeDataspace(Dataspace::SRGB_LINEAR, &vec)); - ASSERT_EQ(Error::UNSUPPORTED, - mGralloc->set(bufferHandle, gralloc4::MetadataType_Smpte2086, vec)); - ASSERT_EQ(Error::UNSUPPORTED, - mGralloc->set(bufferHandle, gralloc4::MetadataType_Cta861_3, vec)); + if (base::GetIntProperty("ro.vendor.api_level", __ANDROID_API_FUTURE__) >= __ANDROID_API_T__) { + // Some old grallocs shipped with broken validation. + ASSERT_EQ(NO_ERROR, gralloc4::encodeDataspace(Dataspace::SRGB_LINEAR, &vec)); + ASSERT_EQ(Error::UNSUPPORTED, + mGralloc->set(bufferHandle, gralloc4::MetadataType_Smpte2086, vec)); + ASSERT_EQ(Error::UNSUPPORTED, + mGralloc->set(bufferHandle, gralloc4::MetadataType_Cta861_3, vec)); + } } /** diff --git a/health/aidl/default/Health.cpp b/health/aidl/default/Health.cpp index a16087c06d5a787e30ce35bc6fdab3f76afebb5b..8174bc8ea49fb22d1e0cc2b32f374694b6ef4d47 100644 --- a/health/aidl/default/Health.cpp +++ b/health/aidl/default/Health.cpp @@ -232,6 +232,7 @@ binder_status_t Health::dump(int fd, const char**, uint32_t) { } else { ::android::base::WriteStringToFd(res.getDescription(), fd); } + ::android::base::WriteStringToFd("\n", fd); fsync(fd); return STATUS_OK; diff --git a/input/common/aidl/Android.bp b/input/common/aidl/Android.bp index 95a14b286b1a6f1ccac42d9686171de3651f3cdc..f23f270e0b73567dc90a4b643895969b160a5444 100644 --- a/input/common/aidl/Android.bp +++ b/input/common/aidl/Android.bp @@ -20,6 +20,9 @@ aidl_interface { java: { enabled: false, }, + rust: { + enabled: true, + }, }, versions_with_info: [ { diff --git a/macsec/OWNERS b/macsec/OWNERS new file mode 100644 index 0000000000000000000000000000000000000000..6934f86203450c4c3b7ec0fe3e0c9055fafae515 --- /dev/null +++ b/macsec/OWNERS @@ -0,0 +1 @@ +keithmok@google.com diff --git a/macsec/aidl/Android.bp b/macsec/aidl/Android.bp new file mode 100644 index 0000000000000000000000000000000000000000..5e47999bceefc777896fe1c202838078b105a63d --- /dev/null +++ b/macsec/aidl/Android.bp @@ -0,0 +1,40 @@ +// +// Copyright (C) 2023 The Android Open Source Project +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + +aidl_interface { + name: "android.hardware.macsec", + vendor_available: true, + srcs: ["android/hardware/macsec/*.aidl"], + stability: "vintf", + host_supported: true, + backend: { + java: { + enabled: false, + }, + rust: { + enabled: false, + }, + }, +} diff --git a/macsec/aidl/aidl_api/android.hardware.macsec/current/android/hardware/macsec/IMacsecPskPlugin.aidl b/macsec/aidl/aidl_api/android.hardware.macsec/current/android/hardware/macsec/IMacsecPskPlugin.aidl new file mode 100644 index 0000000000000000000000000000000000000000..6a93919e6ec45adc7b7f7b3da64d6165614fa7bd --- /dev/null +++ b/macsec/aidl/aidl_api/android.hardware.macsec/current/android/hardware/macsec/IMacsecPskPlugin.aidl @@ -0,0 +1,80 @@ +/* + * Copyright (C) 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package android.hardware.macsec; + +/** + * MACSEC (IEEE 802.1AE) pre-shared key plugin for wpa_supplicant + * + * The goal of this service is to provide function for using the MACSEC CAK + * + */ +@VintfStability +interface IMacsecPskPlugin { + /** + * For xTS test only inject a key to verify implementation correctness, not called in production + * + * @param keyId is key id to add + * @param Connectivity Association Keys (CAK) to set + * @param Connectivity Association Key Name (CKN) to set + * + */ + void addTestKey(in byte[] keyId, in byte[] CAK, in byte[] CKN); + + /** + * Use ICV key do AES CMAC + * same as ieee802_1x_icv_aes_cmac in wpa_supplicant + * + * @param keyId is key id to be used for AES CMAC + * @param data, a data pointer to the buffer for calculate the ICV + * + * @return Integrity check value (ICV). + */ + byte[] calcIcv(in byte[] keyId, in byte[] data); + + /** + * KDF with CAK key to generate Secure Association Key (SAK) + * same as ieee802_1x_sak_aes_cmac in wpa_supplicant + * + * @param keyId is key id to be used for KDF + * @param data is key seed (random number) + * @param sakLength generated SAK length (16 or 32) + * + * @return Secure Association Key (SAK). + */ + byte[] generateSak(in byte[] keyId, in byte[] data, in int sakLength); + + /** + * Encrypt using KEK key, this is same as aes_wrap with kek.key in wpa_supplicant + * which used to wrap a SAK key + * + * @param keyId is key id to be used for encryption + * @param sak is the SAK key (16 or 32 bytes) to be wrapped. + * + * @return wrapped data using Key Encrypting Key (KEK). + */ + byte[] wrapSak(in byte[] keyId, in byte[] sak); + + /** + * Decrypt using KEK key, this is same as aes_unwrap with kek.key in wpa_supplicant + * which used to unwrap a SAK key + * + * @param keyId is key id to be used for decryption + * @param sak is wrapped SAK key. + * + * @return unwrapped data using KEK key. + */ + byte[] unwrapSak(in byte[] keyId, in byte[] sak); +} diff --git a/macsec/aidl/android/hardware/macsec/IMacsecPskPlugin.aidl b/macsec/aidl/android/hardware/macsec/IMacsecPskPlugin.aidl new file mode 100644 index 0000000000000000000000000000000000000000..a98cfa6bd659fccb76cd5aa05710e045c5a85d48 --- /dev/null +++ b/macsec/aidl/android/hardware/macsec/IMacsecPskPlugin.aidl @@ -0,0 +1,91 @@ +/* + * Copyright (C) 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package android.hardware.macsec; + +/** + * MACSEC (IEEE 802.1AE) pre-shared key plugin for wpa_supplicant + * + * The goal of this service is to provide function for using the MACSEC CAK + * + */ +@VintfStability +interface IMacsecPskPlugin { + /** + * For xTS test only inject a key to verify implementation correctness, not called in production + * + * @param keyId is key id to add + * @param Connectivity Association Keys (CAK) to set + * @param Connectivity Association Key Name (CKN) to set + * @throws EX_ILLEGAL_ARGUMENT If CAK size is not 16 or 32 or keyID size not equals to CAK size + */ + void addTestKey(in byte[] keyId, in byte[] CAK, in byte[] CKN); + + /** + * Use ICV key do AES CMAC + * same as ieee802_1x_icv_aes_cmac in wpa_supplicant + * + * @param keyId is key id to be used for AES CMAC + * @param data, a data pointer to the buffer for calculate the ICV + * + * @return Integrity check value (ICV). + * @throws EX_ILLEGAL_ARGUMENT If keyId does not exist + */ + byte[] calcIcv(in byte[] keyId, in byte[] data); + + /** + * KDF with CAK key to generate Secure Association Key (SAK) + * same as ieee802_1x_sak_aes_cmac in wpa_supplicant + * + * @param keyId is key id to be used for KDF + * @param data is key seed (random number) + * @param sakLength generated SAK length (16 or 32) + * + * @return Secure Association Key (SAK). + * @throws EX_ILLEGAL_ARGUMENT In the following cases: + * - If keyId does not exist + * - sakLength != 16 or 32 + * - data length < sakLength + */ + byte[] generateSak(in byte[] keyId, in byte[] data, in int sakLength); + + /** + * Encrypt using KEK key, this is same as aes_wrap with kek.key in wpa_supplicant + * which used to wrap a SAK key + * + * @param keyId is key id to be used for encryption + * @param sak is the SAK key (16 or 32 bytes) to be wrapped. + * + * @return wrapped data using Key Encrypting Key (KEK). + * @throws EX_ILLEGAL_ARGUMENT In the following cases: + * - If keyId does not exist + * - sak size eqauls to 0 or not multiples of 8 + */ + byte[] wrapSak(in byte[] keyId, in byte[] sak); + + /** + * Decrypt using KEK key, this is same as aes_unwrap with kek.key in wpa_supplicant + * which used to unwrap a SAK key + * + * @param keyId is key id to be used for decryption + * @param sak is wrapped SAK key. + * + * @return unwrapped data using KEK key. + * @throws EX_ILLEGAL_ARGUMENT In the following cases: + * - If keyId does not exist + * - sak size <= 8 or not multiples of 8 + */ + byte[] unwrapSak(in byte[] keyId, in byte[] sak); +} diff --git a/macsec/aidl/default/Android.bp b/macsec/aidl/default/Android.bp new file mode 100644 index 0000000000000000000000000000000000000000..7c7346fb816f1183de20189e078a21ef345d586c --- /dev/null +++ b/macsec/aidl/default/Android.bp @@ -0,0 +1,64 @@ +// +// Copyright (C) 2023 The Android Open Source Project +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + +cc_binary { + name: "android.hardware.macsec-service", + init_rc: ["android.hardware.macsec.rc"], + vendor: true, + relative_install_path: "hw", + srcs: [ + "MacsecPskPlugin.cpp", + "service.cpp", + ], + shared_libs: [ + "android.hardware.macsec-V1-ndk", + "libcrypto", + "libbase", + "libbinder_ndk", + ], + vintf_fragments: ["android.hardware.macsec.xml"], +} + +cc_fuzz { + name: "android.hardware.macsec@V1-default-service.aidl_fuzzer", + vendor: true, + srcs: [ + "MacsecPskPlugin.cpp", + "fuzzer/fuzzer.cpp", + ], + shared_libs: [ + "android.hardware.macsec-V1-ndk", + "libcrypto", + "liblog", + ], + defaults: [ + "service_fuzzer_defaults", + ], + fuzz_config: { + cc: [ + "keithmok@google.com", + ], + }, +} diff --git a/macsec/aidl/default/MacsecPskPlugin.cpp b/macsec/aidl/default/MacsecPskPlugin.cpp new file mode 100644 index 0000000000000000000000000000000000000000..82d254580054012e8f3eba4a036db2ca34c68ffe --- /dev/null +++ b/macsec/aidl/default/MacsecPskPlugin.cpp @@ -0,0 +1,308 @@ +/* + * Copyright 2023, The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "MacsecPskPlugin.h" +#include +#include + +#include +#include + +namespace aidl::android::hardware::macsec { + +constexpr auto ok = &ndk::ScopedAStatus::ok; + +// vendor should hide the key in TEE/TA +// CAK key can be either 16 / 32 bytes +const std::vector CAK_ID_1 = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01}; +const std::vector CAK_KEY_1 = {0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF, + 0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF}; +std::vector CKN_1 = {0x31, 0x32, 0x33, 0x34}; // maximum 16 bytes + +const std::vector CAK_ID_2 = {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, 0x02}; +const std::vector CAK_KEY_2 = {0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF, + 0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF, + 0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF, + 0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF}; +std::vector CKN_2 = {0x35, 0x36, 0x37, 0x38}; // maximum 16 bytes + +static ndk::ScopedAStatus resultToStatus(binder_exception_t res, const std::string& msg = "") { + if (msg.empty()) { + return ndk::ScopedAStatus::fromExceptionCode(res); + } + return ndk::ScopedAStatus::fromExceptionCodeWithMessage(res, msg.c_str()); +} + +static int omac1_aes(CMAC_CTX* ctx, const uint8_t* data, size_t data_len, + uint8_t* mac /* 16 bytes */) { + size_t outlen; + + // Just reuse same key in ctx + if (!CMAC_Reset(ctx)) { + return -1; + } + + if (!CMAC_Update(ctx, data, data_len)) { + return -1; + } + + if (!CMAC_Final(ctx, mac, &outlen) || outlen != 16) { + return -1; + } + return 0; +} + +static void put_be16(uint8_t* addr, uint16_t value) { + *addr++ = value >> 8; + *addr = value & 0xff; +} + +/* IEEE Std 802.1X-2010, 6.2.1 KDF */ +static int aes_kdf(CMAC_CTX* ctx, const char* label, const uint8_t* context, int ctx_bits, + int ret_bits, uint8_t* ret) { + const int h = 128; + const int r = 8; + int i, n; + int lab_len, ctx_len, ret_len, buf_len; + uint8_t* buf; + + lab_len = strlen(label); + ctx_len = (ctx_bits + 7) / 8; + ret_len = ((ret_bits & 0xffff) + 7) / 8; + buf_len = lab_len + ctx_len + 4; + + memset(ret, 0, ret_len); + + n = (ret_bits + h - 1) / h; + if (n > ((0x1 << r) - 1)) return -1; + + buf = (uint8_t*)calloc(1, buf_len); + if (buf == NULL) return -1; + + memcpy(buf + 1, label, lab_len); + memcpy(buf + lab_len + 2, context, ctx_len); + put_be16(&buf[buf_len - 2], ret_bits); + + for (i = 0; i < n; i++) { + int res; + + buf[0] = (uint8_t)(i + 1); + res = omac1_aes(ctx, buf, buf_len, ret); + if (res) { + free(buf); + return -1; + } + ret = ret + h / 8; + } + free(buf); + return 0; +} + +MacsecPskPlugin::MacsecPskPlugin() { + // always make sure ckn is 16 bytes, zero padded + CKN_1.resize(16); + CKN_2.resize(16); + + addTestKey(CAK_ID_1, CAK_KEY_1, CKN_1); + addTestKey(CAK_ID_2, CAK_KEY_2, CKN_2); +} + +MacsecPskPlugin::~MacsecPskPlugin() { + for (auto s : mKeys) { + OPENSSL_cleanse(&s.kekEncCtx, sizeof(AES_KEY)); + OPENSSL_cleanse(&s.kekDecCtx, sizeof(AES_KEY)); + CMAC_CTX_free(s.ickCtx); + CMAC_CTX_free(s.cakCtx); + } +} + +ndk::ScopedAStatus MacsecPskPlugin::addTestKey(const std::vector& keyId, + const std::vector& CAK, + const std::vector& CKN) { + if (CAK.size() != 16 && CAK.size() != 32) { + return resultToStatus(EX_ILLEGAL_ARGUMENT, "CAK length must be 16 or 32 bytes"); + } + + if (keyId.size() != CAK.size()) { + return resultToStatus(EX_ILLEGAL_ARGUMENT, "Key ID must be same as CAK length"); + } + + std::vector ckn; + ckn = CKN; + ckn.resize(16); // make sure it is always zero padded with maximum length of + // 16 bytes + + AES_KEY kekEncCtx; + AES_KEY kekDecCtx; + CMAC_CTX* ickCtx; + CMAC_CTX* cakCtx; + + // Create the CAK openssl context + cakCtx = CMAC_CTX_new(); + + CMAC_Init(cakCtx, CAK.data(), CAK.size(), + CAK.size() == 16 ? EVP_aes_128_cbc() : EVP_aes_256_cbc(), NULL); + + // derive KEK from CAK (ieee802_1x_kek_aes_cmac) + std::vector kek; + kek.resize(CAK.size()); + + aes_kdf(cakCtx, "IEEE8021 KEK", (const uint8_t*)ckn.data(), ckn.size() * 8, 8 * kek.size(), + kek.data()); + + AES_set_encrypt_key(kek.data(), kek.size() << 3, &kekEncCtx); + AES_set_decrypt_key(kek.data(), kek.size() << 3, &kekDecCtx); + + // derive ICK from CAK (ieee802_1x_ick_aes_cmac) + std::vector ick; + ick.resize(CAK.size()); + + aes_kdf(cakCtx, "IEEE8021 ICK", (const uint8_t*)CKN.data(), CKN.size() * 8, 8 * ick.size(), + ick.data()); + + ickCtx = CMAC_CTX_new(); + + CMAC_Init(ickCtx, ick.data(), ick.size(), + ick.size() == 16 ? EVP_aes_128_cbc() : EVP_aes_256_cbc(), NULL); + + mKeys.push_back({keyId, kekEncCtx, kekDecCtx, ickCtx, cakCtx}); + + return ok(); +} + +ndk::ScopedAStatus MacsecPskPlugin::calcIcv(const std::vector& keyId, + const std::vector& data, + std::vector* out) { + CMAC_CTX* ctx = NULL; + + for (auto s : mKeys) { + if (s.keyId == keyId) { + ctx = s.ickCtx; + break; + } + } + + if (ctx == NULL) { + return resultToStatus(EX_ILLEGAL_ARGUMENT, "Key not exist"); + } + + out->resize(16); + if (omac1_aes(ctx, data.data(), data.size(), out->data()) != 0) { + return resultToStatus(EX_SERVICE_SPECIFIC, "Internal error"); + } + + return ok(); +} + +ndk::ScopedAStatus MacsecPskPlugin::generateSak(const std::vector& keyId, + const std::vector& data, + const int sakLength, std::vector* out) { + CMAC_CTX* ctx = NULL; + + if ((sakLength != 16) && (sakLength != 32)) { + return resultToStatus(EX_ILLEGAL_ARGUMENT, "Invalid SAK length"); + } + + if (data.size() < sakLength) { + return resultToStatus(EX_ILLEGAL_ARGUMENT, "Invalid data length"); + } + + for (auto s : mKeys) { + if (s.keyId == keyId) { + ctx = s.cakCtx; + break; + } + } + + if (ctx == NULL) { + return resultToStatus(EX_ILLEGAL_ARGUMENT, "Key not exist"); + } + + out->resize(sakLength); + + if (aes_kdf(ctx, "IEEE8021 SAK", data.data(), data.size() * 8, out->size() * 8, out->data()) != + 0) { + return resultToStatus(EX_SERVICE_SPECIFIC, "Internal error"); + } + + return ok(); +} + +ndk::ScopedAStatus MacsecPskPlugin::wrapSak(const std::vector& keyId, + const std::vector& sak, + std::vector* out) { + if (sak.size() == 0 || sak.size() % 8 != 0) { + return resultToStatus(EX_ILLEGAL_ARGUMENT, + "SAK length not multiple of 8 or greater than 0"); + } + + AES_KEY* ctx = NULL; + + for (auto s : mKeys) { + if (s.keyId == keyId) { + ctx = &s.kekEncCtx; + break; + } + } + + if (ctx == NULL) { + return resultToStatus(EX_ILLEGAL_ARGUMENT, "Key not exist"); + } + + out->resize(sak.size() + 8); + + if (AES_wrap_key(ctx, NULL, out->data(), sak.data(), sak.size()) > 0) { + return ok(); + } + + return resultToStatus(EX_SERVICE_SPECIFIC, "Internal error"); +} + +ndk::ScopedAStatus MacsecPskPlugin::unwrapSak(const std::vector& keyId, + const std::vector& sak, + std::vector* out) { + if (sak.size() <= 8 || sak.size() % 8 != 0) { + return resultToStatus(EX_ILLEGAL_ARGUMENT, + "SAK length not multiple of 8 or greater than 0"); + } + + AES_KEY* ctx = NULL; + + for (auto s : mKeys) { + if (s.keyId == keyId) { + ctx = &s.kekDecCtx; + break; + } + } + + if (ctx == NULL) { + return resultToStatus(EX_ILLEGAL_ARGUMENT, "Key not exist"); + } + + out->resize(sak.size() - 8); + + if (AES_unwrap_key(ctx, NULL, out->data(), sak.data(), sak.size()) > 0) { + return ok(); + } + + return resultToStatus(EX_SERVICE_SPECIFIC, "Internal error"); +} + +} // namespace aidl::android::hardware::macsec diff --git a/macsec/aidl/default/MacsecPskPlugin.h b/macsec/aidl/default/MacsecPskPlugin.h new file mode 100644 index 0000000000000000000000000000000000000000..0b056e3edee818c1a4f79bd70a1a7eef874bde7f --- /dev/null +++ b/macsec/aidl/default/MacsecPskPlugin.h @@ -0,0 +1,57 @@ +/* + * Copyright 2023, The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include + +#include +#include + +namespace aidl::android::hardware::macsec { + +struct keys { + std::vector keyId; + AES_KEY kekEncCtx; + AES_KEY kekDecCtx; + CMAC_CTX* ickCtx; + CMAC_CTX* cakCtx; +}; + +class MacsecPskPlugin : public BnMacsecPskPlugin { + public: + MacsecPskPlugin(); + ~MacsecPskPlugin(); + ndk::ScopedAStatus addTestKey(const std::vector& keyId, + const std::vector& CAK, + const std::vector& CKN) override; + ndk::ScopedAStatus calcIcv(const std::vector& keyId, const std::vector& data, + std::vector* out) override; + + ndk::ScopedAStatus generateSak(const std::vector& keyId, + const std::vector& data, const int sakLength, + std::vector* out); + + ndk::ScopedAStatus wrapSak(const std::vector& keyId, const std::vector& sak, + std::vector* out) override; + + ndk::ScopedAStatus unwrapSak(const std::vector& keyId, const std::vector& sak, + std::vector* out) override; + + private: + std::vector mKeys; +}; +} // namespace aidl::android::hardware::macsec diff --git a/macsec/aidl/default/android.hardware.macsec.rc b/macsec/aidl/default/android.hardware.macsec.rc new file mode 100644 index 0000000000000000000000000000000000000000..0ff0e53619992375431bfcb5160a64e4ca2de066 --- /dev/null +++ b/macsec/aidl/default/android.hardware.macsec.rc @@ -0,0 +1,3 @@ +service android.hardware.macsec /vendor/bin/hw/android.hardware.macsec-service + class early_hal + user nobody diff --git a/macsec/aidl/default/android.hardware.macsec.xml b/macsec/aidl/default/android.hardware.macsec.xml new file mode 100644 index 0000000000000000000000000000000000000000..9cf9e5aa7d6ca4821704f4784c4549298f2ec160 --- /dev/null +++ b/macsec/aidl/default/android.hardware.macsec.xml @@ -0,0 +1,26 @@ + + + + + + android.hardware.macsec + 1 + + IMacsecPskPlugin + default + + + diff --git a/macsec/aidl/default/fuzzer/fuzzer.cpp b/macsec/aidl/default/fuzzer/fuzzer.cpp new file mode 100644 index 0000000000000000000000000000000000000000..d912a67f2e3e7a2357eb80ca4ce66029bf0a5224 --- /dev/null +++ b/macsec/aidl/default/fuzzer/fuzzer.cpp @@ -0,0 +1,27 @@ +/* + * Copyright (C) 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include +#include "MacsecPskPlugin.h" + +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { + std::shared_ptr service = + ndk::SharedRefBase::make(); + android::fuzzService(service->asBinder().get(), FuzzedDataProvider(data, size)); + + return 0; +} diff --git a/macsec/aidl/default/service.cpp b/macsec/aidl/default/service.cpp new file mode 100644 index 0000000000000000000000000000000000000000..faf3a09ed1265bb5a496c7c306d3f92c3f917c45 --- /dev/null +++ b/macsec/aidl/default/service.cpp @@ -0,0 +1,43 @@ +/* + * Copyright 2023, The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "MacsecPskPlugin.h" + +#include +#include +#include + +namespace android::hardware::macsec { + +using namespace std::string_literals; +using ::aidl::android::hardware::macsec::MacsecPskPlugin; + +extern "C" int main() { + base::SetDefaultTag("MacsecPskPlugin"); + base::SetMinimumLogSeverity(base::VERBOSE); + + LOG(VERBOSE) << "Starting up..."; + auto service = ndk::SharedRefBase::make(); + const auto instance = MacsecPskPlugin::descriptor + "/default"s; + const auto status = AServiceManager_addService(service->asBinder().get(), instance.c_str()); + CHECK_EQ(status, STATUS_OK) << "Failed to add service " << instance; + LOG(VERBOSE) << "Started successfully!"; + + ABinderProcess_joinThreadPool(); + LOG(FATAL) << "MacsecPskPlugin exited unexpectedly!"; + return EXIT_FAILURE; +} +} // namespace android::hardware::macsec diff --git a/macsec/aidl/vts/functional/Android.bp b/macsec/aidl/vts/functional/Android.bp new file mode 100644 index 0000000000000000000000000000000000000000..0c8f43dcbab28b0dd364eb2c9838fdf23b98e67b --- /dev/null +++ b/macsec/aidl/vts/functional/Android.bp @@ -0,0 +1,48 @@ +// +// Copyright (C) 2023 The Android Open Source Project +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + +cc_test { + name: "VtsHalMacsecPskPluginV1Test", + defaults: [ + "VtsHalTargetTestDefaults", + "use_libaidlvintf_gtest_helper_static", + ], + cpp_std: "experimental", + srcs: [ + "MacsecAidlTest.cpp", + ], + shared_libs: [ + "libbase", + "libbinder_ndk", + ], + static_libs: [ + "android.hardware.macsec-V1-ndk", + "libgmock", + ], + test_suites: [ + "general-tests", + "vts", + ], +} diff --git a/macsec/aidl/vts/functional/MacsecAidlTest.cpp b/macsec/aidl/vts/functional/MacsecAidlTest.cpp new file mode 100644 index 0000000000000000000000000000000000000000..e94c0498d4d11f6361215bbe00bfd11aa49dcba6 --- /dev/null +++ b/macsec/aidl/vts/functional/MacsecAidlTest.cpp @@ -0,0 +1,142 @@ +/* + * Copyright (C) 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include +#include +#include +#include +#include + +#include +#include + +using aidl::android::hardware::macsec::IMacsecPskPlugin; +using namespace std::chrono_literals; +using namespace std::string_literals; + +const std::vector CAK_ID_1 = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01}; +const std::vector CAK_KEY_1 = {0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF, + 0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF}; +const std::vector CKN_1 = {0x31, 0x32, 0x33, 0x34}; // maximum 16 bytes +const std::vector SAK_DATA_1 = {0x31, 0x32, 0x33, 0x34, 0x11, 0x12, 0x12, 0x14, + 0x31, 0x32, 0x33, 0x34, 0x11, 0x12, 0x12, 0x14}; +const std::vector SAK_1 = {0x13, 0xD9, 0xEE, 0x5B, 0x26, 0x8B, 0x44, 0xFB, + 0x37, 0x63, 0x3D, 0x41, 0xC8, 0xE7, 0x0D, 0x93}; +const std::vector WRAPPED_SAK_1 = {0x3B, 0x39, 0xAB, 0x4C, 0xD8, 0xDA, 0x2E, 0xC5, + 0xD1, 0x38, 0x6A, 0x13, 0x9D, 0xE3, 0x78, 0xD9, + 0x93, 0xD2, 0xA0, 0x70, 0x88, 0xCB, 0xF5, 0xEC}; +const std::vector DATA_1 = {0x31, 0x32, 0x33, 0x34, 0x31, 0x32, 0x34, 0x29, + 0x51, 0x52, 0x53, 0x54, 0x51, 0x35, 0x54, 0x59}; +const std::vector ICV_1 = {0xDF, 0x54, 0xFF, 0xCD, 0xE0, 0xA9, 0x78, 0x10, + 0x6B, 0x7B, 0xD2, 0xBF, 0xEF, 0xD9, 0x0C, 0x81}; + +const std::vector CAK_ID_2 = {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, 0x02, 0x02}; +const std::vector CAK_KEY_2 = {0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF, + 0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF, + 0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF, + 0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF}; +const std::vector CKN_2 = {0x35, 0x36, 0x37, 0x38}; // maximum 16 bytes +const std::vector SAK_DATA_2 = {0x31, 0x32, 0x33, 0x34, 0x31, 0x32, 0x33, 0x34, + 0x31, 0x32, 0x33, 0x34, 0x31, 0x32, 0x33, 0x34, + 0x31, 0x32, 0x33, 0x34, 0x31, 0x32, 0x33, 0x34, + 0x31, 0x32, 0x33, 0x34, 0x31, 0x32, 0x33, 0x34}; +const std::vector SAK_2 = {0x39, 0x09, 0x36, 0x60, 0x18, 0x07, 0x2B, 0x5D, + 0xF0, 0x81, 0x81, 0x45, 0xCD, 0x71, 0xC6, 0xBA, + 0x1D, 0x2B, 0x87, 0xC4, 0xEF, 0x79, 0x68, 0x82, + 0x28, 0xD0, 0x25, 0x86, 0xD3, 0x63, 0xFF, 0x89}; +const std::vector WRAPPED_SAK_2 = { + 0x2f, 0x6a, 0x22, 0x29, 0x68, 0x0e, 0x6e, 0x35, 0x91, 0x64, 0x05, 0x4a, 0x31, 0x8d, + 0x35, 0xea, 0x95, 0x85, 0x40, 0xc6, 0xea, 0x55, 0xe5, 0xc5, 0x68, 0x40, 0xae, 0x4d, + 0x6f, 0xeb, 0x73, 0xcd, 0x4e, 0x2a, 0x43, 0xb1, 0xda, 0x49, 0x4f, 0x0a}; +const std::vector DATA_2 = {0x71, 0x82, 0x13, 0x24, 0x31, 0x82, 0xA4, 0x2F, + 0x51, 0x52, 0x53, 0x44, 0x21, 0x35, 0x54, 0x59}; +const std::vector ICV_2 = {0x8D, 0xF1, 0x1D, 0x6E, 0xAC, 0x62, 0xC1, 0x2A, + 0xE8, 0xF8, 0x4E, 0xB1, 0x00, 0x45, 0x9A, 0xAD}; + +class MacsecAidlTest : public ::testing::TestWithParam { + public: + virtual void SetUp() override { + android::base::SetDefaultTag("MACSEC_HAL_VTS"); + android::base::SetMinimumLogSeverity(android::base::VERBOSE); + const auto instance = IMacsecPskPlugin::descriptor + "/default"s; + mMacsecPskPluginService = IMacsecPskPlugin::fromBinder( + ndk::SpAIBinder(AServiceManager_waitForService(instance.c_str()))); + + ASSERT_NE(mMacsecPskPluginService, nullptr); + auto aidlStatus = mMacsecPskPluginService->addTestKey(CAK_ID_1, CAK_KEY_1, CKN_1); + ASSERT_TRUE(aidlStatus.isOk()); + aidlStatus = mMacsecPskPluginService->addTestKey(CAK_ID_2, CAK_KEY_2, CKN_2); + ASSERT_TRUE(aidlStatus.isOk()); + } + virtual void TearDown() override {} + + std::shared_ptr mMacsecPskPluginService; +}; + +TEST_P(MacsecAidlTest, calcIcv) { + std::vector out; + auto aidlStatus = mMacsecPskPluginService->calcIcv(CAK_ID_1, DATA_1, &out); + ASSERT_TRUE(aidlStatus.isOk()) << "calcIcv KEY 1 failed: " << aidlStatus.getMessage(); + EXPECT_EQ(out, ICV_1); + + aidlStatus = mMacsecPskPluginService->calcIcv(CAK_ID_2, DATA_2, &out); + ASSERT_TRUE(aidlStatus.isOk()) << "calcIcv KEY 2 failed: " << aidlStatus.getMessage(); + EXPECT_EQ(out, ICV_2); +} + +TEST_P(MacsecAidlTest, generateSak) { + std::vector out; + auto aidlStatus = mMacsecPskPluginService->generateSak(CAK_ID_1, SAK_DATA_1, 16, &out); + ASSERT_TRUE(aidlStatus.isOk()) << "generateSak KEY 1 failed: " << aidlStatus.getMessage(); + EXPECT_EQ(out, SAK_1); + + aidlStatus = mMacsecPskPluginService->generateSak(CAK_ID_2, SAK_DATA_2, 32, &out); + ASSERT_TRUE(aidlStatus.isOk()) << "generateSak KEY 2 failed: " << aidlStatus.getMessage(); + EXPECT_EQ(out, SAK_2); +} + +TEST_P(MacsecAidlTest, wrapSak) { + std::vector out; + auto aidlStatus = mMacsecPskPluginService->wrapSak(CAK_ID_1, SAK_1, &out); + ASSERT_TRUE(aidlStatus.isOk()) << "wrapSak KEY 1 failed: " << aidlStatus.getMessage(); + EXPECT_EQ(out, WRAPPED_SAK_1); + + aidlStatus = mMacsecPskPluginService->wrapSak(CAK_ID_2, SAK_2, &out); + ASSERT_TRUE(aidlStatus.isOk()) << "wrapSak KEY 2 failed: " << aidlStatus.getMessage(); + EXPECT_EQ(out, WRAPPED_SAK_2); +} + +TEST_P(MacsecAidlTest, unwrapSak) { + std::vector out; + auto aidlStatus = mMacsecPskPluginService->unwrapSak(CAK_ID_1, WRAPPED_SAK_1, &out); + ASSERT_TRUE(aidlStatus.isOk()) << "unwrapSak KEY 1 failed: " << aidlStatus.getMessage(); + EXPECT_EQ(out, SAK_1); + + aidlStatus = mMacsecPskPluginService->unwrapSak(CAK_ID_2, WRAPPED_SAK_2, &out); + ASSERT_TRUE(aidlStatus.isOk()) << "unwrapSak KEY 2 failed: " << aidlStatus.getMessage(); + EXPECT_EQ(out, SAK_2); +} + +GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(MacsecAidlTest); +INSTANTIATE_TEST_SUITE_P( + PerInstance, MacsecAidlTest, + testing::ValuesIn(android::getAidlHalInstanceNames(IMacsecPskPlugin::descriptor)), + android::PrintInstanceNameToString); diff --git a/macsec/aidl/vts/functional/OWNERS b/macsec/aidl/vts/functional/OWNERS new file mode 100644 index 0000000000000000000000000000000000000000..5009a8823183497aa3ee1379731ed5a7cc10a7f6 --- /dev/null +++ b/macsec/aidl/vts/functional/OWNERS @@ -0,0 +1,2 @@ +# Bug component: 533426 +keithmok@google.com diff --git a/media/c2/aidl/android/hardware/media/c2/IComponent.aidl b/media/c2/aidl/android/hardware/media/c2/IComponent.aidl index 6bcb5ff0ea09ea84ce413f1ed6de605acbe81530..387d70a73968a59e4b229282d092e4ac8e3d0049 100644 --- a/media/c2/aidl/android/hardware/media/c2/IComponent.aidl +++ b/media/c2/aidl/android/hardware/media/c2/IComponent.aidl @@ -17,6 +17,7 @@ package android.hardware.media.c2; import android.hardware.common.NativeHandle; + import android.hardware.media.c2.IComponentInterface; import android.hardware.media.c2.IConfigurable; import android.hardware.media.c2.IGraphicBufferAllocator; diff --git a/neuralnetworks/aidl/Android.bp b/neuralnetworks/aidl/Android.bp index be868797d13a76b93287e28480007ffca7b63be7..145604cbd307adc3b05e875758ec23970796a812 100644 --- a/neuralnetworks/aidl/Android.bp +++ b/neuralnetworks/aidl/Android.bp @@ -17,7 +17,7 @@ aidl_interface { stability: "vintf", imports: [ "android.hardware.common-V2", - "android.hardware.graphics.common-V4", + "android.hardware.graphics.common-V5", ], backend: { java: { @@ -40,28 +40,28 @@ aidl_interface { version: "1", imports: [ "android.hardware.common-V2", - "android.hardware.graphics.common-V4", + "android.hardware.graphics.common-V5", ], }, { version: "2", imports: [ "android.hardware.common-V2", - "android.hardware.graphics.common-V4", + "android.hardware.graphics.common-V5", ], }, { version: "3", imports: [ "android.hardware.common-V2", - "android.hardware.graphics.common-V4", + "android.hardware.graphics.common-V5", ], }, { version: "4", imports: [ "android.hardware.common-V2", - "android.hardware.graphics.common-V4", + "android.hardware.graphics.common-V5", ], }, diff --git a/power/aidl/Android.bp b/power/aidl/Android.bp index 082572d34cf5aeef806f42d1f4bd4b2a042cbc09..76439265afbf53ef8ee7e8cbc3ed40f6107e1a2d 100644 --- a/power/aidl/Android.bp +++ b/power/aidl/Android.bp @@ -55,6 +55,44 @@ aidl_interface { }, ], - frozen: true, + frozen: false, } + +cc_defaults { + name: "android.hardware.power-ndk_shared", + shared_libs: [ + "android.hardware.power-V5-ndk", + ], +} + +cc_defaults { + name: "android.hardware.power-ndk_export_shared", + shared_libs: [ + "android.hardware.power-V5-ndk", + ], + export_shared_lib_headers: [ + "android.hardware.power-V5-ndk", + ], +} + +cc_defaults { + name: "android.hardware.power-ndk_static", + static_libs: [ + "android.hardware.power-V5-ndk", + ], +} + +java_defaults { + name: "android.hardware.power-java_shared", + libs: [ + "android.hardware.power-V5-java", + ], +} + +java_defaults { + name: "android.hardware.power-java_static", + static_libs: [ + "android.hardware.power-V5-java", + ], +} diff --git a/power/aidl/aidl_api/android.hardware.power/current/android/hardware/power/Boost.aidl b/power/aidl/aidl_api/android.hardware.power/current/android/hardware/power/Boost.aidl index c792d4e0c21c84249e4da7adda65a34ed1150ba4..8ee15eff7ffe06e893256002cc4731797107856c 100644 --- a/power/aidl/aidl_api/android.hardware.power/current/android/hardware/power/Boost.aidl +++ b/power/aidl/aidl_api/android.hardware.power/current/android/hardware/power/Boost.aidl @@ -34,10 +34,10 @@ package android.hardware.power; @Backing(type="int") @VintfStability enum Boost { - INTERACTION = 0, - DISPLAY_UPDATE_IMMINENT = 1, - ML_ACC = 2, - AUDIO_LAUNCH = 3, - CAMERA_LAUNCH = 4, - CAMERA_SHOT = 5, + INTERACTION, + DISPLAY_UPDATE_IMMINENT, + ML_ACC, + AUDIO_LAUNCH, + CAMERA_LAUNCH, + CAMERA_SHOT, } diff --git a/power/aidl/aidl_api/android.hardware.power/current/android/hardware/power/IPowerHintSession.aidl b/power/aidl/aidl_api/android.hardware.power/current/android/hardware/power/IPowerHintSession.aidl index e6809da92cd0e719b625d1804ae0c206cad9e358..6bc663e1258ae4a02f247ce172ca210071f88b8d 100644 --- a/power/aidl/aidl_api/android.hardware.power/current/android/hardware/power/IPowerHintSession.aidl +++ b/power/aidl/aidl_api/android.hardware.power/current/android/hardware/power/IPowerHintSession.aidl @@ -41,4 +41,5 @@ interface IPowerHintSession { oneway void close(); oneway void sendHint(android.hardware.power.SessionHint hint); void setThreads(in int[] threadIds); + oneway void setMode(android.hardware.power.SessionMode type, boolean enabled); } diff --git a/power/aidl/aidl_api/android.hardware.power/current/android/hardware/power/Mode.aidl b/power/aidl/aidl_api/android.hardware.power/current/android/hardware/power/Mode.aidl index f38426b785343b6e0f6a47f4f1b0cbca02c5fcf5..46eca69309e755d79b65898281005f8e62afd426 100644 --- a/power/aidl/aidl_api/android.hardware.power/current/android/hardware/power/Mode.aidl +++ b/power/aidl/aidl_api/android.hardware.power/current/android/hardware/power/Mode.aidl @@ -34,21 +34,23 @@ package android.hardware.power; @Backing(type="int") @VintfStability enum Mode { - DOUBLE_TAP_TO_WAKE = 0, - LOW_POWER = 1, - SUSTAINED_PERFORMANCE = 2, - FIXED_PERFORMANCE = 3, - VR = 4, - LAUNCH = 5, - EXPENSIVE_RENDERING = 6, - INTERACTIVE = 7, - DEVICE_IDLE = 8, - DISPLAY_INACTIVE = 9, - AUDIO_STREAMING_LOW_LATENCY = 10, - CAMERA_STREAMING_SECURE = 11, - CAMERA_STREAMING_LOW = 12, - CAMERA_STREAMING_MID = 13, - CAMERA_STREAMING_HIGH = 14, - GAME = 15, - GAME_LOADING = 16, + DOUBLE_TAP_TO_WAKE, + LOW_POWER, + SUSTAINED_PERFORMANCE, + FIXED_PERFORMANCE, + VR, + LAUNCH, + EXPENSIVE_RENDERING, + INTERACTIVE, + DEVICE_IDLE, + DISPLAY_INACTIVE, + AUDIO_STREAMING_LOW_LATENCY, + CAMERA_STREAMING_SECURE, + CAMERA_STREAMING_LOW, + CAMERA_STREAMING_MID, + CAMERA_STREAMING_HIGH, + GAME, + GAME_LOADING, + DISPLAY_CHANGE, + AUTOMOTIVE_PROJECTION, } diff --git a/power/aidl/aidl_api/android.hardware.power/current/android/hardware/power/SessionHint.aidl b/power/aidl/aidl_api/android.hardware.power/current/android/hardware/power/SessionHint.aidl index 9c1f381543f4e5d9703ef024608b9772c7fd242d..cb377191bdd7842fc8cd7784eb19a0be749b8eb1 100644 --- a/power/aidl/aidl_api/android.hardware.power/current/android/hardware/power/SessionHint.aidl +++ b/power/aidl/aidl_api/android.hardware.power/current/android/hardware/power/SessionHint.aidl @@ -39,4 +39,6 @@ enum SessionHint { CPU_LOAD_RESET = 2, CPU_LOAD_RESUME = 3, POWER_EFFICIENCY = 4, + GPU_LOAD_UP = 5, + GPU_LOAD_DOWN = 6, } diff --git a/power/aidl/aidl_api/android.hardware.power/current/android/hardware/power/SessionMode.aidl b/power/aidl/aidl_api/android.hardware.power/current/android/hardware/power/SessionMode.aidl new file mode 100644 index 0000000000000000000000000000000000000000..d0ae0bab708f15d33703d8ffb2d5f7742d708baa --- /dev/null +++ b/power/aidl/aidl_api/android.hardware.power/current/android/hardware/power/SessionMode.aidl @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/////////////////////////////////////////////////////////////////////////////// +// THIS 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 -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.power; +@Backing(type="int") @VintfStability +enum SessionMode { + POWER_EFFICIENCY, +} diff --git a/power/aidl/aidl_api/android.hardware.power/current/android/hardware/power/WorkDuration.aidl b/power/aidl/aidl_api/android.hardware.power/current/android/hardware/power/WorkDuration.aidl index e86cd40ec29b431889cdfb7d1d6d824b196dd67c..45013ddf77f3bd74bd38a44160a0fb15cf5c212b 100644 --- a/power/aidl/aidl_api/android.hardware.power/current/android/hardware/power/WorkDuration.aidl +++ b/power/aidl/aidl_api/android.hardware.power/current/android/hardware/power/WorkDuration.aidl @@ -36,4 +36,7 @@ package android.hardware.power; parcelable WorkDuration { long timeStampNanos; long durationNanos; + long workPeriodStartTimestampNanos; + long cpuDurationNanos; + long gpuDurationNanos; } diff --git a/power/aidl/android/hardware/power/IPowerHintSession.aidl b/power/aidl/android/hardware/power/IPowerHintSession.aidl index 7db0ea1d545ba5b0b4774641494856f811162f01..62263c8aa9d5ef078185c17e569d53ce51773364 100644 --- a/power/aidl/android/hardware/power/IPowerHintSession.aidl +++ b/power/aidl/android/hardware/power/IPowerHintSession.aidl @@ -17,6 +17,7 @@ package android.hardware.power; import android.hardware.power.SessionHint; +import android.hardware.power.SessionMode; import android.hardware.power.WorkDuration; @VintfStability @@ -81,4 +82,13 @@ interface IPowerHintSession { * must be thrown. */ void setThreads(in int[] threadIds); + + /** + * Called to enable or disable special modes for the hint session, which may + * adjust the power or performance of the session. + * + * @param type The mode being set + * @param enabled True to enable the mode, false to disable it + */ + oneway void setMode(SessionMode type, boolean enabled); } diff --git a/power/aidl/android/hardware/power/Mode.aidl b/power/aidl/android/hardware/power/Mode.aidl index cc4b1308d25ef160ead31770d3b04b0ebddfc565..a8fba720f42d659f3059c3978be961a834e56b00 100644 --- a/power/aidl/android/hardware/power/Mode.aidl +++ b/power/aidl/android/hardware/power/Mode.aidl @@ -133,11 +133,6 @@ enum Mode { */ DISPLAY_INACTIVE, - /** - * Below hints are currently not sent in Android framework but OEM might choose to - * implement for power/perf optimizations. - */ - /** * This mode indicates that low latency audio is active. */ @@ -172,4 +167,16 @@ enum Mode { * This mode indicates that the user is waiting for loading in a game. */ GAME_LOADING, + + /** + * This mode indicates that the display layout is changing due to rotation + * or switching between inner and outer panels. + */ + DISPLAY_CHANGE, + + /** + * This mode indicates that the device is rendering to a remote display in + * a vehicle (such as Android Auto projection screen). + */ + AUTOMOTIVE_PROJECTION, } diff --git a/power/aidl/android/hardware/power/SessionHint.aidl b/power/aidl/android/hardware/power/SessionHint.aidl index a172e1274691f379cc2e4cd200c0fb88b5c6d1f7..ae91061c6055f8c4c0c50cfc0056c0dcb7740259 100644 --- a/power/aidl/android/hardware/power/SessionHint.aidl +++ b/power/aidl/android/hardware/power/SessionHint.aidl @@ -52,4 +52,17 @@ enum SessionHint { * power hint session is noncritical despite its CPU intensity. */ POWER_EFFICIENCY = 4, + + /** + * This hint indicates an increase in GPU workload intensity. It means that + * this hint session needs extra GPU resources to meet the target duration. + * This hint must be sent before reporting the actual duration to the session. + */ + GPU_LOAD_UP = 5, + + /** + * This hint indicates a decrease in GPU workload intensity. It means that + * this hint session can reduce GPU resources and still meet the target duration. + */ + GPU_LOAD_DOWN = 6, } diff --git a/power/aidl/android/hardware/power/SessionMode.aidl b/power/aidl/android/hardware/power/SessionMode.aidl new file mode 100644 index 0000000000000000000000000000000000000000..f1ee64e7da8f9aa59e298839671e436aeee6bc14 --- /dev/null +++ b/power/aidl/android/hardware/power/SessionMode.aidl @@ -0,0 +1,28 @@ +/* + * Copyright (C) 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.hardware.power; + +@VintfStability +@Backing(type="int") +enum SessionMode { + /** + * This mode indicates that the work of this hint session is not + * critical to perceived performance, despite its CPU intensity, + * and can be safely scheduled to prefer power efficiency. + */ + POWER_EFFICIENCY, +} diff --git a/power/aidl/android/hardware/power/WorkDuration.aidl b/power/aidl/android/hardware/power/WorkDuration.aidl index a06a058fb541287cee08ade0faacea30eafbc32f..fcd638b77a102dfb1d88bb2131cceef223f806e5 100644 --- a/power/aidl/android/hardware/power/WorkDuration.aidl +++ b/power/aidl/android/hardware/power/WorkDuration.aidl @@ -23,8 +23,30 @@ parcelable WorkDuration { * sample was measured. */ long timeStampNanos; + /** - * Work duration in nanoseconds. + * Total work duration in nanoseconds. */ long durationNanos; + + /** + * Timestamp in nanoseconds based on CLOCK_MONOTONIC when the work starts. + * The work period start timestamp could be zero if the call is from + * the legacy SDK/NDK reportActualWorkDuration API. + */ + long workPeriodStartTimestampNanos; + + /** + * CPU work duration in nanoseconds. + * The CPU work duration could be the same as the total work duration if + * the call is from the legacy SDK/NDK reportActualWorkDuration API. + */ + long cpuDurationNanos; + + /** + * GPU work duration in nanoseconds. + * The GPU work duration could be zero if the call is from the legacy + * SDK/NDK reportActualWorkDuration API. + */ + long gpuDurationNanos; } diff --git a/power/aidl/default/Android.bp b/power/aidl/default/Android.bp index 64766fc134be24becec06333e63d5bb30006e910..e3af179ea9108272966393b934a5cfb02faf6f93 100644 --- a/power/aidl/default/Android.bp +++ b/power/aidl/default/Android.bp @@ -23,6 +23,7 @@ package { cc_binary { name: "android.hardware.power-service.example", + defaults: ["android.hardware.power-ndk_shared"], relative_install_path: "hw", init_rc: [":android.hardware.power.rc"], vintf_fragments: [":android.hardware.power.xml"], @@ -30,7 +31,6 @@ cc_binary { shared_libs: [ "libbase", "libbinder_ndk", - "android.hardware.power-V4-ndk", ], srcs: [ "main.cpp", diff --git a/power/aidl/default/PowerHintSession.cpp b/power/aidl/default/PowerHintSession.cpp index f395800e8c106db972a645a78b6ef83b79653ffd..452e435c2990e585a9a6df3a58ec8ceaca04ab3f 100644 --- a/power/aidl/default/PowerHintSession.cpp +++ b/power/aidl/default/PowerHintSession.cpp @@ -59,4 +59,8 @@ ScopedAStatus PowerHintSession::setThreads(const std::vector& threadIds return ScopedAStatus::ok(); } +ScopedAStatus PowerHintSession::setMode(SessionMode /* mode */, bool /* enabled */) { + return ScopedAStatus::ok(); +} + } // namespace aidl::android::hardware::power::impl::example diff --git a/power/aidl/default/PowerHintSession.h b/power/aidl/default/PowerHintSession.h index 1d74716461289316c997f8a178006a42d88cc1f2..b488bf108eb16de697d92218a336f401b1861b7d 100644 --- a/power/aidl/default/PowerHintSession.h +++ b/power/aidl/default/PowerHintSession.h @@ -18,6 +18,7 @@ #include #include +#include #include namespace aidl::android::hardware::power::impl::example { @@ -33,6 +34,7 @@ class PowerHintSession : public BnPowerHintSession { ndk::ScopedAStatus close() override; ndk::ScopedAStatus sendHint(SessionHint hint) override; ndk::ScopedAStatus setThreads(const std::vector& threadIds) override; + ndk::ScopedAStatus setMode(SessionMode mode, bool enabled) override; }; } // namespace aidl::android::hardware::power::impl::example diff --git a/power/aidl/default/power-default.xml b/power/aidl/default/power-default.xml index f5dd6b957c512e6b09aa7d5904ea0e8b7f5da25b..418fb83d624da621c6e762657055777a66603fe6 100644 --- a/power/aidl/default/power-default.xml +++ b/power/aidl/default/power-default.xml @@ -1,7 +1,7 @@ android.hardware.power - 4 + 5 IPower/default diff --git a/power/aidl/vts/Android.bp b/power/aidl/vts/Android.bp index 56c98bd2d800ecaa39cf249e3377b0998f005826..eb98b8b5bf0b77355ddeaf7c18ab73b2198a6eb6 100644 --- a/power/aidl/vts/Android.bp +++ b/power/aidl/vts/Android.bp @@ -26,14 +26,12 @@ cc_test { defaults: [ "VtsHalTargetTestDefaults", "use_libaidlvintf_gtest_helper_static", + "android.hardware.power-ndk_static", ], srcs: ["VtsHalPowerTargetTest.cpp"], shared_libs: [ "libbinder_ndk", ], - static_libs: [ - "android.hardware.power-V4-ndk", - ], test_suites: [ "general-tests", "vts", diff --git a/power/aidl/vts/VtsHalPowerTargetTest.cpp b/power/aidl/vts/VtsHalPowerTargetTest.cpp index 907cf00e960c0d954807ca4689ebe1f465e92040..eb28c8c47d36b49178b300ab0a664feb241d5a7a 100644 --- a/power/aidl/vts/VtsHalPowerTargetTest.cpp +++ b/power/aidl/vts/VtsHalPowerTargetTest.cpp @@ -29,12 +29,12 @@ namespace aidl::android::hardware::power { namespace { -using ::android::base::GetUintProperty; using android::hardware::power::Boost; using android::hardware::power::IPower; using android::hardware::power::IPowerHintSession; using android::hardware::power::Mode; using android::hardware::power::SessionHint; +using android::hardware::power::SessionMode; using android::hardware::power::WorkDuration; const std::vector kBoosts{ndk::enum_range().begin(), ndk::enum_range().end()}; @@ -44,6 +44,9 @@ const std::vector kModes{ndk::enum_range().begin(), ndk::enum_range< const std::vector kSessionHints{ndk::enum_range().begin(), ndk::enum_range().end()}; +const std::vector kSessionModes{ndk::enum_range().begin(), + ndk::enum_range().end()}; + const std::vector kInvalidBoosts = { static_cast(static_cast(kBoosts.front()) - 1), static_cast(static_cast(kBoosts.back()) + 1), @@ -59,6 +62,11 @@ const std::vector kInvalidSessionHints = { static_cast(static_cast(kSessionHints.back()) + 1), }; +const std::vector kInvalidSessionModes = { + static_cast(static_cast(kSessionModes.front()) - 1), + static_cast(static_cast(kSessionModes.back()) + 1), +}; + class DurationWrapper : public WorkDuration { public: DurationWrapper(int64_t dur, int64_t time) { @@ -90,36 +98,33 @@ const std::vector kDurations = { DurationWrapper(1000000000L, 4L), }; -// DEVICEs launching with Android 11 MUST meet the requirements for the -// target-level=5 compatibility_matrix file. -const uint64_t kCompatibilityMatrix5ApiLevel = 30; - -// DEVICEs launching with Android 13 MUST meet the requirements for the -// target-level=7 compatibility_matrix file. -const uint64_t kCompatibilityMatrix7ApiLevel = 33; - -// DEVICEs launching with Android 14 MUST meet the requirements for the -// target-level=8 compatibility_matrix file. -const uint64_t kCompatibilityMatrix8ApiLevel = 34; - -inline bool isUnknownOrUnsupported(const ndk::ScopedAStatus& status) { - return status.getStatus() == STATUS_UNKNOWN_TRANSACTION || - status.getExceptionCode() == EX_UNSUPPORTED_OPERATION; -} - class PowerAidl : public testing::TestWithParam { public: virtual void SetUp() override { AIBinder* binder = AServiceManager_waitForService(GetParam().c_str()); ASSERT_NE(binder, nullptr); power = IPower::fromBinder(ndk::SpAIBinder(binder)); - - mApiLevel = GetUintProperty("ro.vendor.api_level", 0); - ASSERT_NE(mApiLevel, 0); + auto status = power->getInterfaceVersion(&mServiceVersion); + ASSERT_TRUE(status.isOk()); } std::shared_ptr power; - uint64_t mApiLevel; + int32_t mServiceVersion; +}; + +class HintSessionAidl : public PowerAidl { + public: + virtual void SetUp() override { + PowerAidl::SetUp(); + if (mServiceVersion < 2) { + GTEST_SKIP() << "DEVICE not launching with Power V2 and beyond."; + } + + auto status = power->createHintSession(getpid(), getuid(), kSelfTids, 16666666L, &mSession); + ASSERT_TRUE(status.isOk()); + ASSERT_NE(nullptr, mSession); + } + std::shared_ptr mSession; }; TEST_P(PowerAidl, setMode) { @@ -173,113 +178,95 @@ TEST_P(PowerAidl, isBoostSupported) { } TEST_P(PowerAidl, getHintSessionPreferredRate) { - int64_t rate = -1; - auto status = power->getHintSessionPreferredRate(&rate); - if (mApiLevel < kCompatibilityMatrix7ApiLevel && !status.isOk()) { - EXPECT_TRUE(isUnknownOrUnsupported(status)); - GTEST_SKIP() << "DEVICE not launching with Android 13 and beyond."; + if (mServiceVersion < 2) { + GTEST_SKIP() << "DEVICE not launching with Power V2 and beyond."; } - ASSERT_TRUE(status.isOk()); + + int64_t rate = -1; + ASSERT_TRUE(power->getHintSessionPreferredRate(&rate).isOk()); // At least 1ms rate limit from HAL ASSERT_GE(rate, 1000000); } -TEST_P(PowerAidl, createAndCloseHintSession) { - std::shared_ptr session; - auto status = power->createHintSession(getpid(), getuid(), kSelfTids, 16666666L, &session); - if (mApiLevel < kCompatibilityMatrix7ApiLevel && !status.isOk()) { - EXPECT_TRUE(isUnknownOrUnsupported(status)); - GTEST_SKIP() << "DEVICE not launching with Android 13 and beyond."; - } - ASSERT_TRUE(status.isOk()); - ASSERT_NE(nullptr, session); - ASSERT_TRUE(session->pause().isOk()); - ASSERT_TRUE(session->resume().isOk()); +TEST_P(HintSessionAidl, createAndCloseHintSession) { + ASSERT_TRUE(mSession->pause().isOk()); + ASSERT_TRUE(mSession->resume().isOk()); // Test normal destroy operation - ASSERT_TRUE(session->close().isOk()); - session.reset(); + ASSERT_TRUE(mSession->close().isOk()); + mSession.reset(); } -TEST_P(PowerAidl, createHintSessionFailed) { +TEST_P(HintSessionAidl, createHintSessionFailed) { std::shared_ptr session; auto status = power->createHintSession(getpid(), getuid(), kEmptyTids, 16666666L, &session); // Regardless of whether V2 and beyond is supported, the status is always not STATUS_OK. ASSERT_FALSE(status.isOk()); - - // If device not launching with Android 13 and beyond, check whether it's supported, - // if not, skip the test. - if (mApiLevel < kCompatibilityMatrix7ApiLevel && isUnknownOrUnsupported(status)) { - GTEST_SKIP() << "DEVICE not launching with Android 13 and beyond."; - } ASSERT_EQ(EX_ILLEGAL_ARGUMENT, status.getExceptionCode()); } -TEST_P(PowerAidl, updateAndReportDurations) { - std::shared_ptr session; - auto status = power->createHintSession(getpid(), getuid(), kSelfTids, 16666666L, &session); - if (mApiLevel < kCompatibilityMatrix7ApiLevel && !status.isOk()) { - EXPECT_TRUE(isUnknownOrUnsupported(status)); - GTEST_SKIP() << "DEVICE not launching with Android 13 and beyond."; - } - ASSERT_TRUE(status.isOk()); - ASSERT_NE(nullptr, session); - - ASSERT_TRUE(session->updateTargetWorkDuration(16666667LL).isOk()); - ASSERT_TRUE(session->reportActualWorkDuration(kDurations).isOk()); +TEST_P(HintSessionAidl, updateAndReportDurations) { + ASSERT_TRUE(mSession->updateTargetWorkDuration(16666667LL).isOk()); + ASSERT_TRUE(mSession->reportActualWorkDuration(kDurations).isOk()); } -TEST_P(PowerAidl, sendSessionHint) { - std::shared_ptr session; - auto status = power->createHintSession(getpid(), getuid(), kSelfTids, 16666666L, &session); - if (!status.isOk()) { - EXPECT_TRUE(isUnknownOrUnsupported(status)); - return; +TEST_P(HintSessionAidl, sendSessionHint) { + if (mServiceVersion < 4) { + GTEST_SKIP() << "DEVICE not launching with Power V4 and beyond."; } + for (const auto& sessionHint : kSessionHints) { - ASSERT_TRUE(session->sendHint(sessionHint).isOk()); + ASSERT_TRUE(mSession->sendHint(sessionHint).isOk()); } for (const auto& sessionHint : kInvalidSessionHints) { - ASSERT_TRUE(session->sendHint(sessionHint).isOk()); + ASSERT_TRUE(mSession->sendHint(sessionHint).isOk()); } } -TEST_P(PowerAidl, setThreads) { - std::shared_ptr session; - auto status = power->createHintSession(getpid(), getuid(), kSelfTids, 16666666L, &session); - if (mApiLevel < kCompatibilityMatrix7ApiLevel && !status.isOk()) { - EXPECT_TRUE(isUnknownOrUnsupported(status)); - GTEST_SKIP() << "DEVICE not launching with Android 13 and beyond."; +TEST_P(HintSessionAidl, setThreads) { + if (mServiceVersion < 4) { + GTEST_SKIP() << "DEVICE not launching with Power V4 and beyond."; } - ASSERT_TRUE(status.isOk()); - status = session->setThreads(kEmptyTids); - if (mApiLevel < kCompatibilityMatrix8ApiLevel && isUnknownOrUnsupported(status)) { - GTEST_SKIP() << "DEVICE not launching with Android 14 and beyond."; - } + auto status = mSession->setThreads(kEmptyTids); ASSERT_FALSE(status.isOk()); ASSERT_EQ(EX_ILLEGAL_ARGUMENT, status.getExceptionCode()); - status = session->setThreads(kSelfTids); - ASSERT_TRUE(status.isOk()); + ASSERT_TRUE(mSession->setThreads(kSelfTids).isOk()); +} + +TEST_P(HintSessionAidl, setSessionMode) { + if (mServiceVersion < 5) { + GTEST_SKIP() << "DEVICE not launching with Power V5 and beyond."; + } + + for (const auto& sessionMode : kSessionModes) { + ASSERT_TRUE(mSession->setMode(sessionMode, true).isOk()); + ASSERT_TRUE(mSession->setMode(sessionMode, false).isOk()); + } + for (const auto& sessionMode : kInvalidSessionModes) { + ASSERT_TRUE(mSession->setMode(sessionMode, true).isOk()); + ASSERT_TRUE(mSession->setMode(sessionMode, false).isOk()); + } } // FIXED_PERFORMANCE mode is required for all devices which ship on Android 11 // or later TEST_P(PowerAidl, hasFixedPerformance) { - if (mApiLevel < kCompatibilityMatrix5ApiLevel) { - GTEST_SKIP() << "FIXED_PERFORMANCE mode is only required for all devices launching Android " - "11 or later."; - } bool supported; ASSERT_TRUE(power->isModeSupported(Mode::FIXED_PERFORMANCE, &supported).isOk()); ASSERT_TRUE(supported); } GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(PowerAidl); +GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(HintSessionAidl); + INSTANTIATE_TEST_SUITE_P(Power, PowerAidl, testing::ValuesIn(::android::getAidlHalInstanceNames(IPower::descriptor)), ::android::PrintInstanceNameToString); +INSTANTIATE_TEST_SUITE_P(Power, HintSessionAidl, + testing::ValuesIn(::android::getAidlHalInstanceNames(IPower::descriptor)), + ::android::PrintInstanceNameToString); } // namespace } // namespace aidl::android::hardware::power diff --git a/radio/aidl/Android.bp b/radio/aidl/Android.bp index 09f845b8ab9069989c36222585d8ccf55ca913db..1971832465c0a626c734409f9f618108f6dda353 100644 --- a/radio/aidl/Android.bp +++ b/radio/aidl/Android.bp @@ -12,7 +12,6 @@ aidl_interface { vendor_available: true, host_supported: true, srcs: ["android/hardware/radio/*.aidl"], - frozen: true, stability: "vintf", backend: { cpp: { @@ -41,9 +40,8 @@ aidl_interface { vendor_available: true, host_supported: true, srcs: ["android/hardware/radio/config/*.aidl"], - frozen: true, stability: "vintf", - imports: ["android.hardware.radio-V2"], + imports: ["android.hardware.radio-V3"], backend: { cpp: { enabled: true, @@ -72,7 +70,7 @@ aidl_interface { host_supported: true, srcs: ["android/hardware/radio/data/*.aidl"], stability: "vintf", - imports: ["android.hardware.radio-V2"], + imports: ["android.hardware.radio-V3"], backend: { cpp: { enabled: true, @@ -92,8 +90,6 @@ aidl_interface { }, ], - frozen: true, - } aidl_interface { @@ -102,7 +98,7 @@ aidl_interface { host_supported: true, srcs: ["android/hardware/radio/messaging/*.aidl"], stability: "vintf", - imports: ["android.hardware.radio-V2"], + imports: ["android.hardware.radio-V3"], backend: { cpp: { enabled: true, @@ -122,8 +118,6 @@ aidl_interface { }, ], - frozen: true, - } aidl_interface { @@ -132,7 +126,7 @@ aidl_interface { host_supported: true, srcs: ["android/hardware/radio/modem/*.aidl"], stability: "vintf", - imports: ["android.hardware.radio-V2"], + imports: ["android.hardware.radio-V3"], backend: { cpp: { enabled: true, @@ -152,8 +146,6 @@ aidl_interface { }, ], - frozen: true, - } aidl_interface { @@ -162,7 +154,7 @@ aidl_interface { host_supported: true, srcs: ["android/hardware/radio/network/*.aidl"], stability: "vintf", - imports: ["android.hardware.radio-V2"], + imports: ["android.hardware.radio-V3"], backend: { cpp: { enabled: true, @@ -182,8 +174,6 @@ aidl_interface { }, ], - frozen: true, - } aidl_interface { @@ -212,7 +202,6 @@ aidl_interface { }, ], frozen: true, - } aidl_interface { @@ -222,8 +211,8 @@ aidl_interface { srcs: ["android/hardware/radio/sim/*.aidl"], stability: "vintf", imports: [ - "android.hardware.radio-V2", - "android.hardware.radio.config-V2", + "android.hardware.radio-V3", + "android.hardware.radio.config-V3", ], backend: { cpp: { @@ -250,8 +239,6 @@ aidl_interface { }, ], - frozen: true, - } aidl_interface { @@ -260,7 +247,7 @@ aidl_interface { host_supported: true, srcs: ["android/hardware/radio/voice/*.aidl"], stability: "vintf", - imports: ["android.hardware.radio-V2"], + imports: ["android.hardware.radio-V3"], backend: { cpp: { enabled: true, @@ -280,8 +267,6 @@ aidl_interface { }, ], - frozen: true, - } aidl_interface { @@ -290,8 +275,8 @@ aidl_interface { srcs: ["android/hardware/radio/ims/media/*.aidl"], stability: "vintf", imports: [ - "android.hardware.radio-V2", - "android.hardware.radio.data-V2", + "android.hardware.radio-V3", + "android.hardware.radio.data-V3", ], backend: { cpp: { @@ -310,8 +295,6 @@ aidl_interface { ], }, ], - frozen: true, - } aidl_interface { @@ -319,7 +302,7 @@ aidl_interface { vendor_available: true, srcs: ["android/hardware/radio/ims/*.aidl"], stability: "vintf", - imports: ["android.hardware.radio-V2"], + imports: ["android.hardware.radio-V3"], backend: { cpp: { enabled: false, @@ -334,6 +317,4 @@ aidl_interface { imports: ["android.hardware.radio-V2"], }, ], - frozen: true, - } diff --git a/radio/aidl/aidl_api/android.hardware.radio.config/current/android/hardware/radio/config/IRadioConfig.aidl b/radio/aidl/aidl_api/android.hardware.radio.config/current/android/hardware/radio/config/IRadioConfig.aidl index a48a89b458aac795bf148b3b3db599100628d5ca..0f5e7e4f77c1f56f455be51920d3de212d662f76 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.config/current/android/hardware/radio/config/IRadioConfig.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.config/current/android/hardware/radio/config/IRadioConfig.aidl @@ -40,6 +40,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.config; +/* @hide */ @VintfStability interface IRadioConfig { oneway void getHalDeviceCapabilities(in int serial); diff --git a/radio/aidl/aidl_api/android.hardware.radio.config/current/android/hardware/radio/config/IRadioConfigIndication.aidl b/radio/aidl/aidl_api/android.hardware.radio.config/current/android/hardware/radio/config/IRadioConfigIndication.aidl index 994e337c04445fc2901a3ac4b19172d639a7bca0..9189f9062ff89c835c59b7328a2dfeee635e1524 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.config/current/android/hardware/radio/config/IRadioConfigIndication.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.config/current/android/hardware/radio/config/IRadioConfigIndication.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.config; +/* @hide */ @VintfStability interface IRadioConfigIndication { oneway void simSlotsStatusChanged(in android.hardware.radio.RadioIndicationType type, in android.hardware.radio.config.SimSlotStatus[] slotStatus); diff --git a/radio/aidl/aidl_api/android.hardware.radio.config/current/android/hardware/radio/config/IRadioConfigResponse.aidl b/radio/aidl/aidl_api/android.hardware.radio.config/current/android/hardware/radio/config/IRadioConfigResponse.aidl index 038b0aeb5870548c2739337f469ff29709e373b9..348aa348bf26c5dcc289f0ab31bb872b36a1bddc 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.config/current/android/hardware/radio/config/IRadioConfigResponse.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.config/current/android/hardware/radio/config/IRadioConfigResponse.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.config; +/* @hide */ @VintfStability interface IRadioConfigResponse { oneway void getHalDeviceCapabilitiesResponse(in android.hardware.radio.RadioResponseInfo info, in boolean modemReducedFeatureSet1); diff --git a/radio/aidl/aidl_api/android.hardware.radio.config/current/android/hardware/radio/config/MultipleEnabledProfilesMode.aidl b/radio/aidl/aidl_api/android.hardware.radio.config/current/android/hardware/radio/config/MultipleEnabledProfilesMode.aidl index 74017e407a89557b883bd06964246fadf921c9e7..41c42016c242689345b1c69b066c48f550352619 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.config/current/android/hardware/radio/config/MultipleEnabledProfilesMode.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.config/current/android/hardware/radio/config/MultipleEnabledProfilesMode.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.config; +/* @hide */ @Backing(type="int") @JavaDerive(toString=true) @VintfStability enum MultipleEnabledProfilesMode { NONE, diff --git a/radio/aidl/aidl_api/android.hardware.radio.config/current/android/hardware/radio/config/PhoneCapability.aidl b/radio/aidl/aidl_api/android.hardware.radio.config/current/android/hardware/radio/config/PhoneCapability.aidl index db3a4c65f3a752ab24f73f715fb6bebb6dcfe621..3648866a13d745192664484ac5b7fa6280094a21 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.config/current/android/hardware/radio/config/PhoneCapability.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.config/current/android/hardware/radio/config/PhoneCapability.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.config; +/* @hide */ @JavaDerive(toString=true) @VintfStability parcelable PhoneCapability { byte maxActiveData; diff --git a/radio/aidl/aidl_api/android.hardware.radio.config/current/android/hardware/radio/config/SimPortInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.config/current/android/hardware/radio/config/SimPortInfo.aidl index b5d31ada35726998a09d48591231420ed807d713..ede318931a722f6aed92929553d91dd527c6af87 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.config/current/android/hardware/radio/config/SimPortInfo.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.config/current/android/hardware/radio/config/SimPortInfo.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.config; +/* @hide */ @JavaDerive(toString=true) @VintfStability parcelable SimPortInfo { String iccId; diff --git a/radio/aidl/aidl_api/android.hardware.radio.config/current/android/hardware/radio/config/SimSlotStatus.aidl b/radio/aidl/aidl_api/android.hardware.radio.config/current/android/hardware/radio/config/SimSlotStatus.aidl index c264dfd3cff74bc2192b8cd738eb98c98ea527a2..e84e7d45bd092d5bf326d6d01524c2fb4369339e 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.config/current/android/hardware/radio/config/SimSlotStatus.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.config/current/android/hardware/radio/config/SimSlotStatus.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.config; +/* @hide */ @JavaDerive(toString=true) @VintfStability parcelable SimSlotStatus { int cardState; diff --git a/radio/aidl/aidl_api/android.hardware.radio.config/current/android/hardware/radio/config/SlotPortMapping.aidl b/radio/aidl/aidl_api/android.hardware.radio.config/current/android/hardware/radio/config/SlotPortMapping.aidl index 31271eed8d465ae36482dec00d71fcc8d3791056..5278e79f1c822b832d01e179df0ca07fa192189e 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.config/current/android/hardware/radio/config/SlotPortMapping.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.config/current/android/hardware/radio/config/SlotPortMapping.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.config; +/* @hide */ @JavaDerive(toString=true) @VintfStability parcelable SlotPortMapping { int physicalSlotId; diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/ApnAuthType.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/ApnAuthType.aidl index a33ad6e338b40f9c37512bea15770c1496738f2f..eed81701b8244ab0cf41808105a6346101a39a15 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/ApnAuthType.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/ApnAuthType.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.data; +/* @hide */ @Backing(type="int") @JavaDerive(toString=true) @VintfStability enum ApnAuthType { NO_PAP_NO_CHAP, diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/ApnTypes.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/ApnTypes.aidl index 45d22c853fe3ebd0fa342ec75e4a1f8c60d02f33..782dbbf0ceb9381c05e2d0f388028a41c8b23757 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/ApnTypes.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/ApnTypes.aidl @@ -32,22 +32,24 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.data; +/* @hide */ @Backing(type="int") @JavaDerive(toString=true) @VintfStability enum ApnTypes { NONE = 0, - DEFAULT = (1 << 0), - MMS = (1 << 1), - SUPL = (1 << 2), - DUN = (1 << 3), - HIPRI = (1 << 4), - FOTA = (1 << 5), - IMS = (1 << 6), - CBS = (1 << 7), - IA = (1 << 8), - EMERGENCY = (1 << 9), - MCX = (1 << 10), - XCAP = (1 << 11), - VSIM = (1 << 12), - BIP = (1 << 13), - ENTERPRISE = (1 << 14), + DEFAULT = (1 << 0) /* 1 */, + MMS = (1 << 1) /* 2 */, + SUPL = (1 << 2) /* 4 */, + DUN = (1 << 3) /* 8 */, + HIPRI = (1 << 4) /* 16 */, + FOTA = (1 << 5) /* 32 */, + IMS = (1 << 6) /* 64 */, + CBS = (1 << 7) /* 128 */, + IA = (1 << 8) /* 256 */, + EMERGENCY = (1 << 9) /* 512 */, + MCX = (1 << 10) /* 1024 */, + XCAP = (1 << 11) /* 2048 */, + VSIM = (1 << 12) /* 4096 */, + BIP = (1 << 13) /* 8192 */, + ENTERPRISE = (1 << 14) /* 16384 */, + RCS = (1 << 15) /* 32768 */, } diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/DataCallFailCause.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/DataCallFailCause.aidl index 8a3fd4f4cda2638da45a473330168ff992d76c1d..009b428273dac4e0405992b0407aafd0a7754d5a 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/DataCallFailCause.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/DataCallFailCause.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.data; +/* @hide */ @Backing(type="int") @JavaDerive(toString=true) @VintfStability enum DataCallFailCause { NONE = 0, @@ -101,12 +102,12 @@ enum DataCallFailCause { OEM_DCFAILCAUSE_13 = 0x100D, OEM_DCFAILCAUSE_14 = 0x100E, OEM_DCFAILCAUSE_15 = 0x100F, - VOICE_REGISTRATION_FAIL = (-1), - DATA_REGISTRATION_FAIL = (-2), - SIGNAL_LOST = (-3), - PREF_RADIO_TECH_CHANGED = (-4), - RADIO_POWER_OFF = (-5), - TETHERED_CALL_ACTIVE = (-6), + VOICE_REGISTRATION_FAIL = (-1) /* -1 */, + DATA_REGISTRATION_FAIL = (-2) /* -2 */, + SIGNAL_LOST = (-3) /* -3 */, + PREF_RADIO_TECH_CHANGED = (-4) /* -4 */, + RADIO_POWER_OFF = (-5) /* -5 */, + TETHERED_CALL_ACTIVE = (-6) /* -6 */, ERROR_UNSPECIFIED = 0xffff, LLC_SNDCP = 0x19, ACTIVATION_REJECTED_BCM_VIOLATION = 0x30, diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/DataProfileInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/DataProfileInfo.aidl index 0136fa4a5a50d5de6732048689a72edecaf1a045..7f3fdc7721c826b37719a0db12ebb3eabe26f3e5 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/DataProfileInfo.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/DataProfileInfo.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.data; +/* @hide */ @JavaDerive(toString=true) @VintfStability parcelable DataProfileInfo { int profileId; @@ -54,6 +55,7 @@ parcelable DataProfileInfo { boolean persistent; boolean alwaysOn; android.hardware.radio.data.TrafficDescriptor trafficDescriptor; + int infrastructureBitmap = INFRASTRUCTURE_UNKNOWN /* 0 */; const int ID_DEFAULT = 0; const int ID_TETHERED = 1; const int ID_IMS = 2; @@ -64,4 +66,7 @@ parcelable DataProfileInfo { const int TYPE_COMMON = 0; const int TYPE_3GPP = 1; const int TYPE_3GPP2 = 2; + const int INFRASTRUCTURE_UNKNOWN = 0; + const int INFRASTRUCTURE_CELLULAR = (1 << 0) /* 1 */; + const int INFRASTRUCTURE_SATELLITE = (1 << 1) /* 2 */; } diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/DataRequestReason.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/DataRequestReason.aidl index 0ddaff1662caba2a0ea6fe49f2ef7ce1e0f92e16..98ae53a080fd1807ab79c52f63f0fbaa35f682f8 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/DataRequestReason.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/DataRequestReason.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.data; +/* @hide */ @Backing(type="int") @JavaDerive(toString=true) @VintfStability enum DataRequestReason { NORMAL = 1, diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/DataThrottlingAction.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/DataThrottlingAction.aidl index e80a76404636a7481206605903cd1bd6dbbb6e00..e1fedb86c0b2c0d70e3b74ea06ff56e2070a0df3 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/DataThrottlingAction.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/DataThrottlingAction.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.data; +/* @hide */ @Backing(type="byte") @JavaDerive(toString=true) @VintfStability enum DataThrottlingAction { NO_DATA_THROTTLING, diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/EpsQos.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/EpsQos.aidl index 5b9aaa0b1ee06f8e5b145c4c8edf9dada933cdaf..3a3f41d98e80ac7525c90e1e7646e56f56c416e9 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/EpsQos.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/EpsQos.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.data; +/* @hide */ @JavaDerive(toString=true) @VintfStability parcelable EpsQos { int qci; diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/IRadioData.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/IRadioData.aidl index 7b572f1f8e8e535ef658d3387f78f395ba39a1eb..3888c627e7a80bd41fa569867d95d60aa617419b 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/IRadioData.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/IRadioData.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.data; +/* @hide */ @VintfStability interface IRadioData { oneway void allocatePduSessionId(in int serial); diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/IRadioDataIndication.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/IRadioDataIndication.aidl index 0ffa1f7ddf2f8976e81f786da302559e9e9a8b49..6057d6af074ca72c6821112b615d2d9191431607 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/IRadioDataIndication.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/IRadioDataIndication.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.data; +/* @hide */ @VintfStability interface IRadioDataIndication { oneway void dataCallListChanged(in android.hardware.radio.RadioIndicationType type, in android.hardware.radio.data.SetupDataCallResult[] dcList); diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/IRadioDataResponse.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/IRadioDataResponse.aidl index 4edc17d4ad508b843acf9ee57c5333ceaf6b79cf..dc44454f3f1f9a3d3252885a4392676fac4a2d81 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/IRadioDataResponse.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/IRadioDataResponse.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.data; +/* @hide */ @VintfStability interface IRadioDataResponse { oneway void acknowledgeRequest(in int serial); diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/KeepaliveRequest.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/KeepaliveRequest.aidl index 592a54a90c124edc77a2225aa297225e304eaebe..789ee863f2cd9e9ce9e41f29017b6be6615e119f 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/KeepaliveRequest.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/KeepaliveRequest.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.data; +/* @hide */ @JavaDerive(toString=true) @VintfStability parcelable KeepaliveRequest { int type; diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/KeepaliveStatus.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/KeepaliveStatus.aidl index 82b0fc8ec1c801acdb37fc4d99aa29940fa12418..404b44a3e0b2260de0c7a7352a6658c575220488 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/KeepaliveStatus.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/KeepaliveStatus.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.data; +/* @hide */ @JavaDerive(toString=true) @VintfStability parcelable KeepaliveStatus { int sessionHandle; diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/LinkAddress.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/LinkAddress.aidl index 77d637b9b94da42f3c5e26b95869af8508cd7a9c..bef4c736f8a940609331f04f5372454317e19f03 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/LinkAddress.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/LinkAddress.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.data; +/* @hide */ @JavaDerive(toString=true) @VintfStability parcelable LinkAddress { String address; diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/NrQos.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/NrQos.aidl index be859b79dea46a1fd219b4e71781289778b77a27..22bbe4293319fa23c65cbdf58c0c8c4973d8fc0f 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/NrQos.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/NrQos.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.data; +/* @hide */ @JavaDerive(toString=true) @VintfStability parcelable NrQos { int fiveQi; @@ -42,8 +43,8 @@ parcelable NrQos { * @deprecated use averagingWindowMillis; */ char averagingWindowMs; - int averagingWindowMillis = AVERAGING_WINDOW_UNKNOWN; + int averagingWindowMillis = AVERAGING_WINDOW_UNKNOWN /* -1 */; const byte FLOW_ID_RANGE_MIN = 1; const byte FLOW_ID_RANGE_MAX = 63; - const int AVERAGING_WINDOW_UNKNOWN = (-1); + const int AVERAGING_WINDOW_UNKNOWN = (-1) /* -1 */; } diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/OsAppId.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/OsAppId.aidl index 8595d5206d3637f9bc5a2f5b66404665f23398c8..e4bbf79126d95970c1bb9539625b8b55d678344b 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/OsAppId.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/OsAppId.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.data; +/* @hide */ @JavaDerive(toString=true) @VintfStability parcelable OsAppId { byte[] osAppId; diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/PcoDataInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/PcoDataInfo.aidl index 033b12f4eefe921d45ac04564411c42e61f0eb07..ea7529cb34c86ed7c5701d6ae7bf9430a6fb8e2b 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/PcoDataInfo.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/PcoDataInfo.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.data; +/* @hide */ @JavaDerive(toString=true) @VintfStability parcelable PcoDataInfo { int cid; diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/PdpProtocolType.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/PdpProtocolType.aidl index d1c4a62a314720f6b540de2c56f43b16f10cb91f..3a7f82d40163695bcc9ff82acdd6ea483e52b327 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/PdpProtocolType.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/PdpProtocolType.aidl @@ -32,9 +32,10 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.data; +/* @hide */ @Backing(type="int") @JavaDerive(toString=true) @VintfStability enum PdpProtocolType { - UNKNOWN = (-1), + UNKNOWN = (-1) /* -1 */, IP = 0, IPV6 = 1, IPV4V6 = 2, diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/PortRange.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/PortRange.aidl index 470a9c11b3a4e1e49802483e33dafd9e1a95ecb2..45e2dc968706e9c2f2600bf45631b4ef28afcdd5 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/PortRange.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/PortRange.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.data; +/* @hide */ @JavaDerive(toString=true) @VintfStability parcelable PortRange { int start; diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/Qos.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/Qos.aidl index ca06e4112bcb87faf7ffd9fb9441211acc9e9714..4dac56c5d9fafe3d834f011b7f44ed7440c6e5e2 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/Qos.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/Qos.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.data; +/* @hide */ @JavaDerive(toString=true) @VintfStability union Qos { boolean noinit; diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/QosBandwidth.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/QosBandwidth.aidl index 6d4b7a9f49ff7e62fe9d3a2ea17453475391bae6..b59dee0d40e2c73f162cf36e3adae097b9c34ba7 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/QosBandwidth.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/QosBandwidth.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.data; +/* @hide */ @JavaDerive(toString=true) @VintfStability parcelable QosBandwidth { int maxBitrateKbps; diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/QosFilter.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/QosFilter.aidl index de45cc5f323f312421049c8cdb21d9d0e4d9a7b7..a3208d9b6c611eabaad6188486bbfd86f073a071 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/QosFilter.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/QosFilter.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.data; +/* @hide */ @JavaDerive(toString=true) @VintfStability parcelable QosFilter { String[] localAddresses; @@ -47,7 +48,7 @@ parcelable QosFilter { const byte DIRECTION_DOWNLINK = 0; const byte DIRECTION_UPLINK = 1; const byte DIRECTION_BIDIRECTIONAL = 2; - const byte PROTOCOL_UNSPECIFIED = (-1); + const byte PROTOCOL_UNSPECIFIED = (-1) /* -1 */; const byte PROTOCOL_TCP = 6; const byte PROTOCOL_UDP = 17; const byte PROTOCOL_ESP = 50; diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/QosFilterIpsecSpi.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/QosFilterIpsecSpi.aidl index 4b75340276a27aabc7baa3c5c864e3082e0cf806..50b52a49571b85a5f92d6da86c9c7e907b76ce2a 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/QosFilterIpsecSpi.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/QosFilterIpsecSpi.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.data; +/* @hide */ @JavaDerive(toString=true) @VintfStability union QosFilterIpsecSpi { boolean noinit; diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/QosFilterIpv6FlowLabel.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/QosFilterIpv6FlowLabel.aidl index 3fb34ea3752fc5b314c8fe13d0c48a909729ff83..4913dcf07be9c7abf6a11567aeceb03eafce96d0 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/QosFilterIpv6FlowLabel.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/QosFilterIpv6FlowLabel.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.data; +/* @hide */ @JavaDerive(toString=true) @VintfStability union QosFilterIpv6FlowLabel { boolean noinit; diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/QosFilterTypeOfService.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/QosFilterTypeOfService.aidl index fa85b5acc35b1ea488c4f49454d7c4d2e9e77a8f..4f0d2605e1135436fff85587aca4c1746277603e 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/QosFilterTypeOfService.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/QosFilterTypeOfService.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.data; +/* @hide */ @JavaDerive(toString=true) @VintfStability union QosFilterTypeOfService { boolean noinit; diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/QosSession.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/QosSession.aidl index bbfdd2d48cebf4b5d06251fd853aa521d63de063..89010a9feb7e34cf1fa6c27379b44dbd9d8eb780 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/QosSession.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/QosSession.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.data; +/* @hide */ @JavaDerive(toString=true) @VintfStability parcelable QosSession { int qosSessionId; diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/RouteSelectionDescriptor.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/RouteSelectionDescriptor.aidl index d83df81a3877c4122ed9b30dfa908b2ff10a9641..8864c246d6ac1c236da9670ca37c7487610609c7 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/RouteSelectionDescriptor.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/RouteSelectionDescriptor.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.data; +/* @hide */ @JavaDerive(toString=true) @VintfStability parcelable RouteSelectionDescriptor { byte precedence; @@ -39,7 +40,7 @@ parcelable RouteSelectionDescriptor { byte sscMode; android.hardware.radio.data.SliceInfo[] sliceInfo; String[] dnn; - const byte SSC_MODE_UNKNOWN = (-1); + const byte SSC_MODE_UNKNOWN = (-1) /* -1 */; const byte SSC_MODE_1 = 1; const byte SSC_MODE_2 = 2; const byte SSC_MODE_3 = 3; diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/SetupDataCallResult.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/SetupDataCallResult.aidl index 83f9db61acd9e5d8c461b62e45fadc57a7c22b85..6ae626eab71e18dc56ecfc2c7146e56a2c02206e 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/SetupDataCallResult.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/SetupDataCallResult.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.data; +/* @hide */ @JavaDerive(toString=true) @VintfStability parcelable SetupDataCallResult { android.hardware.radio.data.DataCallFailCause cause; diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/SliceInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/SliceInfo.aidl index efe48165ee1634a33769ca73233fa5080f112f42..60df402a8116325a07cc0532e914be0e50de9200 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/SliceInfo.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/SliceInfo.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.data; +/* @hide */ @JavaDerive(toString=true) @VintfStability parcelable SliceInfo { byte sliceServiceType; diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/SlicingConfig.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/SlicingConfig.aidl index b00febebaf19721deb895a8019c9166355a4313c..4d28737134ef0f9e5fae2ad344e2865f5b6400ac 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/SlicingConfig.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/SlicingConfig.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.data; +/* @hide */ @JavaDerive(toString=true) @VintfStability parcelable SlicingConfig { android.hardware.radio.data.UrspRule[] urspRules; diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/TrafficDescriptor.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/TrafficDescriptor.aidl index d7b0654970db166be0692b63a504d252bad98318..dc474a2d1d05f05968a3fb102227740bc531db74 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/TrafficDescriptor.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/TrafficDescriptor.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.data; +/* @hide */ @JavaDerive(toString=true) @VintfStability parcelable TrafficDescriptor { @nullable String dnn; diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/UrspRule.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/UrspRule.aidl index 7002fd118ce44eeb52eef87b8fcfd63ed3ea0015..6850f6a049277ed1c917b3e314a1cd9e69858a0e 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/UrspRule.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/UrspRule.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.data; +/* @hide */ @JavaDerive(toString=true) @VintfStability parcelable UrspRule { int precedence; diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/AmrMode.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/AmrMode.aidl index 37e3b256f387209debff27a514d2fddb41442e12..36a538cdb4e7973b4f67c741ad545547093fff5f 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/AmrMode.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/AmrMode.aidl @@ -32,7 +32,8 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.ims.media; -@Backing(type="int") @VintfStability +/* @hide */ +@Backing(type="int") @JavaDerive(toString=true) @VintfStability enum AmrMode { AMR_MODE_0 = (1 << 0) /* 1 */, AMR_MODE_1 = (1 << 1) /* 2 */, diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/AmrParams.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/AmrParams.aidl index 36edb7f8c42bbc72dc55295690502603cad2b6c3..dcf0dd1775bfbef4ebaa22e731238d753c92dd37 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/AmrParams.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/AmrParams.aidl @@ -32,7 +32,8 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.ims.media; -@VintfStability +/* @hide */ +@JavaDerive(toString=true) @VintfStability parcelable AmrParams { android.hardware.radio.ims.media.AmrMode amrMode; boolean octetAligned; diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/AnbrMode.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/AnbrMode.aidl index c108c07033ae1187c0705c85ddd61da3616f4e0d..eca7b9323ccadbdd9abbb844094fb7a804cee1c3 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/AnbrMode.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/AnbrMode.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.ims.media; +/* @hide */ @JavaDerive(toString=true) @VintfStability parcelable AnbrMode { android.hardware.radio.ims.media.CodecMode anbrUplinkMode; diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/CallQuality.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/CallQuality.aidl index fff6e1c3c21572f9f26beddd91d698e61f9794b7..594a39faee1d9c297b00c0820b78120072dfea32 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/CallQuality.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/CallQuality.aidl @@ -32,7 +32,8 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.ims.media; -@VintfStability +/* @hide */ +@JavaDerive(toString=true) @VintfStability parcelable CallQuality { int downlinkCallQualityLevel; int uplinkCallQualityLevel; diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/CodecMode.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/CodecMode.aidl index 0e9140f02343adf47a0fce43bfc135385eca7034..644321cd3f97c96477019bedadbce83162ba6990 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/CodecMode.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/CodecMode.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.ims.media; +/* @hide */ @JavaDerive(toString=true) @VintfStability union CodecMode { boolean noinit; diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/CodecParams.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/CodecParams.aidl index 3da2dbd9eff676e4d8af88c7d2b743e4ff4a6a1f..6eefb347c4b0a50c87a23f2c1cf04cf6838d410c 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/CodecParams.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/CodecParams.aidl @@ -32,7 +32,8 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.ims.media; -@VintfStability +/* @hide */ +@JavaDerive(toString=true) @VintfStability parcelable CodecParams { android.hardware.radio.ims.media.CodecType codecType; byte rxPayloadTypeNumber; diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/CodecSpecificParams.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/CodecSpecificParams.aidl index 08e3f0f15e4fd4cc7088f8882cd71ff387325342..7e5722f9355f1fe156e5dba583b3fd52aac12f02 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/CodecSpecificParams.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/CodecSpecificParams.aidl @@ -32,7 +32,8 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.ims.media; -@VintfStability +/* @hide */ +@JavaDerive(toString=true) @VintfStability union CodecSpecificParams { android.hardware.radio.ims.media.AmrParams amr; android.hardware.radio.ims.media.EvsParams evs; diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/CodecType.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/CodecType.aidl index e4193cd6a21f5f5204af61773011193a17869559..98463b184b9c84faa3634c709c187e8947845205 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/CodecType.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/CodecType.aidl @@ -32,7 +32,8 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.ims.media; -@Backing(type="int") @VintfStability +/* @hide */ +@Backing(type="int") @JavaDerive(toString=true) @VintfStability enum CodecType { AMR = (1 << 0) /* 1 */, AMR_WB = (1 << 1) /* 2 */, diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/DtmfParams.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/DtmfParams.aidl index 5523fd87ca5e809f26643d40616a9f8dd39e5cf9..f420fa71d27726dca5c32ea8a8ca1b348304e71e 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/DtmfParams.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/DtmfParams.aidl @@ -32,7 +32,8 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.ims.media; -@VintfStability +/* @hide */ +@JavaDerive(toString=true) @VintfStability parcelable DtmfParams { byte rxPayloadTypeNumber; byte txPayloadTypeNumber; diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/EvsBandwidth.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/EvsBandwidth.aidl index db3eb2941af44097c2f4928210d3db79041865b0..d8c77bdccc53d103e0061c2caa05c873931668b5 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/EvsBandwidth.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/EvsBandwidth.aidl @@ -32,7 +32,8 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.ims.media; -@Backing(type="int") @VintfStability +/* @hide */ +@Backing(type="int") @JavaDerive(toString=true) @VintfStability enum EvsBandwidth { NONE = 0, NARROW_BAND = (1 << 0) /* 1 */, diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/EvsMode.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/EvsMode.aidl index fb1f14da3a60584c94e4e49751f59119af610297..1a593890fdc1a3e8137a761bedb6531bd2dfbf6b 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/EvsMode.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/EvsMode.aidl @@ -32,7 +32,8 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.ims.media; -@Backing(type="int") @VintfStability +/* @hide */ +@Backing(type="int") @JavaDerive(toString=true) @VintfStability enum EvsMode { EVS_MODE_0 = (1 << 0) /* 1 */, EVS_MODE_1 = (1 << 1) /* 2 */, diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/EvsParams.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/EvsParams.aidl index 735eb082ab0402f71c14eb690df41e6c232e76f6..deb53af54aa8e5646270f1d3b734ae8e03181312 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/EvsParams.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/EvsParams.aidl @@ -32,7 +32,8 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.ims.media; -@VintfStability +/* @hide */ +@JavaDerive(toString=true) @VintfStability parcelable EvsParams { android.hardware.radio.ims.media.EvsBandwidth bandwidth; android.hardware.radio.ims.media.EvsMode evsMode; diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/IImsMedia.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/IImsMedia.aidl index 30793e5eb233abeb2fb6047f31f1f9dc41911de5..190d25b61c49adf9092ecb5ee9783b96118dfd8b 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/IImsMedia.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/IImsMedia.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.ims.media; +/* @hide */ @VintfStability interface IImsMedia { oneway void setListener(in android.hardware.radio.ims.media.IImsMediaListener mediaListener); diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/IImsMediaListener.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/IImsMediaListener.aidl index 40f7107cdfb510d70eb76432266554e5cf961240..9b7a392eddd0b19e7b6f5e28facfa738372a9158 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/IImsMediaListener.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/IImsMediaListener.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.ims.media; +/* @hide */ @VintfStability interface IImsMediaListener { oneway void onOpenSessionSuccess(int sessionId, android.hardware.radio.ims.media.IImsMediaSession session); diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/IImsMediaSession.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/IImsMediaSession.aidl index ea9f3a4282c828a1cffcbb9736d3fbd272a7cd73..2150fbe0a145f37b49c382bfeef7ed2eb26f060d 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/IImsMediaSession.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/IImsMediaSession.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.ims.media; +/* @hide */ @VintfStability interface IImsMediaSession { oneway void setListener(in android.hardware.radio.ims.media.IImsMediaSessionListener sessionListener); @@ -41,4 +42,6 @@ interface IImsMediaSession { oneway void stopDtmf(); oneway void sendHeaderExtension(in List extensions); oneway void setMediaQualityThreshold(in android.hardware.radio.ims.media.MediaQualityThreshold threshold); + oneway void requestRtpReceptionStats(in int intervalMs); + oneway void adjustDelay(in int delayMs); } diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/IImsMediaSessionListener.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/IImsMediaSessionListener.aidl index cb221df8309c88ad6941d06e3585928356fc1fb5..87474eff3715e7d991ce22171f3cff5d575aa894 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/IImsMediaSessionListener.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/IImsMediaSessionListener.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.ims.media; +/* @hide */ @VintfStability interface IImsMediaSessionListener { oneway void onModifySessionResponse(in android.hardware.radio.ims.media.RtpConfig config, android.hardware.radio.ims.media.RtpError error); @@ -41,4 +42,5 @@ interface IImsMediaSessionListener { oneway void triggerAnbrQuery(in android.hardware.radio.ims.media.RtpConfig config); oneway void onDtmfReceived(char dtmfDigit, int durationMs); oneway void onCallQualityChanged(in android.hardware.radio.ims.media.CallQuality callQuality); + oneway void notifyRtpReceptionStats(in android.hardware.radio.ims.media.RtpReceptionStats stats); } diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/LocalEndPoint.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/LocalEndPoint.aidl index 6ec51569af92d1442b7c39674b510889c1fb86ce..1095f01ea150a77b4ad2260ddaa5a916c4370c5a 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/LocalEndPoint.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/LocalEndPoint.aidl @@ -32,7 +32,8 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.ims.media; -@VintfStability +/* @hide */ +@JavaDerive(toString=true) @VintfStability parcelable LocalEndPoint { ParcelFileDescriptor rtpFd; ParcelFileDescriptor rtcpFd; diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/MediaDirection.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/MediaDirection.aidl index 0e9eaee31bc204576b89e265234c63b5210648a6..5410f2ade061553584ac5ed1a41f6117592d99b4 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/MediaDirection.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/MediaDirection.aidl @@ -32,7 +32,8 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.ims.media; -@Backing(type="int") @VintfStability +/* @hide */ +@Backing(type="int") @JavaDerive(toString=true) @VintfStability enum MediaDirection { NO_FLOW = 0, RTP_TX = (1 << 0) /* 1 */, diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/MediaQualityStatus.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/MediaQualityStatus.aidl index 4accf5315bde67e357d5592e71fb7ecade40d616..da6e751243e8338706d88ded58976d1d749c18d9 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/MediaQualityStatus.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/MediaQualityStatus.aidl @@ -32,7 +32,8 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.ims.media; -@VintfStability +/* @hide */ +@JavaDerive(toString=true) @VintfStability parcelable MediaQualityStatus { int rtpInactivityTimeMillis; int rtcpInactivityTimeMillis; diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/MediaQualityThreshold.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/MediaQualityThreshold.aidl index 31cf3739a70bf4506cb7f187d9721497f3fa04ed..ecc379c0718eb3a20546e6b9dec9e36cc0f942b9 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/MediaQualityThreshold.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/MediaQualityThreshold.aidl @@ -32,7 +32,8 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.ims.media; -@VintfStability +/* @hide */ +@JavaDerive(toString=true) @VintfStability parcelable MediaQualityThreshold { int[] rtpInactivityTimerMillis; int rtcpInactivityTimerMillis; diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtcpConfig.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtcpConfig.aidl index 6a76d85cd857b8f32b4a7c02652647765973379c..0bc41547fac8177d636d05e2ca937df6327a6405 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtcpConfig.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtcpConfig.aidl @@ -32,7 +32,8 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.ims.media; -@VintfStability +/* @hide */ +@JavaDerive(toString=true) @VintfStability parcelable RtcpConfig { String canonicalName; int transmitPort; diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtcpXrReportBlockType.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtcpXrReportBlockType.aidl index 289c810b870ceb241d9056536bca7659b87a775e..714442cce6d2329d7e31b54c9c7735ee4e564a7e 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtcpXrReportBlockType.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtcpXrReportBlockType.aidl @@ -32,7 +32,8 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.ims.media; -@Backing(type="int") @VintfStability +/* @hide */ +@Backing(type="int") @JavaDerive(toString=true) @VintfStability enum RtcpXrReportBlockType { RTCPXR_NONE = 0, RTCPXR_LOSS_RLE_REPORT_BLOCK = (1 << 0) /* 1 */, diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtpAddress.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtpAddress.aidl index 35357d179a4e1e1e94401f2e03d9feffcec6b5e9..dd7f4661f79da6fca7d5e09a5638df22e97bf1b3 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtpAddress.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtpAddress.aidl @@ -32,7 +32,8 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.ims.media; -@VintfStability +/* @hide */ +@JavaDerive(toString=true) @VintfStability parcelable RtpAddress { String ipAddress; int portNumber; diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtpConfig.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtpConfig.aidl index 8a826f6b5fa06a8d38bf13f9bbb66453c52d00ed..472ec35010310993666cb85d2bcd525489c91123 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtpConfig.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtpConfig.aidl @@ -32,7 +32,8 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.ims.media; -@VintfStability +/* @hide */ +@JavaDerive(toString=true) @VintfStability parcelable RtpConfig { int direction; android.hardware.radio.AccessNetwork accessNetwork; diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtpError.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtpError.aidl index 41b0aeb2870600dcfb3644eb3962c7575e215542..97dacf18047f44c5d1fb8a6485c2ac0af2b21024 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtpError.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtpError.aidl @@ -32,7 +32,8 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.ims.media; -@Backing(type="int") @VintfStability +/* @hide */ +@Backing(type="int") @JavaDerive(toString=true) @VintfStability enum RtpError { NONE = 0, INVALID_PARAM = 1, diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtpHeaderExtension.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtpHeaderExtension.aidl index 83b8a314e3380354f7e5f1b330307c12ee3490ca..06207ee4d3720dd216c3914ef0ed3d9f64a18d3c 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtpHeaderExtension.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtpHeaderExtension.aidl @@ -32,7 +32,8 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.ims.media; -@VintfStability +/* @hide */ +@JavaDerive(toString=true) @VintfStability parcelable RtpHeaderExtension { int localId; byte[] data; diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtpReceptionStats.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtpReceptionStats.aidl new file mode 100644 index 0000000000000000000000000000000000000000..82b798b1d294c710d40902fb438d393f1ef39506 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtpReceptionStats.aidl @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/////////////////////////////////////////////////////////////////////////////// +// THIS 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 -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.radio.ims.media; +@VintfStability +parcelable RtpReceptionStats { + int rtpTimestamp; + int rtpSequenceNumber; + int timeDurationMs; + int jitterBufferMs; + int roundTripTimeMs; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtpSessionParams.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtpSessionParams.aidl index 13a7487f737e862d723b96e9925d088559e963ad..4107432676245c0ee6892d2da3d9d0a1aeccd997 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtpSessionParams.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtpSessionParams.aidl @@ -32,7 +32,8 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.ims.media; -@VintfStability +/* @hide */ +@JavaDerive(toString=true) @VintfStability parcelable RtpSessionParams { byte pTimeMillis; int maxPtimeMillis; diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ConnectionFailureInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ConnectionFailureInfo.aidl index 90e75f96e1c959bd506bfb8ebff717429374242d..421f752010f2feeb20b98e08789600bd64f5e31a 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ConnectionFailureInfo.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ConnectionFailureInfo.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.ims; +/* @hide */ @JavaDerive(toString=true) @VintfStability parcelable ConnectionFailureInfo { android.hardware.radio.ims.ConnectionFailureInfo.ConnectionFailureReason failureReason; diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/EpsFallbackReason.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/EpsFallbackReason.aidl index ebea9034ecf9058c011035cc657bbeae7c0271e8..75099e7f1aa4db3ff1d62f56061e621059ebfe74 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/EpsFallbackReason.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/EpsFallbackReason.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.ims; +/* @hide */ @Backing(type="int") @JavaDerive(toString=true) @VintfStability enum EpsFallbackReason { NO_NETWORK_TRIGGER = 1, diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/IRadioIms.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/IRadioIms.aidl index 4df870969dbf6ece93d3f3734a558f710615bb8e..6018a4b9044869a472e51a4f5456cd7c9f916b4b 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/IRadioIms.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/IRadioIms.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.ims; +/* @hide */ @VintfStability interface IRadioIms { oneway void setSrvccCallInfo(int serial, in android.hardware.radio.ims.SrvccCall[] srvccCalls); diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/IRadioImsIndication.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/IRadioImsIndication.aidl index ef6b4cc9ca926853b6b9bc95bd514866981d3835..c754af380607375e7f76c08481383f920d17bb9a 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/IRadioImsIndication.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/IRadioImsIndication.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.ims; +/* @hide */ @VintfStability interface IRadioImsIndication { oneway void onConnectionSetupFailure(in android.hardware.radio.RadioIndicationType type, int token, in android.hardware.radio.ims.ConnectionFailureInfo info); diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/IRadioImsResponse.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/IRadioImsResponse.aidl index 053ba46864807b6aa0bb39a667cdd965e436ed8c..fbb1bfc66cde3cf8d80dc0ec0686b471e2b02c84 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/IRadioImsResponse.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/IRadioImsResponse.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.ims; +/* @hide */ @VintfStability interface IRadioImsResponse { oneway void setSrvccCallInfoResponse(in android.hardware.radio.RadioResponseInfo info); diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsCall.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsCall.aidl index 6e14830012e303ab5a99b4f2918a80d65b6f5c13..3895d75d6ee54fbf9c6782592dc03938210b2de6 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsCall.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsCall.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.ims; +/* @hide */ @JavaDerive(toString=true) @VintfStability parcelable ImsCall { int index; diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsDeregistrationReason.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsDeregistrationReason.aidl index b04e5598c72f4f6462d24b16ff1e2598490f9660..5b5bd405f5d34f697b6676009d5a38bc4fd7c74b 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsDeregistrationReason.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsDeregistrationReason.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.ims; +/* @hide */ @Backing(type="int") @JavaDerive(toString=true) @VintfStability enum ImsDeregistrationReason { REASON_SIM_REMOVED = 1, diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsRegistration.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsRegistration.aidl index be5e0045e38c97dc29cad6ae17383e3a481549a8..66d81650fb6205f8bab170c813111de42fee50a6 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsRegistration.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsRegistration.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.ims; +/* @hide */ @JavaDerive(toString=true) @VintfStability parcelable ImsRegistration { android.hardware.radio.ims.ImsRegistrationState regState; @@ -39,8 +40,8 @@ parcelable ImsRegistration { android.hardware.radio.ims.SuggestedAction suggestedAction; int capabilities; const int IMS_MMTEL_CAPABILITY_NONE = 0; - const int IMS_MMTEL_CAPABILITY_VOICE = (1 << 0); - const int IMS_MMTEL_CAPABILITY_VIDEO = (1 << 1); - const int IMS_MMTEL_CAPABILITY_SMS = (1 << 2); - const int IMS_RCS_CAPABILITIES = (1 << 3); + const int IMS_MMTEL_CAPABILITY_VOICE = (1 << 0) /* 1 */; + const int IMS_MMTEL_CAPABILITY_VIDEO = (1 << 1) /* 2 */; + const int IMS_MMTEL_CAPABILITY_SMS = (1 << 2) /* 4 */; + const int IMS_RCS_CAPABILITIES = (1 << 3) /* 8 */; } diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsRegistrationState.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsRegistrationState.aidl index 6302b4798db19ad6393247932a7bc2b981f823d3..01ae565d79de50484b2632de4f9241678565dda2 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsRegistrationState.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsRegistrationState.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.ims; +/* @hide */ @Backing(type="int") @JavaDerive(toString=true) @VintfStability enum ImsRegistrationState { NOT_REGISTERED, diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsStreamDirection.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsStreamDirection.aidl index cf2e4f1d89092872b882f7831c455a5ccb2f847e..efc35511bc2389eb92eb865c2e0e40648502e385 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsStreamDirection.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsStreamDirection.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.ims; +/* @hide */ @Backing(type="int") @JavaDerive(toString=true) @VintfStability enum ImsStreamDirection { UPLINK = 1, diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsStreamType.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsStreamType.aidl index 10c477f938e71aa60165982c18a3c66c03901cf7..853f4b5c0e25d8747be34f1d9f3d42e93f6b9fcb 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsStreamType.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsStreamType.aidl @@ -32,7 +32,8 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.ims; -@Backing(type="int") @VintfStability +/* @hide */ +@Backing(type="int") @JavaDerive(toString=true) @VintfStability enum ImsStreamType { AUDIO = 1, VIDEO = 2, diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsTrafficType.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsTrafficType.aidl index b1a0b770cde4e2651b8cd2ee2ad02d45a9f87e58..4eeda9db07aeb29967b00026be1225a4f9d6e837 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsTrafficType.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsTrafficType.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.ims; +/* @hide */ @Backing(type="int") @JavaDerive(toString=true) @VintfStability enum ImsTrafficType { EMERGENCY, diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/SrvccCall.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/SrvccCall.aidl index 5119b0ff02a44c02c43610c74916198b0b6e768c..21645dae0ad81a64c30866274b86f1156d2fd572 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/SrvccCall.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/SrvccCall.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.ims; +/* @hide */ @JavaDerive(toString=true) @VintfStability parcelable SrvccCall { int index; diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/SuggestedAction.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/SuggestedAction.aidl index bbe170e4455bbc099d36d06f979fdb858463144c..6dbf09ddc9c759aa602cbedb861ef684f357d604 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/SuggestedAction.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/SuggestedAction.aidl @@ -32,9 +32,12 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.ims; +/* @hide */ @Backing(type="int") @JavaDerive(toString=true) @VintfStability enum SuggestedAction { NONE, TRIGGER_PLMN_BLOCK, TRIGGER_PLMN_BLOCK_WITH_TIMEOUT, + TRIGGER_RAT_BLOCK, + TRIGGER_CLEAR_RAT_BLOCK, } diff --git a/radio/aidl/aidl_api/android.hardware.radio.messaging/current/android/hardware/radio/messaging/CdmaBroadcastSmsConfigInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.messaging/current/android/hardware/radio/messaging/CdmaBroadcastSmsConfigInfo.aidl index 39e2be2f632a46d5b1230e2e4f911fae665c3538..abfb308bf902a40d56c9ced785e4ecdb4e536dcb 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.messaging/current/android/hardware/radio/messaging/CdmaBroadcastSmsConfigInfo.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.messaging/current/android/hardware/radio/messaging/CdmaBroadcastSmsConfigInfo.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.messaging; +/* @hide */ @JavaDerive(toString=true) @VintfStability parcelable CdmaBroadcastSmsConfigInfo { int serviceCategory; diff --git a/radio/aidl/aidl_api/android.hardware.radio.messaging/current/android/hardware/radio/messaging/CdmaSmsAck.aidl b/radio/aidl/aidl_api/android.hardware.radio.messaging/current/android/hardware/radio/messaging/CdmaSmsAck.aidl index befdbdefb624a24ec12b402bf6fe6eaa839d6251..ee8371c6866983a945e5dd74d234443d05d9615c 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.messaging/current/android/hardware/radio/messaging/CdmaSmsAck.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.messaging/current/android/hardware/radio/messaging/CdmaSmsAck.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.messaging; +/* @hide */ @JavaDerive(toString=true) @VintfStability parcelable CdmaSmsAck { boolean errorClass; diff --git a/radio/aidl/aidl_api/android.hardware.radio.messaging/current/android/hardware/radio/messaging/CdmaSmsAddress.aidl b/radio/aidl/aidl_api/android.hardware.radio.messaging/current/android/hardware/radio/messaging/CdmaSmsAddress.aidl index ab29c775dd64e375aedddf00067f97f8aadc9f82..7382b1fd3b0f88e432dfcda49672184dfd148419 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.messaging/current/android/hardware/radio/messaging/CdmaSmsAddress.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.messaging/current/android/hardware/radio/messaging/CdmaSmsAddress.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.messaging; +/* @hide */ @JavaDerive(toString=true) @VintfStability parcelable CdmaSmsAddress { int digitMode; diff --git a/radio/aidl/aidl_api/android.hardware.radio.messaging/current/android/hardware/radio/messaging/CdmaSmsMessage.aidl b/radio/aidl/aidl_api/android.hardware.radio.messaging/current/android/hardware/radio/messaging/CdmaSmsMessage.aidl index 867596c81b59cb09f52579b1f4061d9d873692df..0e98f4b8443a03b455034aa245e70d57d150217f 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.messaging/current/android/hardware/radio/messaging/CdmaSmsMessage.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.messaging/current/android/hardware/radio/messaging/CdmaSmsMessage.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.messaging; +/* @hide */ @JavaDerive(toString=true) @VintfStability parcelable CdmaSmsMessage { int teleserviceId; diff --git a/radio/aidl/aidl_api/android.hardware.radio.messaging/current/android/hardware/radio/messaging/CdmaSmsSubaddress.aidl b/radio/aidl/aidl_api/android.hardware.radio.messaging/current/android/hardware/radio/messaging/CdmaSmsSubaddress.aidl index d67fe8c577ea7dd9619dc58992121dfe955744a3..a0e399191098d44f696541092efa1e0a6534a584 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.messaging/current/android/hardware/radio/messaging/CdmaSmsSubaddress.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.messaging/current/android/hardware/radio/messaging/CdmaSmsSubaddress.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.messaging; +/* @hide */ @JavaDerive(toString=true) @VintfStability parcelable CdmaSmsSubaddress { int subaddressType; diff --git a/radio/aidl/aidl_api/android.hardware.radio.messaging/current/android/hardware/radio/messaging/CdmaSmsWriteArgs.aidl b/radio/aidl/aidl_api/android.hardware.radio.messaging/current/android/hardware/radio/messaging/CdmaSmsWriteArgs.aidl index b0a7f98dc6cec50f4bedf77b43234930e4619393..d6292e7b2e3aadcd76d9cc7a04845e08fefd4309 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.messaging/current/android/hardware/radio/messaging/CdmaSmsWriteArgs.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.messaging/current/android/hardware/radio/messaging/CdmaSmsWriteArgs.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.messaging; +/* @hide */ @JavaDerive(toString=true) @VintfStability parcelable CdmaSmsWriteArgs { int status; diff --git a/radio/aidl/aidl_api/android.hardware.radio.messaging/current/android/hardware/radio/messaging/GsmBroadcastSmsConfigInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.messaging/current/android/hardware/radio/messaging/GsmBroadcastSmsConfigInfo.aidl index 46604cabe636f26c1800af69c5352008b89ed51f..1ccba8614ef22e482252bd002ff3be14d95c7c3c 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.messaging/current/android/hardware/radio/messaging/GsmBroadcastSmsConfigInfo.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.messaging/current/android/hardware/radio/messaging/GsmBroadcastSmsConfigInfo.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.messaging; +/* @hide */ @JavaDerive(toString=true) @VintfStability parcelable GsmBroadcastSmsConfigInfo { int fromServiceId; diff --git a/radio/aidl/aidl_api/android.hardware.radio.messaging/current/android/hardware/radio/messaging/GsmSmsMessage.aidl b/radio/aidl/aidl_api/android.hardware.radio.messaging/current/android/hardware/radio/messaging/GsmSmsMessage.aidl index 4df7fd2508c8e9ed556c5c9eba10e8dd0934054f..bdd7d0c396beaf7e2ff1755a1259977c02ea9e98 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.messaging/current/android/hardware/radio/messaging/GsmSmsMessage.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.messaging/current/android/hardware/radio/messaging/GsmSmsMessage.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.messaging; +/* @hide */ @JavaDerive(toString=true) @VintfStability parcelable GsmSmsMessage { String smscPdu; diff --git a/radio/aidl/aidl_api/android.hardware.radio.messaging/current/android/hardware/radio/messaging/IRadioMessaging.aidl b/radio/aidl/aidl_api/android.hardware.radio.messaging/current/android/hardware/radio/messaging/IRadioMessaging.aidl index dfec59ae45c60f7e0484f524f9d4982c23573a26..bf5fde50454d83e41bc3f778bbcc04057c0a7195 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.messaging/current/android/hardware/radio/messaging/IRadioMessaging.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.messaging/current/android/hardware/radio/messaging/IRadioMessaging.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.messaging; +/* @hide */ @VintfStability interface IRadioMessaging { oneway void acknowledgeIncomingGsmSmsWithPdu(in int serial, in boolean success, in String ackPdu); diff --git a/radio/aidl/aidl_api/android.hardware.radio.messaging/current/android/hardware/radio/messaging/IRadioMessagingIndication.aidl b/radio/aidl/aidl_api/android.hardware.radio.messaging/current/android/hardware/radio/messaging/IRadioMessagingIndication.aidl index 8f7824f515f7601b5d160676ad116d31ccd122fe..389fb2659a3ca880d7a0012c7bc6e3e145c9f325 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.messaging/current/android/hardware/radio/messaging/IRadioMessagingIndication.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.messaging/current/android/hardware/radio/messaging/IRadioMessagingIndication.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.messaging; +/* @hide */ @VintfStability interface IRadioMessagingIndication { oneway void cdmaNewSms(in android.hardware.radio.RadioIndicationType type, in android.hardware.radio.messaging.CdmaSmsMessage msg); diff --git a/radio/aidl/aidl_api/android.hardware.radio.messaging/current/android/hardware/radio/messaging/IRadioMessagingResponse.aidl b/radio/aidl/aidl_api/android.hardware.radio.messaging/current/android/hardware/radio/messaging/IRadioMessagingResponse.aidl index c3af7a684cd5e38999adfaaaa0a84f9d17ca917c..9b1046483767ccbb9ea422881e5c6dd42a69debd 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.messaging/current/android/hardware/radio/messaging/IRadioMessagingResponse.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.messaging/current/android/hardware/radio/messaging/IRadioMessagingResponse.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.messaging; +/* @hide */ @VintfStability interface IRadioMessagingResponse { oneway void acknowledgeIncomingGsmSmsWithPduResponse(in android.hardware.radio.RadioResponseInfo info); diff --git a/radio/aidl/aidl_api/android.hardware.radio.messaging/current/android/hardware/radio/messaging/ImsSmsMessage.aidl b/radio/aidl/aidl_api/android.hardware.radio.messaging/current/android/hardware/radio/messaging/ImsSmsMessage.aidl index 85f62b781d79deb42bf17faa5fa2d01f8e962bf2..40b9ddbb40c4c9a61dc64ed328a227552f85cbe2 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.messaging/current/android/hardware/radio/messaging/ImsSmsMessage.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.messaging/current/android/hardware/radio/messaging/ImsSmsMessage.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.messaging; +/* @hide */ @JavaDerive(toString=true) @VintfStability parcelable ImsSmsMessage { android.hardware.radio.RadioTechnologyFamily tech; diff --git a/radio/aidl/aidl_api/android.hardware.radio.messaging/current/android/hardware/radio/messaging/SendSmsResult.aidl b/radio/aidl/aidl_api/android.hardware.radio.messaging/current/android/hardware/radio/messaging/SendSmsResult.aidl index 32f7a5cb7129fb2cd8768de882259570e003e831..3f1d120a991cd86761e07eed8c2e518a20fbc07f 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.messaging/current/android/hardware/radio/messaging/SendSmsResult.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.messaging/current/android/hardware/radio/messaging/SendSmsResult.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.messaging; +/* @hide */ @JavaDerive(toString=true) @VintfStability parcelable SendSmsResult { int messageRef; diff --git a/radio/aidl/aidl_api/android.hardware.radio.messaging/current/android/hardware/radio/messaging/SmsAcknowledgeFailCause.aidl b/radio/aidl/aidl_api/android.hardware.radio.messaging/current/android/hardware/radio/messaging/SmsAcknowledgeFailCause.aidl index d061c9ea1753bfcdc5df9a9407edf2426bf65732..6aeda3ef4b3546b94ebb4b6d08282a7773682854 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.messaging/current/android/hardware/radio/messaging/SmsAcknowledgeFailCause.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.messaging/current/android/hardware/radio/messaging/SmsAcknowledgeFailCause.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.messaging; +/* @hide */ @Backing(type="int") @JavaDerive(toString=true) @VintfStability enum SmsAcknowledgeFailCause { MEMORY_CAPACITY_EXCEEDED = 0xD3, diff --git a/radio/aidl/aidl_api/android.hardware.radio.messaging/current/android/hardware/radio/messaging/SmsWriteArgs.aidl b/radio/aidl/aidl_api/android.hardware.radio.messaging/current/android/hardware/radio/messaging/SmsWriteArgs.aidl index 489cc07068fd2048cd55109d19a0a578a5d4d32e..a294b477671938d8ba23291418f533241bc390cf 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.messaging/current/android/hardware/radio/messaging/SmsWriteArgs.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.messaging/current/android/hardware/radio/messaging/SmsWriteArgs.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.messaging; +/* @hide */ @JavaDerive(toString=true) @VintfStability parcelable SmsWriteArgs { int status; diff --git a/radio/aidl/aidl_api/android.hardware.radio.modem/current/android/hardware/radio/modem/ActivityStatsInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.modem/current/android/hardware/radio/modem/ActivityStatsInfo.aidl index 7e22ee046e0928c7590cd31b153e3591af346d8b..c834342e751e111cf1aef872dcb3f4ab29ec477c 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.modem/current/android/hardware/radio/modem/ActivityStatsInfo.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.modem/current/android/hardware/radio/modem/ActivityStatsInfo.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.modem; +/* @hide */ @JavaDerive(toString=true) @VintfStability parcelable ActivityStatsInfo { int sleepModeTimeMs; diff --git a/radio/aidl/aidl_api/android.hardware.radio.modem/current/android/hardware/radio/modem/ActivityStatsTechSpecificInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.modem/current/android/hardware/radio/modem/ActivityStatsTechSpecificInfo.aidl index 08ed9a529ede566d025169018c0cb570ab15ab8e..b44ab71e3fd3125107b25491fe35a01bb0c92e5a 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.modem/current/android/hardware/radio/modem/ActivityStatsTechSpecificInfo.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.modem/current/android/hardware/radio/modem/ActivityStatsTechSpecificInfo.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.modem; +/* @hide */ @JavaDerive(toString=true) @VintfStability parcelable ActivityStatsTechSpecificInfo { android.hardware.radio.AccessNetwork rat; diff --git a/radio/aidl/aidl_api/android.hardware.radio.modem/current/android/hardware/radio/modem/DeviceStateType.aidl b/radio/aidl/aidl_api/android.hardware.radio.modem/current/android/hardware/radio/modem/DeviceStateType.aidl index acc0b22bb86ccb8d67dc370e038fc035aee243f3..1159f93b51938e622d0802b24f6b6caa2a92158a 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.modem/current/android/hardware/radio/modem/DeviceStateType.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.modem/current/android/hardware/radio/modem/DeviceStateType.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.modem; +/* @hide */ @Backing(type="int") @JavaDerive(toString=true) @VintfStability enum DeviceStateType { POWER_SAVE_MODE, diff --git a/radio/aidl/aidl_api/android.hardware.radio.modem/current/android/hardware/radio/modem/HardwareConfig.aidl b/radio/aidl/aidl_api/android.hardware.radio.modem/current/android/hardware/radio/modem/HardwareConfig.aidl index 3a0ec2514b0a81b030df8d77f7116b7ec5e4e8a6..2d814efbe24b44c0ec3fdc3bcb9602d62f944bc2 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.modem/current/android/hardware/radio/modem/HardwareConfig.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.modem/current/android/hardware/radio/modem/HardwareConfig.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.modem; +/* @hide */ @JavaDerive(toString=true) @VintfStability parcelable HardwareConfig { int type; diff --git a/radio/aidl/aidl_api/android.hardware.radio.modem/current/android/hardware/radio/modem/HardwareConfigModem.aidl b/radio/aidl/aidl_api/android.hardware.radio.modem/current/android/hardware/radio/modem/HardwareConfigModem.aidl index 62bb160fc4228eccc1b3c7c3c06509adf6452f2f..d453cb01c34971607bb013071f9f047bf01ba721 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.modem/current/android/hardware/radio/modem/HardwareConfigModem.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.modem/current/android/hardware/radio/modem/HardwareConfigModem.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.modem; +/* @hide */ @JavaDerive(toString=true) @VintfStability parcelable HardwareConfigModem { int rilModel; diff --git a/radio/aidl/aidl_api/android.hardware.radio.modem/current/android/hardware/radio/modem/HardwareConfigSim.aidl b/radio/aidl/aidl_api/android.hardware.radio.modem/current/android/hardware/radio/modem/HardwareConfigSim.aidl index 581098297539613f67dd93d75b634c439de59bd1..4c2e31b82a25d4df7fcf066ac2a1e43f2ed7de32 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.modem/current/android/hardware/radio/modem/HardwareConfigSim.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.modem/current/android/hardware/radio/modem/HardwareConfigSim.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.modem; +/* @hide */ @JavaDerive(toString=true) @VintfStability parcelable HardwareConfigSim { String modemUuid; diff --git a/radio/aidl/aidl_api/android.hardware.radio.modem/current/android/hardware/radio/modem/IRadioModem.aidl b/radio/aidl/aidl_api/android.hardware.radio.modem/current/android/hardware/radio/modem/IRadioModem.aidl index 8546be789b2fe34f838421ca3431dda36b5a2ae0..bd8ba4734bbc91c125c87d7ffa5bcc4a9135a1d6 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.modem/current/android/hardware/radio/modem/IRadioModem.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.modem/current/android/hardware/radio/modem/IRadioModem.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.modem; +/* @hide */ @VintfStability interface IRadioModem { oneway void enableModem(in int serial, in boolean on); diff --git a/radio/aidl/aidl_api/android.hardware.radio.modem/current/android/hardware/radio/modem/IRadioModemIndication.aidl b/radio/aidl/aidl_api/android.hardware.radio.modem/current/android/hardware/radio/modem/IRadioModemIndication.aidl index 514ff9a03e760513c7fcba74b89a5586f7e45f61..3c068775875bfe27af5556cd4b8a7ccb6bf970e8 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.modem/current/android/hardware/radio/modem/IRadioModemIndication.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.modem/current/android/hardware/radio/modem/IRadioModemIndication.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.modem; +/* @hide */ @VintfStability interface IRadioModemIndication { oneway void hardwareConfigChanged(in android.hardware.radio.RadioIndicationType type, in android.hardware.radio.modem.HardwareConfig[] configs); @@ -39,4 +40,5 @@ interface IRadioModemIndication { oneway void radioCapabilityIndication(in android.hardware.radio.RadioIndicationType type, in android.hardware.radio.modem.RadioCapability rc); oneway void radioStateChanged(in android.hardware.radio.RadioIndicationType type, in android.hardware.radio.modem.RadioState radioState); oneway void rilConnected(in android.hardware.radio.RadioIndicationType type); + oneway void onImeiMappingChanged(in android.hardware.radio.RadioIndicationType type, in android.hardware.radio.modem.ImeiInfo imeiInfo); } diff --git a/radio/aidl/aidl_api/android.hardware.radio.modem/current/android/hardware/radio/modem/IRadioModemResponse.aidl b/radio/aidl/aidl_api/android.hardware.radio.modem/current/android/hardware/radio/modem/IRadioModemResponse.aidl index 5955439666207653fa30554978ab27716cd58c06..b9ef51b34247e9a65b81a4bb4db35d47027737a9 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.modem/current/android/hardware/radio/modem/IRadioModemResponse.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.modem/current/android/hardware/radio/modem/IRadioModemResponse.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.modem; +/* @hide */ @VintfStability interface IRadioModemResponse { oneway void acknowledgeRequest(in int serial); diff --git a/radio/aidl/aidl_api/android.hardware.radio.modem/current/android/hardware/radio/modem/ImeiInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.modem/current/android/hardware/radio/modem/ImeiInfo.aidl index f8776ec41204bd541d76927522d57111b2904059..a2df30ddfaed61901a288711746daf7d32717665 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.modem/current/android/hardware/radio/modem/ImeiInfo.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.modem/current/android/hardware/radio/modem/ImeiInfo.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.modem; +/* @hide */ @JavaDerive(toString=true) @VintfStability parcelable ImeiInfo { android.hardware.radio.modem.ImeiInfo.ImeiType type; diff --git a/radio/aidl/aidl_api/android.hardware.radio.modem/current/android/hardware/radio/modem/NvItem.aidl b/radio/aidl/aidl_api/android.hardware.radio.modem/current/android/hardware/radio/modem/NvItem.aidl index b80d7acde18af47438a5112cd139355b7e48b46b..f97b9a2017b02dcb260375ca979984d34937a52d 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.modem/current/android/hardware/radio/modem/NvItem.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.modem/current/android/hardware/radio/modem/NvItem.aidl @@ -33,6 +33,7 @@ package android.hardware.radio.modem; /** + * @hide * @deprecated NV APIs are deprecated starting from Android U. */ @Backing(type="int") @JavaDerive(toString=true) @VintfStability diff --git a/radio/aidl/aidl_api/android.hardware.radio.modem/current/android/hardware/radio/modem/NvWriteItem.aidl b/radio/aidl/aidl_api/android.hardware.radio.modem/current/android/hardware/radio/modem/NvWriteItem.aidl index 6a786bc419e03cd4edf6170c0f055b09de6e1a33..c38ceb779aba5c564d2c3a2ca34fae06bc26e2e5 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.modem/current/android/hardware/radio/modem/NvWriteItem.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.modem/current/android/hardware/radio/modem/NvWriteItem.aidl @@ -33,6 +33,7 @@ package android.hardware.radio.modem; /** + * @hide * @deprecated NV APIs are deprecated starting from Android U. */ @JavaDerive(toString=true) @VintfStability diff --git a/radio/aidl/aidl_api/android.hardware.radio.modem/current/android/hardware/radio/modem/RadioCapability.aidl b/radio/aidl/aidl_api/android.hardware.radio.modem/current/android/hardware/radio/modem/RadioCapability.aidl index f2e2858590904dbc43e1c9fde48f747bbbb571f9..bc3cfccde4a6ca1c000f957cc0a0bb2c5f2c1d90 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.modem/current/android/hardware/radio/modem/RadioCapability.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.modem/current/android/hardware/radio/modem/RadioCapability.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.modem; +/* @hide */ @JavaDerive(toString=true) @VintfStability parcelable RadioCapability { int session; diff --git a/radio/aidl/aidl_api/android.hardware.radio.modem/current/android/hardware/radio/modem/RadioState.aidl b/radio/aidl/aidl_api/android.hardware.radio.modem/current/android/hardware/radio/modem/RadioState.aidl index 57f29410c510967dca7533080df713e20fbd8c8a..3383fa4a97cfe464da0385d147743ab8a282bc54 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.modem/current/android/hardware/radio/modem/RadioState.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.modem/current/android/hardware/radio/modem/RadioState.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.modem; +/* @hide */ @Backing(type="int") @JavaDerive(toString=true) @VintfStability enum RadioState { OFF = 0, diff --git a/radio/aidl/aidl_api/android.hardware.radio.modem/current/android/hardware/radio/modem/ResetNvType.aidl b/radio/aidl/aidl_api/android.hardware.radio.modem/current/android/hardware/radio/modem/ResetNvType.aidl index 37622b1312f1c88299eb3c50bf0d89245ac4127e..b4208b77543239f1d7345f02c6fe817e20573e1f 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.modem/current/android/hardware/radio/modem/ResetNvType.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.modem/current/android/hardware/radio/modem/ResetNvType.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.modem; +/* @hide */ @Backing(type="int") @JavaDerive(toString=true) @VintfStability enum ResetNvType { RELOAD, diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/AccessTechnologySpecificInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/AccessTechnologySpecificInfo.aidl index 28d886256d51b06afc071f156a54c171fdf71c2c..667a8a770a8301213de0c4cfc4382ef7301f1a4d 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/AccessTechnologySpecificInfo.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/AccessTechnologySpecificInfo.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.network; +/* @hide */ @JavaDerive(toString=true) @VintfStability union AccessTechnologySpecificInfo { boolean noinit; diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/BarringInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/BarringInfo.aidl index e105b391016d8cb18558e3d94de53a24ad8d156b..67c9349e9e237aa1a6a84caa49e6770c5da932ef 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/BarringInfo.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/BarringInfo.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.network; +/* @hide */ @JavaDerive(toString=true) @VintfStability parcelable BarringInfo { int serviceType; diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/BarringTypeSpecificInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/BarringTypeSpecificInfo.aidl index a81363339e621f2ec67db7c4b2629d1ac01521a5..03369b91d4e32e40d1cc59d56718b31217e363f5 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/BarringTypeSpecificInfo.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/BarringTypeSpecificInfo.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.network; +/* @hide */ @JavaDerive(toString=true) @VintfStability parcelable BarringTypeSpecificInfo { int factor; diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/Cdma2000RegistrationInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/Cdma2000RegistrationInfo.aidl index 927f9ac6955b73968a3069bdd5fc536a197f0b8d..bc9c0baa2414f72c378608254dfb12f6dd9e7940 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/Cdma2000RegistrationInfo.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/Cdma2000RegistrationInfo.aidl @@ -32,13 +32,14 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.network; +/* @hide */ @JavaDerive(toString=true) @VintfStability parcelable Cdma2000RegistrationInfo { boolean cssSupported; int roamingIndicator; int systemIsInPrl; int defaultRoamingIndicator; - const int PRL_INDICATOR_NOT_REGISTERED = (-1); + const int PRL_INDICATOR_NOT_REGISTERED = (-1) /* -1 */; const int PRL_INDICATOR_NOT_IN_PRL = 0; const int PRL_INDICATOR_IN_PRL = 1; } diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/CdmaRoamingType.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/CdmaRoamingType.aidl index 2a4db70cab8f89c751d1a7eab69e920b9afb94c9..84532e3842dd1d263d8e4dbe8591a9edfa126708 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/CdmaRoamingType.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/CdmaRoamingType.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.network; +/* @hide */ @Backing(type="int") @JavaDerive(toString=true) @VintfStability enum CdmaRoamingType { HOME_NETWORK, diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/CdmaSignalStrength.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/CdmaSignalStrength.aidl index e2f97bf98f0c5cb15bf97ee98fc474640d8aebe4..94430a8760799d9199200671117a30fccc8cf1b1 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/CdmaSignalStrength.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/CdmaSignalStrength.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.network; +/* @hide */ @JavaDerive(toString=true) @VintfStability parcelable CdmaSignalStrength { int dbm; diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/CellConnectionStatus.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/CellConnectionStatus.aidl index 5ce3b3e61328a7eb288c7a943e7c37426257bfb7..3775a40e084e8f84dd99eec2110042eb3bb63b64 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/CellConnectionStatus.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/CellConnectionStatus.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.network; +/* @hide */ @Backing(type="int") @JavaDerive(toString=true) @VintfStability enum CellConnectionStatus { NONE, diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/CellIdentity.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/CellIdentity.aidl index 2ee92dee29e66a4486434a401d6bace1be484553..ba27b395275621d9fe385b891e9fbcafb240ec0e 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/CellIdentity.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/CellIdentity.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.network; +/* @hide */ @JavaDerive(toString=true) @VintfStability union CellIdentity { boolean noinit; diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/CellIdentityCdma.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/CellIdentityCdma.aidl index d659a2891cbd318aeecb5221f0b50563a2c604ea..63571bb53356c09116538f421d842ea3ff6cb737 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/CellIdentityCdma.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/CellIdentityCdma.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.network; +/* @hide */ @JavaDerive(toString=true) @VintfStability parcelable CellIdentityCdma { int networkId; diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/CellIdentityGsm.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/CellIdentityGsm.aidl index d3193be0722abaaaf87e0e673ab56038d8ee484e..5040f205b833eff2b54c23edea498c770cd9f452 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/CellIdentityGsm.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/CellIdentityGsm.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.network; +/* @hide */ @JavaDerive(toString=true) @VintfStability parcelable CellIdentityGsm { String mcc; diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/CellIdentityLte.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/CellIdentityLte.aidl index 2ae7b43e2dc32077c040ffeb7809e13aac6389a5..be7821d2d4954ee8f59082af5ddcf9afe2ab502f 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/CellIdentityLte.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/CellIdentityLte.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.network; +/* @hide */ @JavaDerive(toString=true) @VintfStability parcelable CellIdentityLte { String mcc; diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/CellIdentityNr.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/CellIdentityNr.aidl index b30af506d88d44ee9c1910aae7ded537e3e2fe1c..6f4f9a030abcb4d4f459554c83e0832b357ee279 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/CellIdentityNr.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/CellIdentityNr.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.network; +/* @hide */ @JavaDerive(toString=true) @VintfStability parcelable CellIdentityNr { String mcc; diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/CellIdentityTdscdma.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/CellIdentityTdscdma.aidl index e99d14771c802cf71b738230906ae7e7aedad6e1..864a886553811813ddc1d4e02410e780faaea5dc 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/CellIdentityTdscdma.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/CellIdentityTdscdma.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.network; +/* @hide */ @JavaDerive(toString=true) @VintfStability parcelable CellIdentityTdscdma { String mcc; diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/CellIdentityWcdma.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/CellIdentityWcdma.aidl index 12001fcd6798edf18cab11d6236d4b2cb63c3f9e..4e762777b9476334e7ec2f968510c3e23cb574c3 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/CellIdentityWcdma.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/CellIdentityWcdma.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.network; +/* @hide */ @JavaDerive(toString=true) @VintfStability parcelable CellIdentityWcdma { String mcc; diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/CellInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/CellInfo.aidl index 467c6b77ccc45cc95af95f8aedf412206f784ecb..6bb31b027881e7cc660f09623206c3228366b4a5 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/CellInfo.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/CellInfo.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.network; +/* @hide */ @JavaDerive(toString=true) @VintfStability parcelable CellInfo { boolean registered; diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/CellInfoCdma.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/CellInfoCdma.aidl index e3bf46b91890f52096d0dbf3aa8cbbefdf8599b0..6d76a26b82790bbca08fd2213b254f46b1336840 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/CellInfoCdma.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/CellInfoCdma.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.network; +/* @hide */ @JavaDerive(toString=true) @VintfStability parcelable CellInfoCdma { android.hardware.radio.network.CellIdentityCdma cellIdentityCdma; diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/CellInfoGsm.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/CellInfoGsm.aidl index 84dcd07d72927e0bd40c7a1eb4c8f423d3800f01..2074c2fee063e5ef51aca30971beb21d1bf8f87d 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/CellInfoGsm.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/CellInfoGsm.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.network; +/* @hide */ @JavaDerive(toString=true) @VintfStability parcelable CellInfoGsm { android.hardware.radio.network.CellIdentityGsm cellIdentityGsm; diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/CellInfoLte.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/CellInfoLte.aidl index 221340b06a7d0907696b4d686f80ff059d6140e7..aa3b31080b277347aa284db0f930e72d20371821 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/CellInfoLte.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/CellInfoLte.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.network; +/* @hide */ @JavaDerive(toString=true) @VintfStability parcelable CellInfoLte { android.hardware.radio.network.CellIdentityLte cellIdentityLte; diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/CellInfoNr.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/CellInfoNr.aidl index b392c1d2c78f1de0eaa5f4e59c6e41ea0b5f20c2..a8f49afd67e824d94191a41a16777ced796ba726 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/CellInfoNr.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/CellInfoNr.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.network; +/* @hide */ @JavaDerive(toString=true) @VintfStability parcelable CellInfoNr { android.hardware.radio.network.CellIdentityNr cellIdentityNr; diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/CellInfoRatSpecificInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/CellInfoRatSpecificInfo.aidl index 4ab0640b29bc448aa43a8a0c0e0c666b7cd4f470..fd3239dbd81334454e8bc442e94503f523fe0a5b 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/CellInfoRatSpecificInfo.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/CellInfoRatSpecificInfo.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.network; +/* @hide */ @JavaDerive(toString=true) @VintfStability union CellInfoRatSpecificInfo { android.hardware.radio.network.CellInfoGsm gsm; diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/CellInfoTdscdma.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/CellInfoTdscdma.aidl index 138b35ce62d63bb7f752def35acace8828d1acf5..1a03f341d6444d95e0282038e6f1c7f71dbd1fb1 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/CellInfoTdscdma.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/CellInfoTdscdma.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.network; +/* @hide */ @JavaDerive(toString=true) @VintfStability parcelable CellInfoTdscdma { android.hardware.radio.network.CellIdentityTdscdma cellIdentityTdscdma; diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/CellInfoWcdma.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/CellInfoWcdma.aidl index cf7b135c6340b1dbf0ec0afbff65ec28897b2e90..d02824d9a7c45dc560c222bb03a7a054ff24658b 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/CellInfoWcdma.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/CellInfoWcdma.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.network; +/* @hide */ @JavaDerive(toString=true) @VintfStability parcelable CellInfoWcdma { android.hardware.radio.network.CellIdentityWcdma cellIdentityWcdma; diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/CellularIdentifier.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/CellularIdentifier.aidl new file mode 100644 index 0000000000000000000000000000000000000000..d38494f6a15f36a3c4c6179e6a1e7e2641de140a --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/CellularIdentifier.aidl @@ -0,0 +1,42 @@ +/* + * Copyright 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/////////////////////////////////////////////////////////////////////////////// +// THIS 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 -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.radio.network; +/* @hide */ +@Backing(type="int") @JavaDerive(toString=true) @VintfStability +enum CellularIdentifier { + UNKNOWN = 0, + IMSI = 1, + IMEI = 2, + SUCI = 3, +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/CellularIdentifierDisclosure.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/CellularIdentifierDisclosure.aidl new file mode 100644 index 0000000000000000000000000000000000000000..cb542e860c772cf728788f928802a44dcef63cae --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/CellularIdentifierDisclosure.aidl @@ -0,0 +1,42 @@ +/* + * Copyright 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/////////////////////////////////////////////////////////////////////////////// +// THIS 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 -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.radio.network; +/* @hide */ +@JavaDerive(toString=true) @VintfStability +parcelable CellularIdentifierDisclosure { + String plmn; + android.hardware.radio.network.CellularIdentifier identifier; + android.hardware.radio.network.NasProtocolMessage protocolMessage; + boolean isEmergency; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/ClosedSubscriberGroupInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/ClosedSubscriberGroupInfo.aidl index fe734c8f78a25581d41eb401290e29c11243ad79..b9e6f82f1744226d725550647028379110db73cd 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/ClosedSubscriberGroupInfo.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/ClosedSubscriberGroupInfo.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.network; +/* @hide */ @JavaDerive(toString=true) @VintfStability parcelable ClosedSubscriberGroupInfo { boolean csgIndication; diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/ConnectionEvent.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/ConnectionEvent.aidl new file mode 100644 index 0000000000000000000000000000000000000000..eedb8edefa5ba56119c55aa6cb4c220abc793422 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/ConnectionEvent.aidl @@ -0,0 +1,50 @@ +/* + * Copyright 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/////////////////////////////////////////////////////////////////////////////// +// THIS 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 -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.radio.network; +/* @hide */ +@Backing(type="int") @JavaDerive(toString=true) @VintfStability +enum ConnectionEvent { + CS_SIGNALLING_GSM = 0, + PS_SIGNALLING_GPRS = 1, + CS_SIGNALLING_3G = 2, + PS_SIGNALLING_3G = 3, + NAS_SIGNALLING_LTE = 4, + AS_SIGNALLING_LTE = 5, + VOLTE_SIP = 6, + VOLTE_RTP = 7, + NAS_SIGNALLING_5G = 8, + AS_SIGNALLING_5G = 9, + VONR_SIP = 10, + VONR_RTP = 11, +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/Domain.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/Domain.aidl index 6b022b69558983ba71b0a7db959bb7c44f3631d9..0de7e20855616a4a00e7606dd76387c9d1873e24 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/Domain.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/Domain.aidl @@ -32,8 +32,9 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.network; +/* @hide */ @Backing(type="int") @JavaDerive(toString=true) @VintfStability enum Domain { - CS = (1 << 0), - PS = (1 << 1), + CS = (1 << 0) /* 1 */, + PS = (1 << 1) /* 2 */, } diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/EmergencyMode.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/EmergencyMode.aidl index 071e6b5012160a5cefb5c17eac3cdea4f3ca9e3c..c5b067e38b1b30e0b77c322e0f71b0338272b83a 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/EmergencyMode.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/EmergencyMode.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.network; +/* @hide */ @Backing(type="int") @JavaDerive(toString=true) @VintfStability enum EmergencyMode { EMERGENCY_WWAN = 1, diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/EmergencyNetworkScanTrigger.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/EmergencyNetworkScanTrigger.aidl index 2797affc01384c96239e5a13a0a4fb6e9d5012f3..471c7a0a93ca0265acbe2a1f37c0f89b430c915b 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/EmergencyNetworkScanTrigger.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/EmergencyNetworkScanTrigger.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.network; +/* @hide */ @JavaDerive(toString=true) @VintfStability parcelable EmergencyNetworkScanTrigger { android.hardware.radio.AccessNetwork[] accessNetwork; diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/EmergencyRegResult.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/EmergencyRegResult.aidl index 7d99a53c7bd217038c1c92a82333d3e558a48e88..3b8083dacc7851f9aafd9d3b949e4a3d3dfa3912 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/EmergencyRegResult.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/EmergencyRegResult.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.network; +/* @hide */ @JavaDerive(toString=true) @VintfStability parcelable EmergencyRegResult { android.hardware.radio.AccessNetwork accessNetwork; diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/EmergencyScanType.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/EmergencyScanType.aidl index 5e86c76a43441ff55db81630006d2b394e537b43..0681a73005d684ffdce96581191da41dd4b5ec12 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/EmergencyScanType.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/EmergencyScanType.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.network; +/* @hide */ @Backing(type="int") @JavaDerive(toString=true) @VintfStability enum EmergencyScanType { NO_PREFERENCE = 0, diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/EutranBands.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/EutranBands.aidl index 57fac3f5d78c3392597d7ff7677553b412b89ddb..82257ecffe026f3454370b6648258b361328046d 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/EutranBands.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/EutranBands.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.network; +/* @hide */ @Backing(type="int") @JavaDerive(toString=true) @VintfStability enum EutranBands { BAND_1 = 1, diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/EutranRegistrationInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/EutranRegistrationInfo.aidl index 90e342a9b785964a78aa3f7ccce9e765fbe35a7c..bb34fe10d7da78694101946dc47f003560650dab 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/EutranRegistrationInfo.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/EutranRegistrationInfo.aidl @@ -32,14 +32,15 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.network; +/* @hide */ @JavaDerive(toString=true) @VintfStability parcelable EutranRegistrationInfo { android.hardware.radio.network.LteVopsInfo lteVopsInfo; android.hardware.radio.network.NrIndicators nrIndicators; android.hardware.radio.network.EutranRegistrationInfo.AttachResultType lteAttachResultType; int extraInfo; - const int EXTRA_CSFB_NOT_PREFERRED = (1 << 0); - const int EXTRA_SMS_ONLY = (1 << 1); + const int EXTRA_CSFB_NOT_PREFERRED = (1 << 0) /* 1 */; + const int EXTRA_SMS_ONLY = (1 << 1) /* 2 */; enum AttachResultType { NONE, EPS_ONLY, diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/EvdoSignalStrength.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/EvdoSignalStrength.aidl index 7c567119f814247f26339849c3fe5bd32a589495..e97e17dab39091b93add7f89f06754cd4e0abe80 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/EvdoSignalStrength.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/EvdoSignalStrength.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.network; +/* @hide */ @JavaDerive(toString=true) @VintfStability parcelable EvdoSignalStrength { int dbm; diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/GeranBands.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/GeranBands.aidl index 135935ff8f2a056fd7b4a98735e12cdfdc54330d..ee0d4190607165a5f453aafdb7dd9c851e17ec62 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/GeranBands.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/GeranBands.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.network; +/* @hide */ @Backing(type="int") @JavaDerive(toString=true) @VintfStability enum GeranBands { BAND_T380 = 1, diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/GsmSignalStrength.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/GsmSignalStrength.aidl index 2b53b393177bcaf790209cc71d53d7393f6d9173..65847ef93ff24032f4f015a7399227d54e743c50 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/GsmSignalStrength.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/GsmSignalStrength.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.network; +/* @hide */ @JavaDerive(toString=true) @VintfStability parcelable GsmSignalStrength { int signalStrength; diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IRadioNetwork.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IRadioNetwork.aidl index 382ddd846c322b8dd239a265a31e5cce3140fb59..8af617f6fcf3ecec7b056c0c191d50cfaadbca8f 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IRadioNetwork.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IRadioNetwork.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.network; +/* @hide */ @VintfStability interface IRadioNetwork { oneway void getAllowedNetworkTypesBitmap(in int serial); @@ -81,4 +82,8 @@ interface IRadioNetwork { oneway void isNullCipherAndIntegrityEnabled(in int serial); oneway void isN1ModeEnabled(in int serial); oneway void setN1ModeEnabled(in int serial, boolean enable); + oneway void isCellularIdentifierTransparencyEnabled(in int serial); + oneway void setCellularIdentifierTransparencyEnabled(in int serial, in boolean enabled); + oneway void setSecurityAlgorithmsUpdatedEnabled(in int serial, boolean enable); + oneway void isSecurityAlgorithmsUpdatedEnabled(in int serial); } diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IRadioNetworkIndication.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IRadioNetworkIndication.aidl index 0f017ea8baf5e48f7e1eaf53081bacfe4ab3e00b..8eea14f422595caedba233957a163678751bf98b 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IRadioNetworkIndication.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IRadioNetworkIndication.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.network; +/* @hide */ @VintfStability interface IRadioNetworkIndication { oneway void barringInfoChanged(in android.hardware.radio.RadioIndicationType type, in android.hardware.radio.network.CellIdentity cellIdentity, in android.hardware.radio.network.BarringInfo[] barringInfos); @@ -49,4 +50,6 @@ interface IRadioNetworkIndication { oneway void suppSvcNotify(in android.hardware.radio.RadioIndicationType type, in android.hardware.radio.network.SuppSvcNotification suppSvc); oneway void voiceRadioTechChanged(in android.hardware.radio.RadioIndicationType type, in android.hardware.radio.RadioTechnology rat); oneway void emergencyNetworkScanResult(in android.hardware.radio.RadioIndicationType type, in android.hardware.radio.network.EmergencyRegResult result); + oneway void cellularIdentifierDisclosed(in android.hardware.radio.RadioIndicationType type, in android.hardware.radio.network.CellularIdentifierDisclosure disclosure); + oneway void securityAlgorithmsUpdated(in android.hardware.radio.RadioIndicationType type, in android.hardware.radio.network.SecurityAlgorithmUpdate securityAlgorithmUpdate); } diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IRadioNetworkResponse.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IRadioNetworkResponse.aidl index bfe8fa3f67a084c207766e348816a0b4251d7f06..e7f291879aa8de136b9ab234522cfde6187ab8cf 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IRadioNetworkResponse.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IRadioNetworkResponse.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.network; +/* @hide */ @VintfStability interface IRadioNetworkResponse { oneway void acknowledgeRequest(in int serial); @@ -80,4 +81,8 @@ interface IRadioNetworkResponse { oneway void isNullCipherAndIntegrityEnabledResponse(in android.hardware.radio.RadioResponseInfo info, in boolean isEnabled); oneway void isN1ModeEnabledResponse(in android.hardware.radio.RadioResponseInfo info, boolean isEnabled); oneway void setN1ModeEnabledResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void isCellularIdentifierTransparencyEnabledResponse(in android.hardware.radio.RadioResponseInfo info, boolean isEnabled); + oneway void setCellularIdentifierTransparencyEnabledResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void setSecurityAlgorithmsUpdatedEnabledResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void isSecurityAlgorithmsUpdatedEnabledResponse(in android.hardware.radio.RadioResponseInfo info, in boolean isEnabled); } diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IndicationFilter.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IndicationFilter.aidl index 00ba3469c7b6ee1a4ea300aa432f0a1b3cc12ee7..7847fbe4c3f1d91c1f6405875c27e5a249b4b601 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IndicationFilter.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IndicationFilter.aidl @@ -32,15 +32,16 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.network; +/* @hide */ @Backing(type="int") @JavaDerive(toString=true) @VintfStability enum IndicationFilter { NONE = 0, - ALL = (~0), - SIGNAL_STRENGTH = (1 << 0), - FULL_NETWORK_STATE = (1 << 1), - DATA_CALL_DORMANCY_CHANGED = (1 << 2), - LINK_CAPACITY_ESTIMATE = (1 << 3), - PHYSICAL_CHANNEL_CONFIG = (1 << 4), - REGISTRATION_FAILURE = (1 << 5), - BARRING_INFO = (1 << 6), + ALL = (~0) /* -1 */, + SIGNAL_STRENGTH = (1 << 0) /* 1 */, + FULL_NETWORK_STATE = (1 << 1) /* 2 */, + DATA_CALL_DORMANCY_CHANGED = (1 << 2) /* 4 */, + LINK_CAPACITY_ESTIMATE = (1 << 3) /* 8 */, + PHYSICAL_CHANNEL_CONFIG = (1 << 4) /* 16 */, + REGISTRATION_FAILURE = (1 << 5) /* 32 */, + BARRING_INFO = (1 << 6) /* 64 */, } diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/LceDataInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/LceDataInfo.aidl index 27b16c11fb8875b245829753677805fb15bba37c..6dc6d3ecc6b2859e8659ce47f3b051aaf7ffdbe9 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/LceDataInfo.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/LceDataInfo.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.network; +/* @hide */ @JavaDerive(toString=true) @VintfStability parcelable LceDataInfo { int lastHopCapacityKbps; diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/LinkCapacityEstimate.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/LinkCapacityEstimate.aidl index 5707b8e99023870a286c6845bd149e66a77d85d0..3fc4b5c5cd549d1737e99a2599a1aba7eaf4e577 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/LinkCapacityEstimate.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/LinkCapacityEstimate.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.network; +/* @hide */ @JavaDerive(toString=true) @VintfStability parcelable LinkCapacityEstimate { int downlinkCapacityKbps; diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/LteSignalStrength.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/LteSignalStrength.aidl index b5b857930571ff8adaac9643ff4f88160a33e965..eb2ca28e13b57dd13e1ba7410bac6097b9d7f502 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/LteSignalStrength.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/LteSignalStrength.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.network; +/* @hide */ @JavaDerive(toString=true) @VintfStability parcelable LteSignalStrength { int signalStrength; diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/LteVopsInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/LteVopsInfo.aidl index 6d8dd4e83a6a1a5d543f7ab8d5ed56c293ed39aa..f8d3aa19077a924718b94a8f7b66584fad1d82e3 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/LteVopsInfo.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/LteVopsInfo.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.network; +/* @hide */ @JavaDerive(toString=true) @VintfStability parcelable LteVopsInfo { boolean isVopsSupported; diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/NasProtocolMessage.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/NasProtocolMessage.aidl new file mode 100644 index 0000000000000000000000000000000000000000..4fbc802873981a61ef1fed8297595c2ecd707413 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/NasProtocolMessage.aidl @@ -0,0 +1,50 @@ +/* + * Copyright 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/////////////////////////////////////////////////////////////////////////////// +// THIS 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 -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.radio.network; +/* @hide */ +@Backing(type="int") @JavaDerive(toString=true) @VintfStability +enum NasProtocolMessage { + UNKNOWN = 0, + ATTACH_REQUEST = 1, + IDENTITY_RESPONSE = 2, + DETACH_REQUEST = 3, + TRACKING_AREA_UPDATE_REQUEST = 4, + LOCATION_UPDATE_REQUEST = 5, + AUTHENTICATION_AND_CIPHERING_RESPONSE = 6, + REGISTRATION_REQUEST = 7, + DEREGISTRATION_REQUEST = 8, + CM_REESTABLISHMENT_REQUEST = 9, + CM_SERVICE_REQUEST = 10, + IMSI_DETACH_INDICATION = 11, +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/NetworkScanRequest.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/NetworkScanRequest.aidl index 6039740167a3af2a181294d7e67a5877d861614e..60eaf777a1d031d5637a7811f5bd1d940299f501 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/NetworkScanRequest.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/NetworkScanRequest.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.network; +/* @hide */ @JavaDerive(toString=true) @VintfStability parcelable NetworkScanRequest { int type; diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/NetworkScanResult.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/NetworkScanResult.aidl index 4e392d0c5ccfece6d67ec82cddd7be8ad40b2435..695a194485f023e4cd50e4c2f9c56b25641c2639 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/NetworkScanResult.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/NetworkScanResult.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.network; +/* @hide */ @JavaDerive(toString=true) @VintfStability parcelable NetworkScanResult { int status; diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/NgranBands.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/NgranBands.aidl index 590469076a484452ab8f1c81addb5cf18f995a2b..fb939df0727f8849953d6d716a6d45d228f66882 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/NgranBands.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/NgranBands.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.network; +/* @hide */ @Backing(type="int") @JavaDerive(toString=true) @VintfStability enum NgranBands { BAND_1 = 1, diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/NrDualConnectivityState.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/NrDualConnectivityState.aidl index 62c2a56c8d7f11093661147df09ccb3da1caff03..7af15a7ca8219d4ce860060fc89f3192f68987cb 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/NrDualConnectivityState.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/NrDualConnectivityState.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.network; +/* @hide */ @Backing(type="byte") @JavaDerive(toString=true) @VintfStability enum NrDualConnectivityState { ENABLE = 1, diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/NrIndicators.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/NrIndicators.aidl index 88429f6f38e35c566af6fae3571d85a43d529a39..efcd6d3047cad10e4cd8685c4b2a92a35a37c6bf 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/NrIndicators.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/NrIndicators.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.network; +/* @hide */ @JavaDerive(toString=true) @VintfStability parcelable NrIndicators { boolean isEndcAvailable; diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/NrSignalStrength.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/NrSignalStrength.aidl index 7d6ab8234adfb6e2504f1604f8a39bb88e3321d2..11e7356a44d9ff0738b1d6bfcaf61c62d5d3473e 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/NrSignalStrength.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/NrSignalStrength.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.network; +/* @hide */ @JavaDerive(toString=true) @VintfStability parcelable NrSignalStrength { int ssRsrp; diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/NrVopsInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/NrVopsInfo.aidl index e5a0a700ca93d211cc0b577554ead5c5b333b207..61146aa6e21edf5a3debf0f6529193ed56828f26 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/NrVopsInfo.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/NrVopsInfo.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.network; +/* @hide */ @JavaDerive(toString=true) @VintfStability parcelable NrVopsInfo { byte vopsSupported; diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/OperatorInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/OperatorInfo.aidl index 034150e61ffc17b8a1ac5d41f33adc9911827171..abe2bea22325d3339e5f9f1631f8c27e48d145ae 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/OperatorInfo.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/OperatorInfo.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.network; +/* @hide */ @JavaDerive(toString=true) @VintfStability parcelable OperatorInfo { String alphaLong; diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/PhoneRestrictedState.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/PhoneRestrictedState.aidl index 4e3e39eab0dbbe57daa3c9f1bdf83c46b6e19434..44cab0e00075c140cc005f6fc1e73de1e6f41638 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/PhoneRestrictedState.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/PhoneRestrictedState.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.network; +/* @hide */ @Backing(type="int") @JavaDerive(toString=true) @VintfStability enum PhoneRestrictedState { NONE = 0x00, diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/PhysicalChannelConfig.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/PhysicalChannelConfig.aidl index 928c6b728c1ec5024e67987e2078f8718d6d7885..7d64f7e92e375b687cd4ab078eb5563ce98cbeab 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/PhysicalChannelConfig.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/PhysicalChannelConfig.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.network; +/* @hide */ @JavaDerive(toString=true) @VintfStability parcelable PhysicalChannelConfig { android.hardware.radio.network.CellConnectionStatus status; diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/PhysicalChannelConfigBand.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/PhysicalChannelConfigBand.aidl index efc64a69302fbdf8645e77c7da0c57d6c2093e5d..2e50e67627ed26016bc5c726b438ca7f49d854b0 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/PhysicalChannelConfigBand.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/PhysicalChannelConfigBand.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.network; +/* @hide */ @JavaDerive(toString=true) @VintfStability union PhysicalChannelConfigBand { boolean noinit; diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/RadioAccessSpecifier.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/RadioAccessSpecifier.aidl index 1566bb5224e3a57250afa5f7711b684a5f421ab9..82292073591fdd5c91e60fa6223a2d99c0f49c66 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/RadioAccessSpecifier.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/RadioAccessSpecifier.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.network; +/* @hide */ @JavaDerive(toString=true) @VintfStability parcelable RadioAccessSpecifier { android.hardware.radio.AccessNetwork accessNetwork; diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/RadioAccessSpecifierBands.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/RadioAccessSpecifierBands.aidl index a6ac12a28abac2de92da580d7afc585b1195b7d3..9ba420e8917d50c43e23cd4ffaae85e5f6a616ea 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/RadioAccessSpecifierBands.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/RadioAccessSpecifierBands.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.network; +/* @hide */ @JavaDerive(toString=true) @VintfStability union RadioAccessSpecifierBands { boolean noinit; diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/RadioBandMode.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/RadioBandMode.aidl index 74696fbfbf58901470b0bff03b9268e6bb275951..6058e3069680a73c1f84f3dec2b2148c3a6749a7 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/RadioBandMode.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/RadioBandMode.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.network; +/* @hide */ @Backing(type="int") @JavaDerive(toString=true) @VintfStability enum RadioBandMode { BAND_MODE_UNSPECIFIED, diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/RegState.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/RegState.aidl index 711c9ac3a696b6dea48a7c587774cd2f13e04895..f11b91114ca8f73be501d633897d1b650e296a44 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/RegState.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/RegState.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.network; +/* @hide */ @Backing(type="int") @JavaDerive(toString=true) @VintfStability enum RegState { NOT_REG_MT_NOT_SEARCHING_OP = 0, diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/RegStateResult.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/RegStateResult.aidl index f0a03aea4f23cf66049420e1b715ec1002cb2082..625d9702c822768efba697dcd639d9080fbddd3a 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/RegStateResult.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/RegStateResult.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.network; +/* @hide */ @JavaDerive(toString=true) @VintfStability parcelable RegStateResult { android.hardware.radio.network.RegState regState; diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/RegistrationFailCause.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/RegistrationFailCause.aidl index 8acf8ab22d2d47cc70fe7d865cb6881d9f0beb59..56f516d53250e5b06c26b03000a6c33f544ffc1b 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/RegistrationFailCause.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/RegistrationFailCause.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.network; +/* @hide */ @Backing(type="int") @JavaDerive(toString=true) @VintfStability enum RegistrationFailCause { NONE = 0, diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/SecurityAlgorithm.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/SecurityAlgorithm.aidl new file mode 100644 index 0000000000000000000000000000000000000000..166450154c1da6bbadaca8adedb7269270eeb5ca --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/SecurityAlgorithm.aidl @@ -0,0 +1,79 @@ +/* + * Copyright 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/////////////////////////////////////////////////////////////////////////////// +// THIS 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 -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.radio.network; +/* @hide */ +@Backing(type="int") @JavaDerive(toString=true) @VintfStability +enum SecurityAlgorithm { + A50 = 0, + A51 = 1, + A52 = 2, + A53 = 3, + A54 = 4, + GEA0 = 14, + GEA1 = 15, + GEA2 = 16, + GEA3 = 17, + GEA4 = 18, + GEA5 = 19, + UEA0 = 29, + UEA1 = 30, + UEA2 = 31, + EEA0 = 41, + EEA1 = 42, + EEA2 = 43, + EEA3 = 44, + NEA0 = 55, + NEA1 = 56, + NEA2 = 57, + NEA3 = 58, + SIP_NULL = 68, + AES_GCM = 69, + AES_GMAC = 70, + AES_CBC = 71, + DES_EDE3_CBC = 72, + AES_EDE3_CBC = 73, + HMAC_SHA1_96 = 74, + HMAC_SHA1_96_null = 75, + HMAC_MD5_96 = 76, + HMAC_MD5_96_null = 77, + SRTP_AES_COUNTER = 87, + SRTP_AES_F8 = 88, + SRTP_HMAC_SHA1 = 89, + ENCR_AES_GCM_16 = 99, + ENCR_AES_CBC = 100, + AUTH_HMAC_SHA2_256_128 = 101, + UNKNOWN = 113, + OTHER = 114, + ORYX = 124, +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/SecurityAlgorithmUpdate.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/SecurityAlgorithmUpdate.aidl new file mode 100644 index 0000000000000000000000000000000000000000..73ad18083d218b18dfc8bd856a504eafafe0f8df --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/SecurityAlgorithmUpdate.aidl @@ -0,0 +1,42 @@ +/* + * Copyright 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/////////////////////////////////////////////////////////////////////////////// +// THIS 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 -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.radio.network; +/* @hide */ +@JavaDerive(toString=true) @VintfStability +parcelable SecurityAlgorithmUpdate { + android.hardware.radio.network.ConnectionEvent connectionEvent; + android.hardware.radio.network.SecurityAlgorithm encryption; + android.hardware.radio.network.SecurityAlgorithm integrity; + boolean isUnprotectedEmergency; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/SignalStrength.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/SignalStrength.aidl index 1c501909475f1c97e61a914cfa38dff7d2b7fb82..da7db9a2aeba5cf0ce2d12fd6a48b4f7b668eefb 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/SignalStrength.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/SignalStrength.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.network; +/* @hide */ @JavaDerive(toString=true) @VintfStability parcelable SignalStrength { android.hardware.radio.network.GsmSignalStrength gsm; diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/SignalThresholdInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/SignalThresholdInfo.aidl index 744eed7ec5ebe4ac9d1183f1699cf042ffc99f46..77b48313594be3a3ed06b927d3ccf585001c2743 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/SignalThresholdInfo.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/SignalThresholdInfo.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.network; +/* @hide */ @JavaDerive(toString=true) @VintfStability parcelable SignalThresholdInfo { int signalMeasurement; diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/SuppSvcNotification.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/SuppSvcNotification.aidl index b62c71bd37246d241142b2a7900514c108f3aaf8..5192eaea07521c547eb2ed72576103eb5bcb482b 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/SuppSvcNotification.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/SuppSvcNotification.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.network; +/* @hide */ @JavaDerive(toString=true) @VintfStability parcelable SuppSvcNotification { boolean isMT; diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/TdscdmaSignalStrength.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/TdscdmaSignalStrength.aidl index d74c950bde4f80851e45dfa8bc30e5429ce56035..fe209e5c779d3d230cd1d28c62436fb46ce949a5 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/TdscdmaSignalStrength.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/TdscdmaSignalStrength.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.network; +/* @hide */ @JavaDerive(toString=true) @VintfStability parcelable TdscdmaSignalStrength { int signalStrength; diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/UsageSetting.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/UsageSetting.aidl index 3ca16b5eaa840326af2d5b4dc9d27ee191b434cf..a6f4d132ae02ccd7b2c209ab17822348962c262f 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/UsageSetting.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/UsageSetting.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.network; +/* @hide */ @Backing(type="int") @JavaDerive(toString=true) @VintfStability enum UsageSetting { VOICE_CENTRIC = 1, diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/UtranBands.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/UtranBands.aidl index 8be3da28f3ab4423702be6aac8a13bb93f667d68..977afe3d98a0bd8ad3b10b2cfce9c17b750fd321 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/UtranBands.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/UtranBands.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.network; +/* @hide */ @Backing(type="int") @JavaDerive(toString=true) @VintfStability enum UtranBands { BAND_1 = 1, diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/WcdmaSignalStrength.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/WcdmaSignalStrength.aidl index 91125271d25a4e16437fe227319119d9fce19d20..b765ab6ddc6fdff7c482fae42c1fb7d86dd5c7e4 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/WcdmaSignalStrength.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/WcdmaSignalStrength.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.network; +/* @hide */ @JavaDerive(toString=true) @VintfStability parcelable WcdmaSignalStrength { int signalStrength; diff --git a/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/AppStatus.aidl b/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/AppStatus.aidl index 8a41fb9d9028eaf9fb1bf8395c0ebd4583212332..898b616a2c771a57da631c1bb622485f5d2834a5 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/AppStatus.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/AppStatus.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.sim; +/* @hide */ @JavaDerive(toString=true) @VintfStability parcelable AppStatus { int appType; diff --git a/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/CardPowerState.aidl b/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/CardPowerState.aidl index 6bc3919fb2c590838e2bc4a264577e95560f0a0e..066777aa5f2bc07a954ce5021ed41cc8d59372f7 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/CardPowerState.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/CardPowerState.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.sim; +/* @hide */ @Backing(type="int") @JavaDerive(toString=true) @VintfStability enum CardPowerState { POWER_DOWN, diff --git a/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/CardStatus.aidl b/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/CardStatus.aidl index 46cb7becb22868082dd6dff86152aa85fdd764fe..1a9d6213903bfea8abc1d93508e2ded76224e487 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/CardStatus.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/CardStatus.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.sim; +/* @hide */ @JavaDerive(toString=true) @VintfStability parcelable CardStatus { int cardState; diff --git a/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/Carrier.aidl b/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/Carrier.aidl index cc56888f3147ea22326da9270a9159af7b90b89b..24fff2ee7c4dcd4b49aa08b98f8d76964bbff9c8 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/Carrier.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/Carrier.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.sim; +/* @hide */ @JavaDerive(toString=true) @VintfStability parcelable Carrier { String mcc; diff --git a/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/CarrierInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/CarrierInfo.aidl new file mode 100644 index 0000000000000000000000000000000000000000..5838959fb5c79ce677568d80a910a3ed528e5746 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/CarrierInfo.aidl @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/////////////////////////////////////////////////////////////////////////////// +// THIS 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 -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.radio.sim; +/* @hide */ +@JavaDerive(toString=true) @VintfStability +parcelable CarrierInfo { + String mcc; + String mnc; + @nullable String spn; + @nullable String gid1; + @nullable String gid2; + @nullable String imsiPrefix; + @nullable List ephlmn; + @nullable String iccid; + @nullable String impi; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/CarrierRestrictions.aidl b/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/CarrierRestrictions.aidl index 3700de314348e15b29a874c7cc6d76ee037c85f1..a5b8dc96f6439211c7c39d6be2398c436485dfba 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/CarrierRestrictions.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/CarrierRestrictions.aidl @@ -32,12 +32,21 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.sim; +/* @hide */ @JavaDerive(toString=true) @VintfStability parcelable CarrierRestrictions { + /** + * @deprecated use @List allowedCarrierInfoList + */ android.hardware.radio.sim.Carrier[] allowedCarriers; + /** + * @deprecated use @List excludedCarrierInfoList + */ android.hardware.radio.sim.Carrier[] excludedCarriers; boolean allowedCarriersPrioritized; android.hardware.radio.sim.CarrierRestrictions.CarrierRestrictionStatus status; + android.hardware.radio.sim.CarrierInfo[] allowedCarrierInfoList = {}; + android.hardware.radio.sim.CarrierInfo[] excludedCarrierInfoList = {}; @Backing(type="int") @VintfStability enum CarrierRestrictionStatus { UNKNOWN = 0, diff --git a/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/CdmaSubscriptionSource.aidl b/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/CdmaSubscriptionSource.aidl index 080aa5ed2753474c7e480d9ad654976af10be166..13b06e7fdb3e66bd522c5a66703ea20cc40bb7b5 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/CdmaSubscriptionSource.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/CdmaSubscriptionSource.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.sim; +/* @hide */ @Backing(type="int") @JavaDerive(toString=true) @VintfStability enum CdmaSubscriptionSource { RUIM_SIM, diff --git a/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/IRadioSim.aidl b/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/IRadioSim.aidl index 901b2519f6e4ee431c1ba308ce014bfe630232c2..1728e410105a7632294801f6b8f707f07ffd5ece 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/IRadioSim.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/IRadioSim.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.sim; +/* @hide */ @VintfStability interface IRadioSim { oneway void areUiccApplicationsEnabled(in int serial); diff --git a/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/IRadioSimIndication.aidl b/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/IRadioSimIndication.aidl index d4371b8e69619efa4482f3a56803108cc9c34eff..a74b65acad1b187dc702a0803acc48a4791d3509 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/IRadioSimIndication.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/IRadioSimIndication.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.sim; +/* @hide */ @VintfStability interface IRadioSimIndication { oneway void carrierInfoForImsiEncryption(in android.hardware.radio.RadioIndicationType info); diff --git a/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/IRadioSimResponse.aidl b/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/IRadioSimResponse.aidl index d7c2100fd6f0a86888c3e032798c7ccdd694bd72..c653847706f68f1f03ae12d097ab4bc4045b5df0 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/IRadioSimResponse.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/IRadioSimResponse.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.sim; +/* @hide */ @VintfStability interface IRadioSimResponse { oneway void acknowledgeRequest(in int serial); diff --git a/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/IccIo.aidl b/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/IccIo.aidl index 5a312dc4fd15b1c30e08e895666d6f817be82fe6..661518d2eb0ad72e5c3e6c0a287abf9329dc3c99 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/IccIo.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/IccIo.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.sim; +/* @hide */ @JavaDerive(toString=true) @VintfStability parcelable IccIo { int command; diff --git a/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/IccIoResult.aidl b/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/IccIoResult.aidl index 6c6bde2012d9d6723e69522db000282280b2ac96..1e418cd2abb7ab4be0ba403b6926981c361368a3 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/IccIoResult.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/IccIoResult.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.sim; +/* @hide */ @JavaDerive(toString=true) @VintfStability parcelable IccIoResult { int sw1; diff --git a/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/ImsiEncryptionInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/ImsiEncryptionInfo.aidl index 05e71cd1025cd6421dc88da0f7b1d52fd95b4b1b..40722e5f799b0051828602f16b68e9c057db3b24 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/ImsiEncryptionInfo.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/ImsiEncryptionInfo.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.sim; +/* @hide */ @JavaDerive(toString=true) @VintfStability parcelable ImsiEncryptionInfo { String mcc; diff --git a/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/PbReceivedStatus.aidl b/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/PbReceivedStatus.aidl index 5e96fc6f22bef11e5362f353a16f013a426db741..aaf9f3eb50e4b29f3191ea5d7f7562ec07037e1c 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/PbReceivedStatus.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/PbReceivedStatus.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.sim; +/* @hide */ @Backing(type="byte") @JavaDerive(toString=true) @VintfStability enum PbReceivedStatus { PB_RECEIVED_OK = 1, diff --git a/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/PersoSubstate.aidl b/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/PersoSubstate.aidl index dc1d960631762eafcbd92fda253b8eabd9fd3260..795230892c9c8563ecf7d5acac73786de6b0d099 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/PersoSubstate.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/PersoSubstate.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.sim; +/* @hide */ @Backing(type="int") @JavaDerive(toString=true) @VintfStability enum PersoSubstate { UNKNOWN, diff --git a/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/PhonebookCapacity.aidl b/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/PhonebookCapacity.aidl index 7531c9638a38de6142f6fca38b5b6de385d737d6..b02068712ec5878e548e774689d76f77c6b3d664 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/PhonebookCapacity.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/PhonebookCapacity.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.sim; +/* @hide */ @JavaDerive(toString=true) @VintfStability parcelable PhonebookCapacity { int maxAdnRecords; diff --git a/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/PhonebookRecordInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/PhonebookRecordInfo.aidl index 2e96a4bf549da7155124160ae37e284ada6400d1..1a6943bd536022512c952c2aeb997087b63131af 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/PhonebookRecordInfo.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/PhonebookRecordInfo.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.sim; +/* @hide */ @JavaDerive(toString=true) @VintfStability parcelable PhonebookRecordInfo { int recordId; diff --git a/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/PinState.aidl b/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/PinState.aidl index 663ea734bfc70e96979589c7bb1bc2597dcbec78..924929b450100ef5505613f576e4bc7ba69c35bc 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/PinState.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/PinState.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.sim; +/* @hide */ @Backing(type="int") @JavaDerive(toString=true) @VintfStability enum PinState { UNKNOWN, diff --git a/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/Plmn.aidl b/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/Plmn.aidl new file mode 100644 index 0000000000000000000000000000000000000000..b29a4a76bdf168d85f25435ebd0b97a728f3cc6f --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/Plmn.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/////////////////////////////////////////////////////////////////////////////// +// THIS 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 -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.radio.sim; +/* @hide */ +@JavaDerive(toString=true) @VintfStability +parcelable Plmn { + String mcc; + String mnc; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/SelectUiccSub.aidl b/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/SelectUiccSub.aidl index 02121e632c9e154889b4e43dd40a34177722161c..57ca2a5b14608a413498587d3b58df283411e3e3 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/SelectUiccSub.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/SelectUiccSub.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.sim; +/* @hide */ @JavaDerive(toString=true) @VintfStability parcelable SelectUiccSub { int slot; diff --git a/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/SessionInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/SessionInfo.aidl index 1329141f220f4f926cdfb06513e26355ff6d5fc7..5c81e3d77ad94b3520af5bbcfe81af69929e4dc4 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/SessionInfo.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/SessionInfo.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.sim; +/* @hide */ @JavaDerive(toString=true) @VintfStability parcelable SessionInfo { int sessionId; diff --git a/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/SimApdu.aidl b/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/SimApdu.aidl index c391e5af341e83fdcf446497072e0c20b30ea3a3..45f6e48168b053d20011b873d8dc40bcb8137f39 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/SimApdu.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/SimApdu.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.sim; +/* @hide */ @JavaDerive(toString=true) @VintfStability parcelable SimApdu { int sessionId; diff --git a/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/SimLockMultiSimPolicy.aidl b/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/SimLockMultiSimPolicy.aidl index d59fcab8863e8aab9b4c22808dcdbf2895b82328..8cfe417c2657b71a54934495bcabfa8654cede9d 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/SimLockMultiSimPolicy.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/SimLockMultiSimPolicy.aidl @@ -32,8 +32,16 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.sim; +/* @hide */ @Backing(type="int") @JavaDerive(toString=true) @VintfStability enum SimLockMultiSimPolicy { NO_MULTISIM_POLICY, ONE_VALID_SIM_MUST_BE_PRESENT, + APPLY_TO_ALL_SLOTS, + APPLY_TO_ONLY_SLOT_1, + VALID_SIM_MUST_PRESENT_ON_SLOT_1, + ACTIVE_SERVICE_ON_SLOT_1_TO_UNBLOCK_OTHER_SLOTS, + ACTIVE_SERVICE_ON_ANY_SLOT_TO_UNBLOCK_OTHER_SLOTS, + ALL_SIMS_MUST_BE_VALID, + SLOT_POLICY_OTHER, } diff --git a/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/SimRefreshResult.aidl b/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/SimRefreshResult.aidl index 69bf4767d37bd6057fd9f8dee35f290f3c4b7847..81ba510c2f63d2123c43a6f966ffb908229290f0 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/SimRefreshResult.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/SimRefreshResult.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.sim; +/* @hide */ @JavaDerive(toString=true) @VintfStability parcelable SimRefreshResult { int type; diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/AudioQuality.aidl b/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/AudioQuality.aidl index 1ab29029b90bca51178b853a79794104e5d28661..8725c7fb5daf91a929332c83af4c74a90a71d8ce 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/AudioQuality.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/AudioQuality.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.voice; +/* @hide */ @Backing(type="int") @JavaDerive(toString=true) @VintfStability enum AudioQuality { UNSPECIFIED, diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/Call.aidl b/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/Call.aidl index 10d2ee751b8fe67b13cc7609dbaf9d1342b121ab..b45a45b110640f367d980c8187522a5a5204c515 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/Call.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/Call.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.voice; +/* @hide */ @JavaDerive(toString=true) @VintfStability parcelable Call { int state; diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/CallForwardInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/CallForwardInfo.aidl index 8e7aaab565b4b49fa7baec3757fae2037b3ba85a..51c87584efca01d900eb18c252b398c6a9625448 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/CallForwardInfo.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/CallForwardInfo.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.voice; +/* @hide */ @JavaDerive(toString=true) @VintfStability parcelable CallForwardInfo { int status; diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/CdmaCallWaiting.aidl b/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/CdmaCallWaiting.aidl index 310f9a0fac459fa803ce05c52224fb2d93dcbf4b..0b36be4ebadf6ee752bcf5e1e9099923b5b5c77e 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/CdmaCallWaiting.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/CdmaCallWaiting.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.voice; +/* @hide */ @JavaDerive(toString=true) @VintfStability parcelable CdmaCallWaiting { String number; diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/CdmaDisplayInfoRecord.aidl b/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/CdmaDisplayInfoRecord.aidl index b6b562c028a2a2a27bb38665a189e5d789441edd..300b03f6dae6e7e94d9ef57aec1d85e5e0eab1c8 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/CdmaDisplayInfoRecord.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/CdmaDisplayInfoRecord.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.voice; +/* @hide */ @JavaDerive(toString=true) @VintfStability parcelable CdmaDisplayInfoRecord { String alphaBuf; diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/CdmaInformationRecord.aidl b/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/CdmaInformationRecord.aidl index 24ae7754790d4319d4560943e3c6d274eddd85cc..2f7f5f05c9504a853db39f58c06c9bb795e894d5 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/CdmaInformationRecord.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/CdmaInformationRecord.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.voice; +/* @hide */ @JavaDerive(toString=true) @VintfStability parcelable CdmaInformationRecord { int name; diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/CdmaLineControlInfoRecord.aidl b/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/CdmaLineControlInfoRecord.aidl index e34b3937b4f7d1d80840d5d5f9e109ec964defe3..4e4a7ee7b761d7d7ecb8c0378c427553e4b9ba5f 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/CdmaLineControlInfoRecord.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/CdmaLineControlInfoRecord.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.voice; +/* @hide */ @JavaDerive(toString=true) @VintfStability parcelable CdmaLineControlInfoRecord { byte lineCtrlPolarityIncluded; diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/CdmaNumberInfoRecord.aidl b/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/CdmaNumberInfoRecord.aidl index aeb0347d67b3f75714d4bb61e605184b13ad105e..c3b0d5a4426965ad4bf20832649da0a060ee0688 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/CdmaNumberInfoRecord.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/CdmaNumberInfoRecord.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.voice; +/* @hide */ @JavaDerive(toString=true) @VintfStability parcelable CdmaNumberInfoRecord { String number; diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/CdmaOtaProvisionStatus.aidl b/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/CdmaOtaProvisionStatus.aidl index fad384172b240f9d149620cacf30b917b82e710b..ae35fbad526f2a41bb550f43420470e0c85d2659 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/CdmaOtaProvisionStatus.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/CdmaOtaProvisionStatus.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.voice; +/* @hide */ @Backing(type="int") @JavaDerive(toString=true) @VintfStability enum CdmaOtaProvisionStatus { SPL_UNLOCKED, diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/CdmaRedirectingNumberInfoRecord.aidl b/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/CdmaRedirectingNumberInfoRecord.aidl index b61b91b34f7cb14dc656b484b0c905ad8c51278c..93c7c6b06531359652bc13ae3f803aa99dbca995 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/CdmaRedirectingNumberInfoRecord.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/CdmaRedirectingNumberInfoRecord.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.voice; +/* @hide */ @JavaDerive(toString=true) @VintfStability parcelable CdmaRedirectingNumberInfoRecord { android.hardware.radio.voice.CdmaNumberInfoRecord redirectingNumber; diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/CdmaSignalInfoRecord.aidl b/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/CdmaSignalInfoRecord.aidl index 6c7b264476753069b25f941d950a6c6a55b13310..69447b433a7f12d0a330d4fa6e6164f2ced5c9fb 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/CdmaSignalInfoRecord.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/CdmaSignalInfoRecord.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.voice; +/* @hide */ @JavaDerive(toString=true) @VintfStability parcelable CdmaSignalInfoRecord { boolean isPresent; diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/CdmaT53AudioControlInfoRecord.aidl b/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/CdmaT53AudioControlInfoRecord.aidl index 438231cbad6686a96bacea7c1827784d16b1e6b3..69d79aa43ba5a12f746b2cd0e1d463d8950befee 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/CdmaT53AudioControlInfoRecord.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/CdmaT53AudioControlInfoRecord.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.voice; +/* @hide */ @JavaDerive(toString=true) @VintfStability parcelable CdmaT53AudioControlInfoRecord { byte upLink; diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/CdmaT53ClirInfoRecord.aidl b/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/CdmaT53ClirInfoRecord.aidl index 1b254f56a0e2513820405b071d3a257d55be1563..83b6fb9af7691238985cc564ff14a9a27d6d484e 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/CdmaT53ClirInfoRecord.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/CdmaT53ClirInfoRecord.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.voice; +/* @hide */ @JavaDerive(toString=true) @VintfStability parcelable CdmaT53ClirInfoRecord { byte cause; diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/CfData.aidl b/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/CfData.aidl index 7e799c7b036846bbf267c52adc827af9838b6ee6..fc811f2d73cbdb00f3a620ed46e3fa84bc0e2f42 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/CfData.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/CfData.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.voice; +/* @hide */ @JavaDerive(toString=true) @VintfStability parcelable CfData { android.hardware.radio.voice.CallForwardInfo[] cfInfo; diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/ClipStatus.aidl b/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/ClipStatus.aidl index a34149ad1baa97124a9abd4e0237bb530504976c..c38c8012fb5ffbc11e7f515ebf451b8d2fde5cac 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/ClipStatus.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/ClipStatus.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.voice; +/* @hide */ @Backing(type="int") @JavaDerive(toString=true) @VintfStability enum ClipStatus { CLIP_PROVISIONED, diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/Dial.aidl b/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/Dial.aidl index 2b2e7590bcd0bb45e2516a9c2ae450d744e6eae1..26041f0620a740fbe8c22ae04445e6c9c00d9529 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/Dial.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/Dial.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.voice; +/* @hide */ @JavaDerive(toString=true) @VintfStability parcelable Dial { String address; diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/EmergencyCallRouting.aidl b/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/EmergencyCallRouting.aidl index 4e1dfc09fad4c7f2d937002f678d8d2e491df41b..3099a206265f7ce6be56054f9645b7b8d56b62cd 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/EmergencyCallRouting.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/EmergencyCallRouting.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.voice; +/* @hide */ @Backing(type="int") @JavaDerive(toString=true) @VintfStability enum EmergencyCallRouting { UNKNOWN, diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/EmergencyNumber.aidl b/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/EmergencyNumber.aidl index ac3867e72e15e37a7e74c721490e6c1cd6596cb8..2129f397e0af90989aa59ea77d31213330d785ed 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/EmergencyNumber.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/EmergencyNumber.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.voice; +/* @hide */ @JavaDerive(toString=true) @VintfStability parcelable EmergencyNumber { String number; @@ -40,8 +41,8 @@ parcelable EmergencyNumber { int categories; String[] urns; int sources; - const int SOURCE_NETWORK_SIGNALING = (1 << 0); - const int SOURCE_SIM = (1 << 1); - const int SOURCE_MODEM_CONFIG = (1 << 2); - const int SOURCE_DEFAULT = (1 << 3); + const int SOURCE_NETWORK_SIGNALING = (1 << 0) /* 1 */; + const int SOURCE_SIM = (1 << 1) /* 2 */; + const int SOURCE_MODEM_CONFIG = (1 << 2) /* 4 */; + const int SOURCE_DEFAULT = (1 << 3) /* 8 */; } diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/EmergencyServiceCategory.aidl b/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/EmergencyServiceCategory.aidl index 0a70d2de950f20e002c4c34ddb472f464577ceda..819baf89f1844393ce7f779f4e17a65715d77515 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/EmergencyServiceCategory.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/EmergencyServiceCategory.aidl @@ -32,14 +32,15 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.voice; +/* @hide */ @Backing(type="int") @JavaDerive(toString=true) @VintfStability enum EmergencyServiceCategory { UNSPECIFIED = 0, - POLICE = (1 << 0), - AMBULANCE = (1 << 1), - FIRE_BRIGADE = (1 << 2), - MARINE_GUARD = (1 << 3), - MOUNTAIN_RESCUE = (1 << 4), - MIEC = (1 << 5), - AIEC = (1 << 6), + POLICE = (1 << 0) /* 1 */, + AMBULANCE = (1 << 1) /* 2 */, + FIRE_BRIGADE = (1 << 2) /* 4 */, + MARINE_GUARD = (1 << 3) /* 8 */, + MOUNTAIN_RESCUE = (1 << 4) /* 16 */, + MIEC = (1 << 5) /* 32 */, + AIEC = (1 << 6) /* 64 */, } diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/IRadioVoice.aidl b/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/IRadioVoice.aidl index 603b1d67aafac0852b8c3a734f05820ca207fac9..d0a9451a3668f31d68b4c31b3921226f7b3571f0 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/IRadioVoice.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/IRadioVoice.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.voice; +/* @hide */ @VintfStability interface IRadioVoice { oneway void acceptCall(in int serial); diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/IRadioVoiceIndication.aidl b/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/IRadioVoiceIndication.aidl index 189ed43cf959da9f8d7747d10f98cc26c66df524..4614ee1b391a3db6fc92ef9ba9bd772f2eb29153 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/IRadioVoiceIndication.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/IRadioVoiceIndication.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.voice; +/* @hide */ @VintfStability interface IRadioVoiceIndication { oneway void callRing(in android.hardware.radio.RadioIndicationType type, in boolean isGsm, in android.hardware.radio.voice.CdmaSignalInfoRecord record); diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/IRadioVoiceResponse.aidl b/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/IRadioVoiceResponse.aidl index 7acc0446ddc6566ac26df6730a3fc7d8e454b4f5..46927c2f819848f93e1f4b3ce0b83f7ba8ff57a8 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/IRadioVoiceResponse.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/IRadioVoiceResponse.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.voice; +/* @hide */ @VintfStability interface IRadioVoiceResponse { oneway void acceptCallResponse(in android.hardware.radio.RadioResponseInfo info); diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/LastCallFailCause.aidl b/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/LastCallFailCause.aidl index 7d546233f17cc8cd216b7e84ff93f026a17ea81d..0cac135621321c28105e8b421dd5f6c2a43595fa 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/LastCallFailCause.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/LastCallFailCause.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.voice; +/* @hide */ @Backing(type="int") @JavaDerive(toString=true) @VintfStability enum LastCallFailCause { UNOBTAINABLE_NUMBER = 1, diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/LastCallFailCauseInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/LastCallFailCauseInfo.aidl index 221acf73069a41f93ae81e97eff23936802aa90c..151adf21d6836c63f4d83deebbdd3ea80c915d7f 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/LastCallFailCauseInfo.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/LastCallFailCauseInfo.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.voice; +/* @hide */ @JavaDerive(toString=true) @VintfStability parcelable LastCallFailCauseInfo { android.hardware.radio.voice.LastCallFailCause causeCode; diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/SrvccState.aidl b/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/SrvccState.aidl index 4b5c216081374b7f533f0873659ac241ad1eeebc..981ba025bed4c7ff40e18dd2d34f9769b025e0ea 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/SrvccState.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/SrvccState.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.voice; +/* @hide */ @Backing(type="int") @JavaDerive(toString=true) @VintfStability enum SrvccState { HANDOVER_STARTED, diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/SsInfoData.aidl b/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/SsInfoData.aidl index f18b404605a98df106cbeae1f23e17be0360495e..24365dc23302889494bafdaf2a0d83b38a7ab919 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/SsInfoData.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/SsInfoData.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.voice; +/* @hide */ @JavaDerive(toString=true) @VintfStability parcelable SsInfoData { int[] ssInfo; diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/StkCcUnsolSsResult.aidl b/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/StkCcUnsolSsResult.aidl index 75f3de549512c2a6f66f717624db2a04a4d74830..999f47c8d4636becd2b67c0a4b0dad5699d337cb 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/StkCcUnsolSsResult.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/StkCcUnsolSsResult.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.voice; +/* @hide */ @JavaDerive(toString=true) @VintfStability parcelable StkCcUnsolSsResult { int serviceType; @@ -72,13 +73,13 @@ parcelable StkCcUnsolSsResult { const int TELESERVICE_TYPE_SMS_SERVICES = 4; const int TELESERVICE_TYPE_ALL_TELESERVICES_EXCEPT_SMS = 5; const int SUPP_SERVICE_CLASS_NONE = 0; - const int SUPP_SERVICE_CLASS_VOICE = (1 << 0); - const int SUPP_SERVICE_CLASS_DATA = (1 << 1); - const int SUPP_SERVICE_CLASS_FAX = (1 << 2); - const int SUPP_SERVICE_CLASS_SMS = (1 << 3); - const int SUPP_SERVICE_CLASS_DATA_SYNC = (1 << 4); - const int SUPP_SERVICE_CLASS_DATA_ASYNC = (1 << 5); - const int SUPP_SERVICE_CLASS_PACKET = (1 << 6); - const int SUPP_SERVICE_CLASS_PAD = (1 << 7); - const int SUPP_SERVICE_CLASS_MAX = (1 << 7); + const int SUPP_SERVICE_CLASS_VOICE = (1 << 0) /* 1 */; + const int SUPP_SERVICE_CLASS_DATA = (1 << 1) /* 2 */; + const int SUPP_SERVICE_CLASS_FAX = (1 << 2) /* 4 */; + const int SUPP_SERVICE_CLASS_SMS = (1 << 3) /* 8 */; + const int SUPP_SERVICE_CLASS_DATA_SYNC = (1 << 4) /* 16 */; + const int SUPP_SERVICE_CLASS_DATA_ASYNC = (1 << 5) /* 32 */; + const int SUPP_SERVICE_CLASS_PACKET = (1 << 6) /* 64 */; + const int SUPP_SERVICE_CLASS_PAD = (1 << 7) /* 128 */; + const int SUPP_SERVICE_CLASS_MAX = (1 << 7) /* 128 */; } diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/TtyMode.aidl b/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/TtyMode.aidl index e432e65093e3d1c3da1ba5397db223d6bfdfea26..41ff6b8109a45193163f708450eb9eafa8e9f12e 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/TtyMode.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/TtyMode.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.voice; +/* @hide */ @Backing(type="int") @JavaDerive(toString=true) @VintfStability enum TtyMode { OFF, diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/UssdModeType.aidl b/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/UssdModeType.aidl index 424e73fc35484ee79fadba39d3f659f21897b38f..9e80f0314948be27d822ce353b6fd80db1e4f9da 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/UssdModeType.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/UssdModeType.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.voice; +/* @hide */ @Backing(type="int") @JavaDerive(toString=true) @VintfStability enum UssdModeType { NOTIFY, diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/UusInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/UusInfo.aidl index 931376014c0594c6ea18bf1301637ef5307872c4..3c84c8d97b781ae82121fe7e85d57b9c05725def 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/UusInfo.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/UusInfo.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.voice; +/* @hide */ @JavaDerive(toString=true) @VintfStability parcelable UusInfo { int uusType; diff --git a/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/AccessNetwork.aidl b/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/AccessNetwork.aidl index 964165149d8036175be7f9809e5f295dbaed1944..73a267b6d036a97a6340a43f94f00b7c557997ff 100644 --- a/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/AccessNetwork.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/AccessNetwork.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio; +/* @hide */ @Backing(type="int") @JavaDerive(toString=true) @VintfStability enum AccessNetwork { UNKNOWN, diff --git a/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/RadioAccessFamily.aidl b/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/RadioAccessFamily.aidl index b7b074bda2e69c948aa341265048d376703a20e2..1298ab0f4cdb29edbc8d663ced67358e1ab6a050 100644 --- a/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/RadioAccessFamily.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/RadioAccessFamily.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio; +/* @hide */ @Backing(type="int") @JavaDerive(toString=true) @VintfStability enum RadioAccessFamily { UNKNOWN = (1 << android.hardware.radio.RadioTechnology.UNKNOWN) /* 1 */, diff --git a/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/RadioConst.aidl b/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/RadioConst.aidl index 9785825e9da70142b1571d6feca87abb57e9f6bb..970cd1e0c832be80b3e2e1a417fe466fa1f73a65 100644 --- a/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/RadioConst.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/RadioConst.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio; +/* @hide */ @JavaDerive(toString=true) @VintfStability parcelable RadioConst { const int MAX_RILDS = 3; diff --git a/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/RadioError.aidl b/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/RadioError.aidl index 98606e588bb15596b90e800c4a43bed5b1142515..02c537055cc8b83574c9591a9af395f9ffb594b4 100644 --- a/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/RadioError.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/RadioError.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio; +/* @hide */ @Backing(type="int") @JavaDerive(toString=true) @VintfStability enum RadioError { NONE = 0, diff --git a/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/RadioIndicationType.aidl b/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/RadioIndicationType.aidl index 58b35a572379f4547bc7278ab75667819e53951a..316f92f876648256fe5746476cc3d78df759cb9f 100644 --- a/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/RadioIndicationType.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/RadioIndicationType.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio; +/* @hide */ @Backing(type="int") @JavaDerive(toString=true) @VintfStability enum RadioIndicationType { UNSOLICITED, diff --git a/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/RadioResponseInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/RadioResponseInfo.aidl index b2a7a062f9f28c14b93d75e1f130997bf1734487..f03a73bfb15a6f88028442bfb985a519faaa0842 100644 --- a/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/RadioResponseInfo.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/RadioResponseInfo.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio; +/* @hide */ @JavaDerive(toString=true) @VintfStability parcelable RadioResponseInfo { android.hardware.radio.RadioResponseType type; diff --git a/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/RadioResponseInfoModem.aidl b/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/RadioResponseInfoModem.aidl index 37ed7bb230f4a172150e8db2d71e498c29e796f5..2e0c3154261ce2eb2e07e86e3dd0b0209e1379ee 100644 --- a/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/RadioResponseInfoModem.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/RadioResponseInfoModem.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio; +/* @hide */ @JavaDerive(toString=true) @VintfStability parcelable RadioResponseInfoModem { android.hardware.radio.RadioResponseType type; diff --git a/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/RadioResponseType.aidl b/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/RadioResponseType.aidl index 1ee62bd94cb0585100a90197c3347ec082bcffb6..8bdb45bfdf820df9ef6a99c7370d883b650cf0d2 100644 --- a/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/RadioResponseType.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/RadioResponseType.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio; +/* @hide */ @Backing(type="int") @JavaDerive(toString=true) @VintfStability enum RadioResponseType { SOLICITED, diff --git a/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/RadioTechnology.aidl b/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/RadioTechnology.aidl index b6af5aabf23a579100a64f545deb0db338d20b58..7c6a657bcd74497a74226cf104d01645b0da1286 100644 --- a/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/RadioTechnology.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/RadioTechnology.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio; +/* @hide */ @Backing(type="int") @JavaDerive(toString=true) @VintfStability enum RadioTechnology { UNKNOWN, diff --git a/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/RadioTechnologyFamily.aidl b/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/RadioTechnologyFamily.aidl index 2af7e535da5c1bc0238969b8cb1d6059565ba17a..85e9850cad4ff83a246c508839805918d778ba1f 100644 --- a/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/RadioTechnologyFamily.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/RadioTechnologyFamily.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio; +/* @hide */ @Backing(type="int") @JavaDerive(toString=true) @VintfStability enum RadioTechnologyFamily { THREE_GPP, diff --git a/radio/aidl/android/hardware/radio/AccessNetwork.aidl b/radio/aidl/android/hardware/radio/AccessNetwork.aidl index 2885642e834cc96a279f4a6cbddadbd69c453106..4099f83f044260aa6093df92455430a708bceca1 100644 --- a/radio/aidl/android/hardware/radio/AccessNetwork.aidl +++ b/radio/aidl/android/hardware/radio/AccessNetwork.aidl @@ -16,6 +16,7 @@ package android.hardware.radio; +/** @hide */ @VintfStability @Backing(type="int") @JavaDerive(toString=true) diff --git a/radio/aidl/android/hardware/radio/RadioAccessFamily.aidl b/radio/aidl/android/hardware/radio/RadioAccessFamily.aidl index edf33ba7cca6c90f220a58bde48e5f44efffa52d..9ab4583c08bcf8019f0477b894b617d0cf2000e0 100644 --- a/radio/aidl/android/hardware/radio/RadioAccessFamily.aidl +++ b/radio/aidl/android/hardware/radio/RadioAccessFamily.aidl @@ -18,6 +18,7 @@ package android.hardware.radio; import android.hardware.radio.RadioTechnology; +/** @hide */ @VintfStability @Backing(type="int") @JavaDerive(toString=true) diff --git a/radio/aidl/android/hardware/radio/RadioConst.aidl b/radio/aidl/android/hardware/radio/RadioConst.aidl index 6591ef16a200df5d5a8bb92948eaa7e02a92a0b3..7b923b984a528c99991b18455c76ed9fb9d026c1 100644 --- a/radio/aidl/android/hardware/radio/RadioConst.aidl +++ b/radio/aidl/android/hardware/radio/RadioConst.aidl @@ -16,6 +16,7 @@ package android.hardware.radio; +/** @hide */ @VintfStability @JavaDerive(toString=true) parcelable RadioConst { diff --git a/radio/aidl/android/hardware/radio/RadioError.aidl b/radio/aidl/android/hardware/radio/RadioError.aidl index 20313993f52dd4dced079aea3b8473f04f3abf4d..9c39bc4420c8e5e2b6db7082666e8417ddaac283 100644 --- a/radio/aidl/android/hardware/radio/RadioError.aidl +++ b/radio/aidl/android/hardware/radio/RadioError.aidl @@ -16,6 +16,7 @@ package android.hardware.radio; +/** @hide */ @VintfStability @Backing(type="int") @JavaDerive(toString=true) diff --git a/radio/aidl/android/hardware/radio/RadioIndicationType.aidl b/radio/aidl/android/hardware/radio/RadioIndicationType.aidl index 2dcc492a1cb02e0c84e77ba7e6483ff4d7a9265c..594b14787b4bd55818bb75d018004a5b90771efc 100644 --- a/radio/aidl/android/hardware/radio/RadioIndicationType.aidl +++ b/radio/aidl/android/hardware/radio/RadioIndicationType.aidl @@ -16,6 +16,7 @@ package android.hardware.radio; +/** @hide */ @VintfStability @Backing(type="int") @JavaDerive(toString=true) diff --git a/radio/aidl/android/hardware/radio/RadioResponseInfo.aidl b/radio/aidl/android/hardware/radio/RadioResponseInfo.aidl index f70a3fe457e92f1070af94d67d6f05de32d66c03..25195aaa2ff1e20bbf661bb83b7e1ce813f1e9ad 100644 --- a/radio/aidl/android/hardware/radio/RadioResponseInfo.aidl +++ b/radio/aidl/android/hardware/radio/RadioResponseInfo.aidl @@ -19,6 +19,7 @@ package android.hardware.radio; import android.hardware.radio.RadioError; import android.hardware.radio.RadioResponseType; +/** @hide */ @VintfStability @JavaDerive(toString=true) parcelable RadioResponseInfo { diff --git a/radio/aidl/android/hardware/radio/RadioResponseInfoModem.aidl b/radio/aidl/android/hardware/radio/RadioResponseInfoModem.aidl index 13abfb991f473e7e969eba1c0c697e33814fb7b1..286f397607a2b0f4e29ba6be53e3c5b8f37efc96 100644 --- a/radio/aidl/android/hardware/radio/RadioResponseInfoModem.aidl +++ b/radio/aidl/android/hardware/radio/RadioResponseInfoModem.aidl @@ -19,6 +19,7 @@ package android.hardware.radio; import android.hardware.radio.RadioError; import android.hardware.radio.RadioResponseType; +/** @hide */ @VintfStability @JavaDerive(toString=true) parcelable RadioResponseInfoModem { diff --git a/radio/aidl/android/hardware/radio/RadioResponseType.aidl b/radio/aidl/android/hardware/radio/RadioResponseType.aidl index cd4a305d4b892eae7cbdc6f28acac3989e24dccc..000f4783841f080a3ac068f0ceb83c1cf73a6680 100644 --- a/radio/aidl/android/hardware/radio/RadioResponseType.aidl +++ b/radio/aidl/android/hardware/radio/RadioResponseType.aidl @@ -16,6 +16,7 @@ package android.hardware.radio; +/** @hide */ @VintfStability @Backing(type="int") @JavaDerive(toString=true) diff --git a/radio/aidl/android/hardware/radio/RadioTechnology.aidl b/radio/aidl/android/hardware/radio/RadioTechnology.aidl index 4b51152ac41b79ffad908b0138c0647d47676f49..7ae428bac6a52bd7d48c5d1495558318b3492ccc 100644 --- a/radio/aidl/android/hardware/radio/RadioTechnology.aidl +++ b/radio/aidl/android/hardware/radio/RadioTechnology.aidl @@ -16,6 +16,7 @@ package android.hardware.radio; +/** @hide */ @VintfStability @Backing(type="int") @JavaDerive(toString=true) diff --git a/radio/aidl/android/hardware/radio/RadioTechnologyFamily.aidl b/radio/aidl/android/hardware/radio/RadioTechnologyFamily.aidl index a2b989d18d2e58e56c64427e5a3d002d0b66f653..4b5498cc07e79f0e8a661b3f80fbcf72a9cac9c4 100644 --- a/radio/aidl/android/hardware/radio/RadioTechnologyFamily.aidl +++ b/radio/aidl/android/hardware/radio/RadioTechnologyFamily.aidl @@ -16,6 +16,7 @@ package android.hardware.radio; +/** @hide */ @VintfStability @Backing(type="int") @JavaDerive(toString=true) diff --git a/radio/aidl/android/hardware/radio/config/IRadioConfig.aidl b/radio/aidl/android/hardware/radio/config/IRadioConfig.aidl index 85c2ceee2687dc7ff83f74d905013e3dcca105a5..9058d9d050a9c91e2780f750ac13b07df66ea2cc 100644 --- a/radio/aidl/android/hardware/radio/config/IRadioConfig.aidl +++ b/radio/aidl/android/hardware/radio/config/IRadioConfig.aidl @@ -28,6 +28,7 @@ import android.hardware.radio.config.IRadioConfigIndication; import android.hardware.radio.config.IRadioConfigResponse; import android.hardware.radio.config.SlotPortMapping; +/** @hide */ @VintfStability oneway interface IRadioConfig { /** @@ -39,6 +40,8 @@ oneway interface IRadioConfig { * * Response callback is * IRadioConfigResponse.getHalDeviceCapabilitiesResponse() + * + * This is available when android.hardware.telephony is defined. */ void getHalDeviceCapabilities(in int serial); @@ -53,6 +56,8 @@ oneway interface IRadioConfig { * * Response callback is IRadioConfigResponse.getNumOfLiveModemsResponse() which * will return . + * + * This is available when android.hardware.telephony is defined. */ void getNumOfLiveModems(in int serial); @@ -63,6 +68,8 @@ oneway interface IRadioConfig { * * Response callback is IRadioResponse.getPhoneCapabilityResponse() which * will return . + * + * This is available when android.hardware.telephony is defined. */ void getPhoneCapability(in int serial); @@ -75,6 +82,8 @@ oneway interface IRadioConfig { * @param serial Serial number of request. * * Response callback is IRadioConfigResponse.getSimSlotsStatusResponse() + * + * This is available when android.hardware.telephony.subscription is defined. */ void getSimSlotsStatus(in int serial); @@ -92,6 +101,8 @@ oneway interface IRadioConfig { * @param modemsConfig byte object including the number of live modems * * Response callback is IRadioResponse.setNumOfLiveModemsResponse() + * + * This is available when android.hardware.telephony is defined. */ void setNumOfLiveModems(in int serial, in byte numOfLiveModems); @@ -106,6 +117,8 @@ oneway interface IRadioConfig { * from getPhoneCapability(). * * Response callback is IRadioConfigResponse.setPreferredDataModemResponse() + * + * This is available when android.hardware.telephony.data is defined. */ void setPreferredDataModem(in int serial, in byte modemId); @@ -114,6 +127,8 @@ oneway interface IRadioConfig { * * @param radioConfigResponse Object containing radio config response functions * @param radioConfigIndication Object containing radio config indications + * + * This is available when android.hardware.telephony is defined. */ void setResponseFunctions(in IRadioConfigResponse radioConfigResponse, in IRadioConfigIndication radioConfigIndication); @@ -172,6 +187,8 @@ oneway interface IRadioConfig { * getSimSlotsStatusResponse * * Response callback is IRadioConfigResponse.setSimSlotsMappingResponse() + * + * This is available when android.hardware.telephony.subscription is defined. */ void setSimSlotsMapping(in int serial, in SlotPortMapping[] slotMap); } diff --git a/radio/aidl/android/hardware/radio/config/IRadioConfigIndication.aidl b/radio/aidl/android/hardware/radio/config/IRadioConfigIndication.aidl index abf55f1f80f72fcac1502e6b15902530aa3d98fb..ed2366bbad49eba73f680b25ee1fc8c59e9711ee 100644 --- a/radio/aidl/android/hardware/radio/config/IRadioConfigIndication.aidl +++ b/radio/aidl/android/hardware/radio/config/IRadioConfigIndication.aidl @@ -20,6 +20,7 @@ import android.hardware.radio.config.SimSlotStatus; /** * Interface declaring unsolicited radio config indications. + * @hide */ @VintfStability oneway interface IRadioConfigIndication { diff --git a/radio/aidl/android/hardware/radio/config/IRadioConfigResponse.aidl b/radio/aidl/android/hardware/radio/config/IRadioConfigResponse.aidl index 0d36bbd016d9d8875e57b317c1398331c00c38b7..df93e3c3361ffa602b257288f1d85e361f388d06 100644 --- a/radio/aidl/android/hardware/radio/config/IRadioConfigResponse.aidl +++ b/radio/aidl/android/hardware/radio/config/IRadioConfigResponse.aidl @@ -21,6 +21,7 @@ import android.hardware.radio.config.SimSlotStatus; /** * Interface declaring response functions to solicited radio config requests. + * @hide */ @VintfStability oneway interface IRadioConfigResponse { @@ -39,6 +40,7 @@ oneway interface IRadioConfigResponse { * IRadioIndication.currentPhysicalChannelConfigs_1_6() * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony is not defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:INTERNAL_ERR @@ -52,6 +54,7 @@ oneway interface IRadioConfigResponse { * are enabled and actively working as part of a working connectivity stack * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony is not defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE */ @@ -64,6 +67,7 @@ oneway interface IRadioConfigResponse { * how many logical modems it has, how many data connections it supports. * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony is not defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:INTERNAL_ERR @@ -77,6 +81,8 @@ oneway interface IRadioConfigResponse { * equal to the number of physical slots on the device * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.subscription is not + * defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:NO_MEMORY @@ -90,6 +96,7 @@ oneway interface IRadioConfigResponse { * @param info Response info struct containing response type, serial no. and error * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony is not defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:INVALID_ARGUMENTS @@ -100,6 +107,7 @@ oneway interface IRadioConfigResponse { * @param info Response info struct containing response type, serial no. and error * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.data is not defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:INTERNAL_ERR @@ -111,6 +119,8 @@ oneway interface IRadioConfigResponse { * @param info Response info struct containing response type, serial no. and error * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.subscription is not + * defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:NO_MEMORY diff --git a/radio/aidl/android/hardware/radio/config/MultipleEnabledProfilesMode.aidl b/radio/aidl/android/hardware/radio/config/MultipleEnabledProfilesMode.aidl index b18ea0e7105213b15bb7eb53c8205d47f73f8129..1d9b66e586d49a143c2e258a18f0abc471c22f77 100644 --- a/radio/aidl/android/hardware/radio/config/MultipleEnabledProfilesMode.aidl +++ b/radio/aidl/android/hardware/radio/config/MultipleEnabledProfilesMode.aidl @@ -20,6 +20,7 @@ package android.hardware.radio.config; * Multiple Enabled Profiles(MEP) mode is the jointly supported MEP mode. As per section 3.4.1.1 of * GSMA spec SGP.22 v3.0,there are 3 supported MEP modes: MEP-A1, MEP-A2 and MEP-B. * If there is no jointly supported MEP mode, supported MEP mode is set to NONE. + * @hide */ @VintfStability @Backing(type="int") diff --git a/radio/aidl/android/hardware/radio/config/PhoneCapability.aidl b/radio/aidl/android/hardware/radio/config/PhoneCapability.aidl index 8e4f3380cbe929febc0364e08cfa58fd26f00190..35d6b5d86da4dbb61d0466fe997655a133ac7896 100644 --- a/radio/aidl/android/hardware/radio/config/PhoneCapability.aidl +++ b/radio/aidl/android/hardware/radio/config/PhoneCapability.aidl @@ -20,6 +20,7 @@ package android.hardware.radio.config; * Phone capability which describes the data connection capability of modem. * It's used to evaluate possible phone config change, for example from single * SIM device to multi-SIM device. + * @hide */ @VintfStability @JavaDerive(toString=true) diff --git a/radio/aidl/android/hardware/radio/config/SimPortInfo.aidl b/radio/aidl/android/hardware/radio/config/SimPortInfo.aidl index db247191ad64b2a935123ed04b4c9de46b92179b..f57963967b27cf64d30211311d1b20d771506f4d 100644 --- a/radio/aidl/android/hardware/radio/config/SimPortInfo.aidl +++ b/radio/aidl/android/hardware/radio/config/SimPortInfo.aidl @@ -16,6 +16,7 @@ package android.hardware.radio.config; +/** @hide */ @VintfStability @JavaDerive(toString=true) parcelable SimPortInfo { diff --git a/radio/aidl/android/hardware/radio/config/SimSlotStatus.aidl b/radio/aidl/android/hardware/radio/config/SimSlotStatus.aidl index 6a36d5e83bcd2c9a72037da131b8ed6db901c7f6..34f98c56bba50327e217760d2f1264231c89a13f 100644 --- a/radio/aidl/android/hardware/radio/config/SimSlotStatus.aidl +++ b/radio/aidl/android/hardware/radio/config/SimSlotStatus.aidl @@ -19,6 +19,7 @@ package android.hardware.radio.config; import android.hardware.radio.config.MultipleEnabledProfilesMode; import android.hardware.radio.config.SimPortInfo; +/** @hide */ @VintfStability @JavaDerive(toString=true) parcelable SimSlotStatus { diff --git a/radio/aidl/android/hardware/radio/config/SlotPortMapping.aidl b/radio/aidl/android/hardware/radio/config/SlotPortMapping.aidl index c78afcbc5fa2466a413d5e356b484d092b152b60..30cca505033366194f4ec5999e83de2c2e8715f7 100644 --- a/radio/aidl/android/hardware/radio/config/SlotPortMapping.aidl +++ b/radio/aidl/android/hardware/radio/config/SlotPortMapping.aidl @@ -16,6 +16,7 @@ package android.hardware.radio.config; +/** @hide */ @VintfStability @JavaDerive(toString=true) parcelable SlotPortMapping { diff --git a/radio/aidl/android/hardware/radio/data/ApnAuthType.aidl b/radio/aidl/android/hardware/radio/data/ApnAuthType.aidl index a4116db1720d40d41858376b1e09c659e743cde3..1d1d851a8d82e121df153bd76b566a39cd117e7c 100644 --- a/radio/aidl/android/hardware/radio/data/ApnAuthType.aidl +++ b/radio/aidl/android/hardware/radio/data/ApnAuthType.aidl @@ -16,6 +16,7 @@ package android.hardware.radio.data; +/** @hide */ @VintfStability @Backing(type="int") @JavaDerive(toString=true) diff --git a/radio/aidl/android/hardware/radio/data/ApnTypes.aidl b/radio/aidl/android/hardware/radio/data/ApnTypes.aidl index ed1256d7443b783d4c6b2828f1f5d428c7822460..f44c63627b93ec7619882eaa1addbfd62d3adeed 100644 --- a/radio/aidl/android/hardware/radio/data/ApnTypes.aidl +++ b/radio/aidl/android/hardware/radio/data/ApnTypes.aidl @@ -16,6 +16,7 @@ package android.hardware.radio.data; +/** @hide */ @VintfStability @Backing(type="int") @JavaDerive(toString=true) @@ -85,5 +86,9 @@ enum ApnTypes { /** * APN type for ENTERPRISE */ - ENTERPRISE = 1 << 14 + ENTERPRISE = 1 << 14, + /** + * APN type for RCS (Rich Communication Services) + */ + RCS = 1 << 15 } diff --git a/radio/aidl/android/hardware/radio/data/DataCallFailCause.aidl b/radio/aidl/android/hardware/radio/data/DataCallFailCause.aidl index 071ce55c49eab01ecf8d5d963a3a555a92688f01..e015e8eec96a955b90d10448a8f1656a248ab252 100644 --- a/radio/aidl/android/hardware/radio/data/DataCallFailCause.aidl +++ b/radio/aidl/android/hardware/radio/data/DataCallFailCause.aidl @@ -16,6 +16,7 @@ package android.hardware.radio.data; +/** @hide */ @VintfStability @Backing(type="int") @JavaDerive(toString=true) diff --git a/radio/aidl/android/hardware/radio/data/DataProfileInfo.aidl b/radio/aidl/android/hardware/radio/data/DataProfileInfo.aidl index ea4e751fce8cf64e023c8e48875f733400e066ee..d01f8fff691acd9cdf60bc4ce04b09f47fd99fcd 100644 --- a/radio/aidl/android/hardware/radio/data/DataProfileInfo.aidl +++ b/radio/aidl/android/hardware/radio/data/DataProfileInfo.aidl @@ -20,6 +20,7 @@ import android.hardware.radio.data.ApnAuthType; import android.hardware.radio.data.PdpProtocolType; import android.hardware.radio.data.TrafficDescriptor; +/** @hide */ @VintfStability @JavaDerive(toString=true) parcelable DataProfileInfo { @@ -38,6 +39,21 @@ parcelable DataProfileInfo { const int TYPE_3GPP = 1; const int TYPE_3GPP2 = 2; + /** + * Innfrastructure type unknown. This is only for initializing. + */ + const int INFRASTRUCTURE_UNKNOWN = 0; + + /** + * Indicating this APN can be used when the device is using terrestrial cellular networks. + */ + const int INFRASTRUCTURE_CELLULAR = 1 << 0; + + /** + * Indicating this APN can be used when the device is attached to satellite. + */ + const int INFRASTRUCTURE_SATELLITE = 1 << 1; + /** * ID of the data profile. * Values are ID_ @@ -130,4 +146,10 @@ parcelable DataProfileInfo { * apn; apn must be used as the end point if one is not specified through URSP rules. */ TrafficDescriptor trafficDescriptor; + /** + * The infrastructure bitmap which the APN can be used on. For example, some APNs can only + * be used when the device is using cellular network, using satellite network, or can be used + * in either cases. + */ + int infrastructureBitmap = INFRASTRUCTURE_UNKNOWN; } diff --git a/radio/aidl/android/hardware/radio/data/DataRequestReason.aidl b/radio/aidl/android/hardware/radio/data/DataRequestReason.aidl index 44b47f84ecd7498a31bda4cb8770cc79ce484086..b16081d8ecaa27e9ebd614a13856615b7ff054b0 100644 --- a/radio/aidl/android/hardware/radio/data/DataRequestReason.aidl +++ b/radio/aidl/android/hardware/radio/data/DataRequestReason.aidl @@ -16,6 +16,7 @@ package android.hardware.radio.data; +/** @hide */ @VintfStability @Backing(type="int") @JavaDerive(toString=true) diff --git a/radio/aidl/android/hardware/radio/data/DataThrottlingAction.aidl b/radio/aidl/android/hardware/radio/data/DataThrottlingAction.aidl index e4ee444207b4a2796d479ff0177f055af552b097..a762e346d0d610a7eee6abd620ec0f288311c30e 100644 --- a/radio/aidl/android/hardware/radio/data/DataThrottlingAction.aidl +++ b/radio/aidl/android/hardware/radio/data/DataThrottlingAction.aidl @@ -16,6 +16,7 @@ package android.hardware.radio.data; +/** @hide */ @VintfStability @Backing(type="byte") @JavaDerive(toString=true) diff --git a/radio/aidl/android/hardware/radio/data/EpsQos.aidl b/radio/aidl/android/hardware/radio/data/EpsQos.aidl index 8965d6eb5d2c6a8f16c78a425aa66e7b941538c1..42eee32240d632ab431752e24e11bfcc31d026ff 100644 --- a/radio/aidl/android/hardware/radio/data/EpsQos.aidl +++ b/radio/aidl/android/hardware/radio/data/EpsQos.aidl @@ -20,6 +20,7 @@ import android.hardware.radio.data.QosBandwidth; /** * LTE/EPS Quality of Service parameters as per 3gpp spec 24.301 sec 9.9.4.3. + * @hide */ @VintfStability @JavaDerive(toString=true) diff --git a/radio/aidl/android/hardware/radio/data/IRadioData.aidl b/radio/aidl/android/hardware/radio/data/IRadioData.aidl index 0171d39b4268950923cc206de3f41fa30f1c9518..a73616ac18f5d90cee02094feff2e6f5dd7496b5 100644 --- a/radio/aidl/android/hardware/radio/data/IRadioData.aidl +++ b/radio/aidl/android/hardware/radio/data/IRadioData.aidl @@ -34,6 +34,7 @@ import android.hardware.radio.data.TrafficDescriptor; * duration of a method call. If clients provide colliding serials (including passing the same * serial to different methods), multiple responses (one for each method call) must still be served. * setResponseFunctions must work with IRadioDataResponse and IRadioDataIndication. + * @hide */ @VintfStability oneway interface IRadioData { @@ -47,6 +48,8 @@ oneway interface IRadioData { * @param serial Serial number of request. * * Response function is IRadioDataResponse.allocatePduSessionIdResponse() + * + * This is available when android.hardware.telephony.data is defined. */ void allocatePduSessionId(in int serial); @@ -59,6 +62,8 @@ oneway interface IRadioData { * @param id callId The identifier of the data call which is provided in SetupDataCallResult * * Response function is IRadioDataResponse.cancelHandoverResponse() + * + * This is available when android.hardware.telephony.ims is defined. */ void cancelHandover(in int serial, in int callId); @@ -72,6 +77,8 @@ oneway interface IRadioData { * @param reason The request reason. Must be normal, handover, or shutdown. * * Response function is IRadioDataResponse.deactivateDataCallResponse() + * + * This is available when android.hardware.telephony.data is defined. */ void deactivateDataCall(in int serial, in int cid, in DataRequestReason reason); @@ -82,6 +89,8 @@ oneway interface IRadioData { * @param serial Serial number of request. * * Response function is IRadioDataResponse.getDataCallListResponse() + * + * This is available when android.hardware.telephony.data is defined. */ void getDataCallList(in int serial); @@ -95,6 +104,8 @@ oneway interface IRadioData { * @param serial Serial number of request. * * Response function is IRadioDataResponse.getSlicingConfigResponse() + * + * This is available when android.hardware.telephony.data is defined. */ void getSlicingConfig(in int serial); @@ -106,6 +117,8 @@ oneway interface IRadioData { * @param id Pdu session id to release. * * Response function is IRadioDataResponse.releasePduSessionIdResponse() + * + * This is available when android.hardware.telephony.ims is defined. */ void releasePduSessionId(in int serial, in int id); @@ -113,6 +126,8 @@ oneway interface IRadioData { * When response type received from a radio indication or radio response is * RadioIndicationType:UNSOLICITED_ACK_EXP or RadioResponseType:SOLICITED_ACK_EXP respectively, * acknowledge the receipt of those messages by sending responseAcknowledgement(). + * + * This is available when android.hardware.telephony.data is defined. */ void responseAcknowledgement(); @@ -123,6 +138,8 @@ oneway interface IRadioData { * @param allow true to allow data calls, false to disallow data calls * * Response function is IRadioDataResponse.setDataAllowedResponse() + * + * This is available when android.hardware.telephony.data is defined. */ void setDataAllowed(in int serial, in boolean allow); @@ -133,6 +150,8 @@ oneway interface IRadioData { * @param profiles Array of DataProfileInfo to set. * * Response function is IRadioDataResponse.setDataProfileResponse() + * + * This is available when android.hardware.telephony.data is defined. */ void setDataProfile(in int serial, in DataProfileInfo[] profiles); @@ -154,6 +173,8 @@ oneway interface IRadioData { * DataThrottlingAction:HOLD. * * Response function is IRadioDataResponse.setDataThrottlingResponse() + * + * This is available when android.hardware.telephony.data is defined. */ void setDataThrottling(in int serial, in DataThrottlingAction dataThrottlingAction, in long completionDurationMillis); @@ -166,6 +187,8 @@ oneway interface IRadioData { * initial attach APN. * * Response function is IRadioDataResponse.setInitialAttachApnResponse() + * + * This is available when android.hardware.telephony.data is defined. */ void setInitialAttachApn(in int serial, in @nullable DataProfileInfo dataProfileInfo); @@ -174,6 +197,8 @@ oneway interface IRadioData { * * @param radioDataResponse Object containing response functions * @param radioDataIndication Object containing radio indications + * + * This is available when android.hardware.telephony.data is defined. */ void setResponseFunctions( in IRadioDataResponse radioDataResponse, in IRadioDataIndication radioDataIndication); @@ -228,6 +253,8 @@ oneway interface IRadioData { * example, a zero-rating slice. * * Response function is IRadioDataResponse.setupDataCallResponse() + * + * This is available when android.hardware.telephony.data is defined. */ void setupDataCall(in int serial, in AccessNetwork accessNetwork, in DataProfileInfo dataProfileInfo, in boolean roamingAllowed, @@ -249,6 +276,8 @@ oneway interface IRadioData { * @param id callId The identifier of the data call which is provided in SetupDataCallResult * * Response function is IRadioDataResponse.startHandoverResponse() + * + * This is available when android.hardware.telephony.ims is defined. */ void startHandover(in int serial, in int callId); @@ -259,6 +288,8 @@ oneway interface IRadioData { * @param keepalive A request structure containing all necessary info to describe a keepalive * * Response function is IRadioDataResponse.startKeepaliveResponse() + * + * This is available when android.hardware.telephony.data is defined. */ void startKeepalive(in int serial, in KeepaliveRequest keepalive); @@ -270,6 +301,8 @@ oneway interface IRadioData { * IRadioDataResponse.startKeepaliveResponse * * Response function is IRadioDataResponse.stopKeepaliveResponse() + * + * This is available when android.hardware.telephony.data is defined. */ void stopKeepalive(in int serial, in int sessionHandle); } diff --git a/radio/aidl/android/hardware/radio/data/IRadioDataIndication.aidl b/radio/aidl/android/hardware/radio/data/IRadioDataIndication.aidl index 938c695fd49c7c072c74a3add95142cdc12aa7c9..c3fdcaa60d8b1b44e514ba7148dda91df7ad79ce 100644 --- a/radio/aidl/android/hardware/radio/data/IRadioDataIndication.aidl +++ b/radio/aidl/android/hardware/radio/data/IRadioDataIndication.aidl @@ -25,6 +25,7 @@ import android.hardware.radio.data.SlicingConfig; /** * Interface declaring unsolicited radio indications for data APIs. + * @hide */ @VintfStability oneway interface IRadioDataIndication { diff --git a/radio/aidl/android/hardware/radio/data/IRadioDataResponse.aidl b/radio/aidl/android/hardware/radio/data/IRadioDataResponse.aidl index 06c83c1e9230ef54bdc4c4181aa72908661e8837..538b90abb42a73b22e648ddac02400ff5a28eed1 100644 --- a/radio/aidl/android/hardware/radio/data/IRadioDataResponse.aidl +++ b/radio/aidl/android/hardware/radio/data/IRadioDataResponse.aidl @@ -23,6 +23,7 @@ import android.hardware.radio.data.SlicingConfig; /** * Interface declaring response functions to solicited radio requests for data APIs. + * @hide */ @VintfStability oneway interface IRadioDataResponse { @@ -40,6 +41,7 @@ oneway interface IRadioDataResponse { * @param id The allocated id. On an error, this is set to 0. * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.data is not defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:INTERNAL_ERR @@ -52,6 +54,7 @@ oneway interface IRadioDataResponse { * @param dcResponse Attributes of data call * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.ims is not defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:INTERNAL_ERR @@ -64,6 +67,7 @@ oneway interface IRadioDataResponse { * @param info Response info struct containing response type, serial no. and error * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.data is not defined * RadioError:NONE indicates success. Any other error will remove the network from the list. * RadioError:RADIO_NOT_AVAILABLE * RadioError:INVALID_CALL_ID @@ -82,6 +86,7 @@ oneway interface IRadioDataResponse { * @param dcResponse List of SetupDataCallResult * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.data is not defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:INTERNAL_ERR @@ -94,6 +99,7 @@ oneway interface IRadioDataResponse { * @param slicingConfig Current slicing configuration * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.data is not defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:INTERNAL_ERR @@ -105,6 +111,7 @@ oneway interface IRadioDataResponse { * @param info Response info struct containing response type, serial no. and error * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.ims is not defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:INTERNAL_ERR @@ -116,6 +123,7 @@ oneway interface IRadioDataResponse { * @param info Response info struct containing response type, serial no. and error * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.data is not defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:NO_MEMORY @@ -134,6 +142,7 @@ oneway interface IRadioDataResponse { * @param info Response info struct containing response type, serial no. and error * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.data is not defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:SUBSCRIPTION_NOT_AVAILABLE @@ -149,6 +158,7 @@ oneway interface IRadioDataResponse { * @param info Response info struct containing response type, serial no. and error * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.data is not defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:MODEM_ERR @@ -160,6 +170,7 @@ oneway interface IRadioDataResponse { * @param info Response info struct containing response type, serial no. and error * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.data is not defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:SUBSCRIPTION_NOT_AVAILABLE @@ -179,6 +190,7 @@ oneway interface IRadioDataResponse { * @param dcResponse SetupDataCallResult * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.data is not defined * RadioError:NONE must be returned on both success and failure of setup with the * DataCallResponse.status containing the actual status * For all other errors the DataCallResponse is ignored. @@ -196,6 +208,7 @@ oneway interface IRadioDataResponse { * @param info Response info struct containing response type, serial no. and error * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.ims is not defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:INTERNAL_ERR @@ -211,6 +224,7 @@ oneway interface IRadioDataResponse { * request. * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.data is not defined * RadioError:NONE * RadioError:NO_RESOURCES * RadioError:INVALID_ARGUMENTS @@ -221,6 +235,7 @@ oneway interface IRadioDataResponse { * @param info Response info struct containing response type, serial no. and error * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.data is not defined * RadioError:NONE * RadioError:INVALID_ARGUMENTS */ diff --git a/radio/aidl/android/hardware/radio/data/KeepaliveRequest.aidl b/radio/aidl/android/hardware/radio/data/KeepaliveRequest.aidl index c720de0547b213a7315d427b714b55212a2e2680..1838f2eca5d9e5850b78c45a4924cdfdbf27b266 100644 --- a/radio/aidl/android/hardware/radio/data/KeepaliveRequest.aidl +++ b/radio/aidl/android/hardware/radio/data/KeepaliveRequest.aidl @@ -16,6 +16,7 @@ package android.hardware.radio.data; +/** @hide */ @VintfStability @JavaDerive(toString=true) parcelable KeepaliveRequest { diff --git a/radio/aidl/android/hardware/radio/data/KeepaliveStatus.aidl b/radio/aidl/android/hardware/radio/data/KeepaliveStatus.aidl index 0b829c4a4d1d80745b577e8dedb323a02207a9e8..162fc37b482314ffe97eaf6a700337838982e8d9 100644 --- a/radio/aidl/android/hardware/radio/data/KeepaliveStatus.aidl +++ b/radio/aidl/android/hardware/radio/data/KeepaliveStatus.aidl @@ -16,6 +16,7 @@ package android.hardware.radio.data; +/** @hide */ @VintfStability @JavaDerive(toString=true) parcelable KeepaliveStatus { diff --git a/radio/aidl/android/hardware/radio/data/LinkAddress.aidl b/radio/aidl/android/hardware/radio/data/LinkAddress.aidl index 12a7637a59a6adb1adaccccb934a3716045a99ba..957973d796b71396951fc5278ab3112646184e4f 100644 --- a/radio/aidl/android/hardware/radio/data/LinkAddress.aidl +++ b/radio/aidl/android/hardware/radio/data/LinkAddress.aidl @@ -18,6 +18,7 @@ package android.hardware.radio.data; /** * Describes a data link address for mobile data connection. + * @hide */ @VintfStability @JavaDerive(toString=true) diff --git a/radio/aidl/android/hardware/radio/data/NrQos.aidl b/radio/aidl/android/hardware/radio/data/NrQos.aidl index 4078fdccc64da68df6b9736297b8a8741528a394..f636e6b12fbfbcb04a89937094c0b3fe08cf2fe8 100644 --- a/radio/aidl/android/hardware/radio/data/NrQos.aidl +++ b/radio/aidl/android/hardware/radio/data/NrQos.aidl @@ -20,6 +20,7 @@ import android.hardware.radio.data.QosBandwidth; /** * 5G Quality of Service parameters as per 3gpp spec 24.501 sec 9.11.4.12 + * @hide */ @VintfStability @JavaDerive(toString=true) diff --git a/radio/aidl/android/hardware/radio/data/OsAppId.aidl b/radio/aidl/android/hardware/radio/data/OsAppId.aidl index 88e7832af0f40f82bf5b88c303477da05af448b1..ae38cf399100ddca3c75ed8eda71dd22791eabba 100644 --- a/radio/aidl/android/hardware/radio/data/OsAppId.aidl +++ b/radio/aidl/android/hardware/radio/data/OsAppId.aidl @@ -18,6 +18,7 @@ package android.hardware.radio.data; /** * This struct represents the OsId + OsAppId as defined in TS 24.526 Section 5.2 + * @hide */ @VintfStability @JavaDerive(toString=true) diff --git a/radio/aidl/android/hardware/radio/data/PcoDataInfo.aidl b/radio/aidl/android/hardware/radio/data/PcoDataInfo.aidl index 38a821fb8505092c6334b469df309519d58b281a..a487bb3389b31fc66adbc8d7683082d9dc702fde 100644 --- a/radio/aidl/android/hardware/radio/data/PcoDataInfo.aidl +++ b/radio/aidl/android/hardware/radio/data/PcoDataInfo.aidl @@ -16,6 +16,7 @@ package android.hardware.radio.data; +/** @hide */ @VintfStability @JavaDerive(toString=true) parcelable PcoDataInfo { diff --git a/radio/aidl/android/hardware/radio/data/PdpProtocolType.aidl b/radio/aidl/android/hardware/radio/data/PdpProtocolType.aidl index 792a503a7d89c37b403cfbd7cc2555ddcef1700a..27e541d8a31afe64d06ddf9037e2ec890f7113fe 100644 --- a/radio/aidl/android/hardware/radio/data/PdpProtocolType.aidl +++ b/radio/aidl/android/hardware/radio/data/PdpProtocolType.aidl @@ -18,6 +18,7 @@ package android.hardware.radio.data; /** * Specifies the type of packet data protocol which is defined in TS 27.007 section 10.1.1. + * @hide */ @VintfStability @Backing(type="int") diff --git a/radio/aidl/android/hardware/radio/data/PortRange.aidl b/radio/aidl/android/hardware/radio/data/PortRange.aidl index 5c83ca4e649e6418e61b009de2863de1e655fffd..732696604941e32f3f2535ec5789646714adbd47 100644 --- a/radio/aidl/android/hardware/radio/data/PortRange.aidl +++ b/radio/aidl/android/hardware/radio/data/PortRange.aidl @@ -20,6 +20,7 @@ package android.hardware.radio.data; * Defines range of ports. start and end are the first and last port numbers (inclusive) in the * range. Both start and end are in PORT_RANGE_MIN to PORT_RANGE_MAX range. A single port shall * be represented by the same start and end value. + * @hide */ @VintfStability @JavaDerive(toString=true) diff --git a/radio/aidl/android/hardware/radio/data/Qos.aidl b/radio/aidl/android/hardware/radio/data/Qos.aidl index d9ab9e70b972917bb9cefe8f324d4619e4d8063e..e98d030cb176496d9eb9d0fe34c6e8eaf679ae4a 100644 --- a/radio/aidl/android/hardware/radio/data/Qos.aidl +++ b/radio/aidl/android/hardware/radio/data/Qos.aidl @@ -21,6 +21,7 @@ import android.hardware.radio.data.NrQos; /** * EPS or NR QOS parameters + * @hide */ @VintfStability @JavaDerive(toString=true) diff --git a/radio/aidl/android/hardware/radio/data/QosBandwidth.aidl b/radio/aidl/android/hardware/radio/data/QosBandwidth.aidl index e841548089f035b64a2a61c61daf7b76826bdf99..f2eca4136c491b0b9f8589076445b3505b60dc22 100644 --- a/radio/aidl/android/hardware/radio/data/QosBandwidth.aidl +++ b/radio/aidl/android/hardware/radio/data/QosBandwidth.aidl @@ -16,6 +16,7 @@ package android.hardware.radio.data; +/** @hide */ @VintfStability @JavaDerive(toString=true) parcelable QosBandwidth { diff --git a/radio/aidl/android/hardware/radio/data/QosFilter.aidl b/radio/aidl/android/hardware/radio/data/QosFilter.aidl index f5dc7ec9c6d9635e33fa1787979dbda4c32895d7..4a2b61dd3a03fb5849a59ee06a848559036f4457 100644 --- a/radio/aidl/android/hardware/radio/data/QosFilter.aidl +++ b/radio/aidl/android/hardware/radio/data/QosFilter.aidl @@ -23,6 +23,7 @@ import android.hardware.radio.data.QosFilterTypeOfService; /** * See 3gpp 24.008 10.5.6.12 and 3gpp 24.501 9.11.4.13 + * @hide */ @VintfStability @JavaDerive(toString=true) diff --git a/radio/aidl/android/hardware/radio/data/QosFilterIpsecSpi.aidl b/radio/aidl/android/hardware/radio/data/QosFilterIpsecSpi.aidl index 5059c28c17ce297d0554b62c269159315f7a70da..83c4fe1b52a9125a735eff41e3deae76f185d2f9 100644 --- a/radio/aidl/android/hardware/radio/data/QosFilterIpsecSpi.aidl +++ b/radio/aidl/android/hardware/radio/data/QosFilterIpsecSpi.aidl @@ -16,6 +16,7 @@ package android.hardware.radio.data; +/** @hide */ @VintfStability @JavaDerive(toString=true) union QosFilterIpsecSpi { diff --git a/radio/aidl/android/hardware/radio/data/QosFilterIpv6FlowLabel.aidl b/radio/aidl/android/hardware/radio/data/QosFilterIpv6FlowLabel.aidl index 6f149348c40c8cd75fd588f576a8537c727184c5..45911742070d7465ba4a982ba8485c4cac973d9b 100644 --- a/radio/aidl/android/hardware/radio/data/QosFilterIpv6FlowLabel.aidl +++ b/radio/aidl/android/hardware/radio/data/QosFilterIpv6FlowLabel.aidl @@ -16,6 +16,7 @@ package android.hardware.radio.data; +/** @hide */ @VintfStability @JavaDerive(toString=true) union QosFilterIpv6FlowLabel { diff --git a/radio/aidl/android/hardware/radio/data/QosFilterTypeOfService.aidl b/radio/aidl/android/hardware/radio/data/QosFilterTypeOfService.aidl index f5770a42ae31950dcc5dbae42d89f40f559f55be..8d27399964e61229ee7ae6ffed11a613f4c1066b 100644 --- a/radio/aidl/android/hardware/radio/data/QosFilterTypeOfService.aidl +++ b/radio/aidl/android/hardware/radio/data/QosFilterTypeOfService.aidl @@ -16,6 +16,7 @@ package android.hardware.radio.data; +/** @hide */ @VintfStability @JavaDerive(toString=true) union QosFilterTypeOfService { diff --git a/radio/aidl/android/hardware/radio/data/QosSession.aidl b/radio/aidl/android/hardware/radio/data/QosSession.aidl index 770b124fe15f2f25e409b50e6d706d6d40c24b51..1a8eb2c881a6216be51e672d4c4526bbda5b90be 100644 --- a/radio/aidl/android/hardware/radio/data/QosSession.aidl +++ b/radio/aidl/android/hardware/radio/data/QosSession.aidl @@ -21,6 +21,7 @@ import android.hardware.radio.data.QosFilter; /** * QOS session associated with a dedicated bearer + * @hide */ @VintfStability @JavaDerive(toString=true) diff --git a/radio/aidl/android/hardware/radio/data/RouteSelectionDescriptor.aidl b/radio/aidl/android/hardware/radio/data/RouteSelectionDescriptor.aidl index 14b0ffcb34cdf8e4efd59841586bdb148061c877..4e9e954db3e7aca87e244064c24923a28cb2842a 100644 --- a/radio/aidl/android/hardware/radio/data/RouteSelectionDescriptor.aidl +++ b/radio/aidl/android/hardware/radio/data/RouteSelectionDescriptor.aidl @@ -21,6 +21,7 @@ import android.hardware.radio.data.SliceInfo; /** * This struct represents a single route selection descriptor as defined in 3GPP TS 24.526. + * @hide */ @VintfStability @JavaDerive(toString=true) diff --git a/radio/aidl/android/hardware/radio/data/SetupDataCallResult.aidl b/radio/aidl/android/hardware/radio/data/SetupDataCallResult.aidl index fee54aceaa9aa63e633275e2d25ea36af9adeddd..b8f01c0cb75bd2810fe87070f5a4a882c31c052f 100644 --- a/radio/aidl/android/hardware/radio/data/SetupDataCallResult.aidl +++ b/radio/aidl/android/hardware/radio/data/SetupDataCallResult.aidl @@ -24,6 +24,7 @@ import android.hardware.radio.data.QosSession; import android.hardware.radio.data.SliceInfo; import android.hardware.radio.data.TrafficDescriptor; +/** @hide */ @VintfStability @JavaDerive(toString=true) parcelable SetupDataCallResult { diff --git a/radio/aidl/android/hardware/radio/data/SliceInfo.aidl b/radio/aidl/android/hardware/radio/data/SliceInfo.aidl index 7ad7fc36a426b9563f90301fc99651ff1760ace0..809b8e07222339dd41195307111d3f7402a3887b 100644 --- a/radio/aidl/android/hardware/radio/data/SliceInfo.aidl +++ b/radio/aidl/android/hardware/radio/data/SliceInfo.aidl @@ -18,6 +18,7 @@ package android.hardware.radio.data; /** * This struct represents a S-NSSAI as defined in 3GPP TS 24.501. + * @hide */ @VintfStability @JavaDerive(toString=true) diff --git a/radio/aidl/android/hardware/radio/data/SlicingConfig.aidl b/radio/aidl/android/hardware/radio/data/SlicingConfig.aidl index e94b58c257e3706561ca5213af13fdb8f573f6b1..47ac41eb840a049210429d5e3ac8da89e947cf00 100644 --- a/radio/aidl/android/hardware/radio/data/SlicingConfig.aidl +++ b/radio/aidl/android/hardware/radio/data/SlicingConfig.aidl @@ -21,6 +21,7 @@ import android.hardware.radio.data.UrspRule; /** * This struct represents the current slicing configuration. + * @hide */ @VintfStability @JavaDerive(toString=true) diff --git a/radio/aidl/android/hardware/radio/data/TrafficDescriptor.aidl b/radio/aidl/android/hardware/radio/data/TrafficDescriptor.aidl index 2c117a5de2584489ed9fc131f967f12fddce5524..098c77abe1159e400483c9376c8c56667fb42883 100644 --- a/radio/aidl/android/hardware/radio/data/TrafficDescriptor.aidl +++ b/radio/aidl/android/hardware/radio/data/TrafficDescriptor.aidl @@ -22,6 +22,7 @@ import android.hardware.radio.data.OsAppId; * This struct represents a traffic descriptor. A valid struct must have at least one of the * optional values present. This is based on the definition of traffic descriptor in * TS 24.526 Section 5.2. + * @hide */ @VintfStability @JavaDerive(toString=true) diff --git a/radio/aidl/android/hardware/radio/data/UrspRule.aidl b/radio/aidl/android/hardware/radio/data/UrspRule.aidl index 0499edd1e2c78df9ace226f561ad9f7dff6add3d..f2028b49c1d622b942816847e338ba79f4c74248 100644 --- a/radio/aidl/android/hardware/radio/data/UrspRule.aidl +++ b/radio/aidl/android/hardware/radio/data/UrspRule.aidl @@ -21,6 +21,7 @@ import android.hardware.radio.data.TrafficDescriptor; /** * This struct represents a single URSP rule as defined in 3GPP TS 24.526. + * @hide */ @VintfStability @JavaDerive(toString=true) diff --git a/radio/aidl/android/hardware/radio/ims/ConnectionFailureInfo.aidl b/radio/aidl/android/hardware/radio/ims/ConnectionFailureInfo.aidl index 70faa1e2e98eb7b2c750c6babbd644198f763bd8..c96f59f337e4cca75d973c62e573a0ba0d08da48 100644 --- a/radio/aidl/android/hardware/radio/ims/ConnectionFailureInfo.aidl +++ b/radio/aidl/android/hardware/radio/ims/ConnectionFailureInfo.aidl @@ -16,10 +16,10 @@ package android.hardware.radio.ims; +/** @hide */ @VintfStability @JavaDerive(toString=true) parcelable ConnectionFailureInfo { - @VintfStability @Backing(type="int") enum ConnectionFailureReason { diff --git a/radio/aidl/android/hardware/radio/ims/EpsFallbackReason.aidl b/radio/aidl/android/hardware/radio/ims/EpsFallbackReason.aidl index 670638b029bb71f4c7a3d2c614da9a45480f2413..5300fbeeefbda53344dafae0ced053770a3c1e8a 100644 --- a/radio/aidl/android/hardware/radio/ims/EpsFallbackReason.aidl +++ b/radio/aidl/android/hardware/radio/ims/EpsFallbackReason.aidl @@ -16,6 +16,7 @@ package android.hardware.radio.ims; +/** @hide */ @VintfStability @JavaDerive(toString=true) @Backing(type="int") diff --git a/radio/aidl/android/hardware/radio/ims/IRadioIms.aidl b/radio/aidl/android/hardware/radio/ims/IRadioIms.aidl index bd661a7224ebb059bddd961468932d68291e32e5..90792f7f8841c6330580a1a2640a5de3ce29a0fa 100644 --- a/radio/aidl/android/hardware/radio/ims/IRadioIms.aidl +++ b/radio/aidl/android/hardware/radio/ims/IRadioIms.aidl @@ -34,6 +34,7 @@ import android.hardware.radio.ims.SrvccCall; * duration of a method call. If clients provide colliding serials (including passing the same * serial to different methods), multiple responses (one for each method call) must still be served. * setResponseFunctions must work with IRadioImsResponse and IRadioImsIndication. + * @hide */ @VintfStability oneway interface IRadioIms { @@ -44,6 +45,8 @@ oneway interface IRadioIms { * @param srvccCalls the list of calls * * Response function is IRadioImsResponse.setSrvccCallInfoResponse() + * + * This is available when android.hardware.telephony.ims is defined. */ void setSrvccCallInfo(int serial, in SrvccCall[] srvccCalls); @@ -59,6 +62,8 @@ oneway interface IRadioIms { * @param imsRegistration IMS registration information * * Response function is IRadioImsResponse.updateImsRegistrationInfoResponse() + * + * This is available when android.hardware.telephony.ims is defined. */ void updateImsRegistrationInfo(int serial, in ImsRegistration imsRegistration); @@ -89,10 +94,11 @@ oneway interface IRadioIms { * mobile terminated use case eg. MO/MT call/SMS etc * * Response function is IRadioImsResponse.startImsTrafficResponse() + * + * This is available when android.hardware.telephony.ims is defined. */ - void startImsTraffic(int serial, int token, - ImsTrafficType imsTrafficType, AccessNetwork accessNetworkType, - ImsCall.Direction trafficDirection); + void startImsTraffic(int serial, int token, ImsTrafficType imsTrafficType, + AccessNetwork accessNetworkType, ImsCall.Direction trafficDirection); /** * Indicates IMS traffic has been stopped. @@ -103,6 +109,8 @@ oneway interface IRadioIms { * @param token The token assigned by startImsTraffic() * * Response function is IRadioImsResponse.stopImsTrafficResponse() + * + * This is available when android.hardware.telephony.ims is defined. */ void stopImsTraffic(int serial, int token); @@ -114,6 +122,8 @@ oneway interface IRadioIms { * @param reason Specifies the reason that causes EPS fallback * * Response function is IRadioImsResponse.triggerEpsFallbackResponse() + * + * This is available when android.hardware.telephony.ims is defined. */ void triggerEpsFallback(int serial, in EpsFallbackReason reason); @@ -122,9 +132,11 @@ oneway interface IRadioIms { * * @param radioImsResponse Object containing response functions * @param radioImsIndication Object containing radio indications + * + * This is available when android.hardware.telephony.ims is defined. */ - void setResponseFunctions(in IRadioImsResponse radioImsResponse, - in IRadioImsIndication radioImsIndication); + void setResponseFunctions( + in IRadioImsResponse radioImsResponse, in IRadioImsIndication radioImsIndication); /** * Access Network Bitrate Recommendation Query (ANBRQ), see 3GPP TS 26.114. @@ -137,8 +149,11 @@ oneway interface IRadioIms { * @param bitsPerSecond The bit rate requested by the opponent UE * * Response function is IRadioImsResponse.sendAnbrQueryResponse() + * + * This is available when android.hardware.telephony.ims is defined. */ - void sendAnbrQuery(int serial, ImsStreamType mediaType, ImsStreamDirection direction, int bitsPerSecond); + void sendAnbrQuery( + int serial, ImsStreamType mediaType, ImsStreamDirection direction, int bitsPerSecond); /** * Provides a list of IMS call information to radio. @@ -147,6 +162,8 @@ oneway interface IRadioIms { * @param imsCalls The list of IMS calls * * Response function is IRadioImsResponse.updateImsCallStatusResponse() + * + * This is available when android.hardware.telephony.ims is defined. */ void updateImsCallStatus(int serial, in ImsCall[] imsCalls); } diff --git a/radio/aidl/android/hardware/radio/ims/IRadioImsIndication.aidl b/radio/aidl/android/hardware/radio/ims/IRadioImsIndication.aidl index d123d07b906b94532ca9271cbec212e72dec0277..58e30cec42737cc8f7697a6805171a37b36d431a 100644 --- a/radio/aidl/android/hardware/radio/ims/IRadioImsIndication.aidl +++ b/radio/aidl/android/hardware/radio/ims/IRadioImsIndication.aidl @@ -24,6 +24,7 @@ import android.hardware.radio.ims.ImsStreamType; /** * Interface declaring unsolicited radio indications for ims APIs. + * @hide */ @VintfStability oneway interface IRadioImsIndication { diff --git a/radio/aidl/android/hardware/radio/ims/IRadioImsResponse.aidl b/radio/aidl/android/hardware/radio/ims/IRadioImsResponse.aidl index ff516cc8f11514e90de9711d5f26ba4e490d2594..ca33d071b7082fb0c5a97094325f238ded59b1ab 100644 --- a/radio/aidl/android/hardware/radio/ims/IRadioImsResponse.aidl +++ b/radio/aidl/android/hardware/radio/ims/IRadioImsResponse.aidl @@ -21,14 +21,15 @@ import android.hardware.radio.ims.ConnectionFailureInfo; /** * Interface declaring response functions to solicited radio requests for ims APIs. + * @hide */ @VintfStability oneway interface IRadioImsResponse { - /** * @param info Response info struct containing response type, serial no. and error * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.ims is not defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:INVALID_STATE @@ -45,6 +46,7 @@ oneway interface IRadioImsResponse { * @param info Response info struct containing response type, serial no. and error * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.ims is not defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:INVALID_STATE @@ -63,6 +65,7 @@ oneway interface IRadioImsResponse { * it should be {@code null}. * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.ims is not defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:INVALID_STATE @@ -73,13 +76,14 @@ oneway interface IRadioImsResponse { * RadioError:INVALID_ARGUMENTS * RadioError:NO_RESOURCES */ - void startImsTrafficResponse(in RadioResponseInfo info, - in @nullable ConnectionFailureInfo failureInfo); + void startImsTrafficResponse( + in RadioResponseInfo info, in @nullable ConnectionFailureInfo failureInfo); /** * @param info Response info struct containing response type, serial no. and error * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.ims is not defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:INVALID_STATE @@ -96,6 +100,7 @@ oneway interface IRadioImsResponse { * @param info Response info struct containing response type, serial no. and error * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.ims is not defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:INVALID_STATE @@ -112,6 +117,7 @@ oneway interface IRadioImsResponse { * @param info Response info struct containing response type, serial no. and error * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.ims is not defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:INVALID_STATE @@ -128,6 +134,7 @@ oneway interface IRadioImsResponse { * @param info Response info struct containing response type, serial no. and error * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.ims is not defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:INVALID_STATE diff --git a/radio/aidl/android/hardware/radio/ims/ImsCall.aidl b/radio/aidl/android/hardware/radio/ims/ImsCall.aidl index b71682fae30a4631d99f433abf6562f58024343b..427c1f53406a7fd20bcccef166fb8c8fe927b44b 100644 --- a/radio/aidl/android/hardware/radio/ims/ImsCall.aidl +++ b/radio/aidl/android/hardware/radio/ims/ImsCall.aidl @@ -18,10 +18,10 @@ package android.hardware.radio.ims; import android.hardware.radio.AccessNetwork; +/** @hide */ @VintfStability @JavaDerive(toString=true) parcelable ImsCall { - @Backing(type="int") enum CallType { NORMAL, diff --git a/radio/aidl/android/hardware/radio/ims/ImsDeregistrationReason.aidl b/radio/aidl/android/hardware/radio/ims/ImsDeregistrationReason.aidl index eac8db44374f7820698fb41ef6f70294dae31ac1..acfe51cd991deb3e94eb9b0f1a4a3f85a8a24021 100644 --- a/radio/aidl/android/hardware/radio/ims/ImsDeregistrationReason.aidl +++ b/radio/aidl/android/hardware/radio/ims/ImsDeregistrationReason.aidl @@ -16,6 +16,7 @@ package android.hardware.radio.ims; +/** @hide */ @VintfStability @JavaDerive(toString=true) @Backing(type="int") diff --git a/radio/aidl/android/hardware/radio/ims/ImsRegistration.aidl b/radio/aidl/android/hardware/radio/ims/ImsRegistration.aidl index 662f9e9a56141b48dfcba0e3a9d66f3298b83478..5158386c8ed3f4cea82f8584b4560250853c040f 100644 --- a/radio/aidl/android/hardware/radio/ims/ImsRegistration.aidl +++ b/radio/aidl/android/hardware/radio/ims/ImsRegistration.aidl @@ -20,6 +20,7 @@ import android.hardware.radio.AccessNetwork; import android.hardware.radio.ims.ImsRegistrationState; import android.hardware.radio.ims.SuggestedAction; +/** @hide */ @VintfStability @JavaDerive(toString=true) parcelable ImsRegistration { diff --git a/radio/aidl/android/hardware/radio/ims/ImsRegistrationState.aidl b/radio/aidl/android/hardware/radio/ims/ImsRegistrationState.aidl index fd5c0fa9304d35439c3723e76ef873fbcc1f4dea..187cb38529ce95689e27c289fa38996670c3ba2d 100644 --- a/radio/aidl/android/hardware/radio/ims/ImsRegistrationState.aidl +++ b/radio/aidl/android/hardware/radio/ims/ImsRegistrationState.aidl @@ -16,6 +16,7 @@ package android.hardware.radio.ims; +/** @hide */ @VintfStability @JavaDerive(toString=true) @Backing(type="int") @@ -25,4 +26,4 @@ enum ImsRegistrationState { /** IMS is successfully registered */ REGISTERED, -} \ No newline at end of file +} diff --git a/radio/aidl/android/hardware/radio/ims/ImsStreamDirection.aidl b/radio/aidl/android/hardware/radio/ims/ImsStreamDirection.aidl index c0cea32230c389aa9274cd72e052c3df20a8cb78..42ce1bd49171d20cbb323dd9f3639ddd810674d3 100644 --- a/radio/aidl/android/hardware/radio/ims/ImsStreamDirection.aidl +++ b/radio/aidl/android/hardware/radio/ims/ImsStreamDirection.aidl @@ -16,6 +16,7 @@ package android.hardware.radio.ims; +/** @hide */ @VintfStability @JavaDerive(toString=true) @Backing(type="int") diff --git a/radio/aidl/android/hardware/radio/ims/ImsStreamType.aidl b/radio/aidl/android/hardware/radio/ims/ImsStreamType.aidl index c12a0c120f7cbb8ad17d9bba76a09b3e1b6d978b..b88dc601be534d8ff50dfd02eea71f3d8cf00055 100644 --- a/radio/aidl/android/hardware/radio/ims/ImsStreamType.aidl +++ b/radio/aidl/android/hardware/radio/ims/ImsStreamType.aidl @@ -16,8 +16,10 @@ package android.hardware.radio.ims; +/** @hide */ @VintfStability @Backing(type="int") +@JavaDerive(toString=true) enum ImsStreamType { /** Media Stream Type - Audio **/ AUDIO = 1, diff --git a/radio/aidl/android/hardware/radio/ims/ImsTrafficType.aidl b/radio/aidl/android/hardware/radio/ims/ImsTrafficType.aidl index 5a824c0d549c89ce3aaf2d2c2b4d9575eb85f1c8..5af43f927909b10b3195f98925bc61782a912b38 100644 --- a/radio/aidl/android/hardware/radio/ims/ImsTrafficType.aidl +++ b/radio/aidl/android/hardware/radio/ims/ImsTrafficType.aidl @@ -16,6 +16,7 @@ package android.hardware.radio.ims; +/** @hide */ @VintfStability @JavaDerive(toString=true) @Backing(type="int") @@ -40,4 +41,4 @@ enum ImsTrafficType { /** Ut/XCAP (XML Configuration Access Protocol) */ UT_XCAP -} \ No newline at end of file +} diff --git a/radio/aidl/android/hardware/radio/ims/SrvccCall.aidl b/radio/aidl/android/hardware/radio/ims/SrvccCall.aidl index 38e6cdbd54c5d66e8ef1d0e70e8990ef2828eb71..16858f96ce01fd8207c69a8a6fd58030ec77b76e 100644 --- a/radio/aidl/android/hardware/radio/ims/SrvccCall.aidl +++ b/radio/aidl/android/hardware/radio/ims/SrvccCall.aidl @@ -16,10 +16,10 @@ package android.hardware.radio.ims; +/** @hide */ @VintfStability @JavaDerive(toString=true) parcelable SrvccCall { - @VintfStability @Backing(type="int") enum CallType { diff --git a/radio/aidl/android/hardware/radio/ims/SuggestedAction.aidl b/radio/aidl/android/hardware/radio/ims/SuggestedAction.aidl index 2d12ed628c4ca95684da8ddafb97e65ac62cd665..f0e28fc8e0a52edc5c1ed059d4b2e9737e2244bb 100644 --- a/radio/aidl/android/hardware/radio/ims/SuggestedAction.aidl +++ b/radio/aidl/android/hardware/radio/ims/SuggestedAction.aidl @@ -16,6 +16,7 @@ package android.hardware.radio.ims; +/** @hide */ @VintfStability @JavaDerive(toString=true) @Backing(type="int") @@ -34,4 +35,18 @@ enum SuggestedAction { * management timer value as per the carrier requirements. */ TRIGGER_PLMN_BLOCK_WITH_TIMEOUT, + /** + * Indicates that the IMS registration on current RAT failed multiple times. + * The radio shall block the current RAT and search for other available RATs in the + * background. If no other RAT is available that meets the carrier requirements, the + * radio may remain on the current RAT for internet service. The radio clears all + * RATs marked as unavailable if {@link IRadioIms#updateImsRegistrationInfo()} API + * with REGISTERED state is invoked. + */ + TRIGGER_RAT_BLOCK, + /** + * Indicates that the radio clears all RATs marked as unavailable and tries to find + * an available RAT that meets the carrier requirements. + */ + TRIGGER_CLEAR_RAT_BLOCK, } diff --git a/radio/aidl/android/hardware/radio/ims/media/AmrMode.aidl b/radio/aidl/android/hardware/radio/ims/media/AmrMode.aidl index 66d8ef096b254ef9b3da8090be2797cf867c7cfc..dc2a16279bef0ce270ab61e769e1b2923edfed95 100644 --- a/radio/aidl/android/hardware/radio/ims/media/AmrMode.aidl +++ b/radio/aidl/android/hardware/radio/ims/media/AmrMode.aidl @@ -16,9 +16,13 @@ package android.hardware.radio.ims.media; -/** AMR codec mode to represent the bit rate. See 3ggp Specs 26.976 & 26.071 */ +/** + * AMR codec mode to represent the bit rate. See 3ggp Specs 26.976 & 26.071 + * @hide + */ @VintfStability @Backing(type="int") +@JavaDerive(toString=true) enum AmrMode { /** 4.75 kbps for AMR / 6.6 kbps for AMR-WB */ AMR_MODE_0 = 1 << 0, diff --git a/radio/aidl/android/hardware/radio/ims/media/AmrParams.aidl b/radio/aidl/android/hardware/radio/ims/media/AmrParams.aidl index 4ed3a24d6601c7a10ea70feed5171f51d6f0211e..9d7ab058d94d553c399c7a8859f7db5a9ac1eb90 100644 --- a/radio/aidl/android/hardware/radio/ims/media/AmrParams.aidl +++ b/radio/aidl/android/hardware/radio/ims/media/AmrParams.aidl @@ -18,7 +18,9 @@ package android.hardware.radio.ims.media; import android.hardware.radio.ims.media.AmrMode; +/** @hide */ @VintfStability +@JavaDerive(toString=true) parcelable AmrParams { /** mode-set: AMR codec mode to represent the bit rate */ AmrMode amrMode; diff --git a/radio/aidl/android/hardware/radio/ims/media/AnbrMode.aidl b/radio/aidl/android/hardware/radio/ims/media/AnbrMode.aidl index f758cd47cce9871416de1ca152ebfc01940816be..af6f92f7a57d4e55d2bfcd7e9fd9f4781d3b187a 100644 --- a/radio/aidl/android/hardware/radio/ims/media/AnbrMode.aidl +++ b/radio/aidl/android/hardware/radio/ims/media/AnbrMode.aidl @@ -18,6 +18,7 @@ package android.hardware.radio.ims.media; import android.hardware.radio.ims.media.CodecMode; +/** @hide */ @VintfStability @JavaDerive(toString=true) parcelable AnbrMode { diff --git a/radio/aidl/android/hardware/radio/ims/media/CallQuality.aidl b/radio/aidl/android/hardware/radio/ims/media/CallQuality.aidl index a8f7b161814684d92ba0138d14cf1c7c0754a2e0..dcf96231f51d7d9adebf45675ffa0ef0d95197c7 100644 --- a/radio/aidl/android/hardware/radio/ims/media/CallQuality.aidl +++ b/radio/aidl/android/hardware/radio/ims/media/CallQuality.aidl @@ -16,7 +16,9 @@ package android.hardware.radio.ims.media; +/** @hide */ @VintfStability +@JavaDerive(toString=true) parcelable CallQuality { /** * downlink CallQualityLevel for a given ongoing call diff --git a/radio/aidl/android/hardware/radio/ims/media/CodecMode.aidl b/radio/aidl/android/hardware/radio/ims/media/CodecMode.aidl index aa1b3a4cf1ae182f95fa9ff6db0536b9443f4c7d..6858ef44e338ceba38b6a5cbb3d433adcd2c3935 100644 --- a/radio/aidl/android/hardware/radio/ims/media/CodecMode.aidl +++ b/radio/aidl/android/hardware/radio/ims/media/CodecMode.aidl @@ -19,6 +19,7 @@ package android.hardware.radio.ims.media; import android.hardware.radio.ims.media.AmrMode; import android.hardware.radio.ims.media.EvsMode; +/** @hide */ @VintfStability @JavaDerive(toString=true) union CodecMode { diff --git a/radio/aidl/android/hardware/radio/ims/media/CodecParams.aidl b/radio/aidl/android/hardware/radio/ims/media/CodecParams.aidl index 0aa55058163c5519973aabdb0e60b85ee78f79df..74de6ecae64f205ab49bf1c82245d85b85fcdf68 100644 --- a/radio/aidl/android/hardware/radio/ims/media/CodecParams.aidl +++ b/radio/aidl/android/hardware/radio/ims/media/CodecParams.aidl @@ -19,7 +19,9 @@ package android.hardware.radio.ims.media; import android.hardware.radio.ims.media.CodecSpecificParams; import android.hardware.radio.ims.media.CodecType; +/** @hide */ @VintfStability +@JavaDerive(toString=true) parcelable CodecParams { /** Negotiated codec type */ CodecType codecType; diff --git a/radio/aidl/android/hardware/radio/ims/media/CodecSpecificParams.aidl b/radio/aidl/android/hardware/radio/ims/media/CodecSpecificParams.aidl index 4410c81bb7a0c8614052a82c6a820ed09d564d06..86dcea0ca1a3e55414f31f61bb5985dd64a8fc89 100644 --- a/radio/aidl/android/hardware/radio/ims/media/CodecSpecificParams.aidl +++ b/radio/aidl/android/hardware/radio/ims/media/CodecSpecificParams.aidl @@ -19,7 +19,9 @@ package android.hardware.radio.ims.media; import android.hardware.radio.ims.media.AmrParams; import android.hardware.radio.ims.media.EvsParams; +/** @hide */ @VintfStability +@JavaDerive(toString=true) union CodecSpecificParams { AmrParams amr; EvsParams evs; diff --git a/radio/aidl/android/hardware/radio/ims/media/CodecType.aidl b/radio/aidl/android/hardware/radio/ims/media/CodecType.aidl index 31218e328e13716565fcc723b15c7e1a568dcacd..99fbac4fdaf4d96f67d87f7f7eec8aa2a55b4976 100644 --- a/radio/aidl/android/hardware/radio/ims/media/CodecType.aidl +++ b/radio/aidl/android/hardware/radio/ims/media/CodecType.aidl @@ -16,8 +16,10 @@ package android.hardware.radio.ims.media; +/** @hide */ @VintfStability @Backing(type="int") +@JavaDerive(toString=true) enum CodecType { /** Adaptive Multi-Rate */ AMR = 1 << 0, diff --git a/radio/aidl/android/hardware/radio/ims/media/DtmfParams.aidl b/radio/aidl/android/hardware/radio/ims/media/DtmfParams.aidl index a7dcb0dc943aa4c9fb68dd872d1e3eac03de6aba..d2926f0dda57130730ecdbda9c5fa99f515c92d2 100644 --- a/radio/aidl/android/hardware/radio/ims/media/DtmfParams.aidl +++ b/radio/aidl/android/hardware/radio/ims/media/DtmfParams.aidl @@ -16,7 +16,9 @@ package android.hardware.radio.ims.media; +/** @hide */ @VintfStability +@JavaDerive(toString=true) parcelable DtmfParams { /** * Dynamic payload type number to be used for DTMF RTP packets received. diff --git a/radio/aidl/android/hardware/radio/ims/media/EvsBandwidth.aidl b/radio/aidl/android/hardware/radio/ims/media/EvsBandwidth.aidl index 8278514bf37ebc6af3094d3b42f36a2a0700c365..279c489927927e2edc3520ed98cafa576751fbae 100644 --- a/radio/aidl/android/hardware/radio/ims/media/EvsBandwidth.aidl +++ b/radio/aidl/android/hardware/radio/ims/media/EvsBandwidth.aidl @@ -15,9 +15,14 @@ */ package android.hardware.radio.ims.media; -/** EVS Speech codec bandwidths, See 3gpp spec 26.441 Table 1 */ + +/** + * EVS Speech codec bandwidths, See 3gpp spec 26.441 Table 1 + * @hide + */ @VintfStability @Backing(type="int") +@JavaDerive(toString=true) enum EvsBandwidth { NONE = 0, NARROW_BAND = 1 << 0, diff --git a/radio/aidl/android/hardware/radio/ims/media/EvsMode.aidl b/radio/aidl/android/hardware/radio/ims/media/EvsMode.aidl index 95bd6c7117cd6f90c3713769e19b8208621fd606..12d981bfc87eb7dc02a8efd8daf169e57366332f 100644 --- a/radio/aidl/android/hardware/radio/ims/media/EvsMode.aidl +++ b/radio/aidl/android/hardware/radio/ims/media/EvsMode.aidl @@ -16,9 +16,13 @@ package android.hardware.radio.ims.media; -/** EVS codec mode to represent the bit rate. See 3ggp Spec 26.952 Table 5.1 */ +/** + * EVS codec mode to represent the bit rate. See 3ggp Spec 26.952 Table 5.1 + * @hide + */ @VintfStability @Backing(type="int") +@JavaDerive(toString=true) enum EvsMode { /** 6.6 kbps for EVS AMR-WB IO */ EVS_MODE_0 = 1 << 0, diff --git a/radio/aidl/android/hardware/radio/ims/media/EvsParams.aidl b/radio/aidl/android/hardware/radio/ims/media/EvsParams.aidl index d138c8387a32d65b2d064efee83eb015c7815556..52c3bf91a63e6812cdd4acaae5634e5c0cc6cfed 100644 --- a/radio/aidl/android/hardware/radio/ims/media/EvsParams.aidl +++ b/radio/aidl/android/hardware/radio/ims/media/EvsParams.aidl @@ -19,7 +19,9 @@ package android.hardware.radio.ims.media; import android.hardware.radio.ims.media.EvsBandwidth; import android.hardware.radio.ims.media.EvsMode; +/** @hide */ @VintfStability +@JavaDerive(toString=true) parcelable EvsParams { /** EVS codec bandwidth */ EvsBandwidth bandwidth; diff --git a/radio/aidl/android/hardware/radio/ims/media/IImsMedia.aidl b/radio/aidl/android/hardware/radio/ims/media/IImsMedia.aidl index ecf137030af0420d9814a0447ab86ffd0e62d511..14fe68bda2a47aecf48fc69affd8c27f8ff0b309 100644 --- a/radio/aidl/android/hardware/radio/ims/media/IImsMedia.aidl +++ b/radio/aidl/android/hardware/radio/ims/media/IImsMedia.aidl @@ -23,14 +23,16 @@ import android.hardware.radio.ims.media.RtpError; /** * This interface is used by IMS media framework to talk to RTP stack located in another processor. + * @hide */ @VintfStability oneway interface IImsMedia { - /** * Set the listener functions for receiving notifications from the RTP stack. * * @param mediaListener Object containing listener methods + * + * This is available when android.hardware.telephony.ims is defined. */ void setListener(in IImsMediaListener mediaListener); @@ -46,6 +48,8 @@ oneway interface IImsMedia { * @param localEndPoint provides IP address, port and logical modem id for local RTP endpoint * @param config provides remote end point info and codec details. This could be null initially * and the application may update this later using modifySession() API. + * + * This is available when android.hardware.telephony.ims is defined. */ void openSession(int sessionId, in LocalEndPoint localEndPoint, in RtpConfig config); @@ -54,6 +58,8 @@ oneway interface IImsMedia { * This shall also close the session specific binder connection opened as part of openSession(). * * @param sessionId identifier for the rtp session that needs to be closed + * + * This is available when android.hardware.telephony.ims is defined. */ void closeSession(int sessionId); } diff --git a/radio/aidl/android/hardware/radio/ims/media/IImsMediaListener.aidl b/radio/aidl/android/hardware/radio/ims/media/IImsMediaListener.aidl index 228acb77d9c3cb9e1d2a315fb69a95c1b59e146b..371edd203729a79b414d3590fbe2975035d966a6 100644 --- a/radio/aidl/android/hardware/radio/ims/media/IImsMediaListener.aidl +++ b/radio/aidl/android/hardware/radio/ims/media/IImsMediaListener.aidl @@ -21,6 +21,7 @@ import android.hardware.radio.ims.media.RtpError; /** * Interface declaring listener functions for unsolicited IMS media notifications. + * @hide */ @VintfStability oneway interface IImsMediaListener { diff --git a/radio/aidl/android/hardware/radio/ims/media/IImsMediaSession.aidl b/radio/aidl/android/hardware/radio/ims/media/IImsMediaSession.aidl index ec2fa2b3cdea02773e8f9fb4f680c49577f7516b..0fe67406ff11002528a919dc0442eed2ba60b93c 100644 --- a/radio/aidl/android/hardware/radio/ims/media/IImsMediaSession.aidl +++ b/radio/aidl/android/hardware/radio/ims/media/IImsMediaSession.aidl @@ -24,6 +24,7 @@ import android.hardware.radio.ims.media.RtpHeaderExtension; /** * Session specific interface used by IMS media framework to talk to the vendor RTP stack. + * @hide */ @VintfStability oneway interface IImsMediaSession { @@ -31,6 +32,8 @@ oneway interface IImsMediaSession { * Set the listener functions to receive IMS media session specific notifications. * * @param sessionListener Object containing notification methods + * + * This is available when android.hardware.telephony.ims is defined. */ void setListener(in IImsMediaSessionListener sessionListener); @@ -39,6 +42,8 @@ oneway interface IImsMediaSession { * the media stream by changing the value of the MediaDirection. * * @param config provides remote end point info and codec details + * + * This is available when android.hardware.telephony.ims is defined. */ void modifySession(in RtpConfig config); @@ -47,6 +52,8 @@ oneway interface IImsMediaSession { * * @param dtmfDigit single char having one of 12 values: 0-9, *, # * @param duration of the key press in milliseconds. + * + * This is available when android.hardware.telephony.ims is defined. */ void sendDtmf(char dtmfDigit, int duration); @@ -56,12 +63,16 @@ oneway interface IImsMediaSession { * stopDtmf() is not received yet, then that digit must be stopped first * * @param dtmfDigit single char having one of 12 values: 0-9, *, # + * + * This is available when android.hardware.telephony.ims is defined. */ void startDtmf(char dtmfDigit); /** * Stop sending the last DTMF digit started by startDtmf(). * stopDtmf() without preceding startDtmf() must be ignored. + * + * This is available when android.hardware.telephony.ims is defined. */ void stopDtmf(); @@ -69,6 +80,8 @@ oneway interface IImsMediaSession { * Send RTP header extension to the other party in the next RTP packet. * * @param extensions data to be transmitted via RTP header extension + * + * This is available when android.hardware.telephony.ims is defined. */ void sendHeaderExtension(in List extensions); @@ -77,6 +90,30 @@ oneway interface IImsMediaSession { * media quality notifications. * * @param threshold media quality thresholds for various quality parameters + * + * This is available when android.hardware.telephony.ims is defined. */ void setMediaQualityThreshold(in MediaQualityThreshold threshold); + + /** + * Queries the current RTP reception statistics of the RTP stream. It will trigger the + IImsMediaSessionListener#notifyRtpReceptionStats(RtpReceptionStats). + * + * @param intervalMs The interval of the time in milliseconds of the RTP reception + * notification. When it is zero, the report is disabled. + * + * This is available when android.hardware.telephony.ims is defined. + */ + void requestRtpReceptionStats(in int intervalMs); + + /** + * Adjust the delay in the jitter buffer to synchronize the audio with the time of video + * frames + * + * @param delayMs The delay to apply to the jitter buffer. If it is positive, the jitter + * buffer increases the delay, if it is negative, the jitter buffer decreases the delay. + * + * This is available when android.hardware.telephony.ims is defined. + */ + void adjustDelay(in int delayMs); } diff --git a/radio/aidl/android/hardware/radio/ims/media/IImsMediaSessionListener.aidl b/radio/aidl/android/hardware/radio/ims/media/IImsMediaSessionListener.aidl index 8341da2bb1ae992eff8ff12b87fba85fc7272772..d3d0b26d6abc351a26f36bdc8016e889a09aeda4 100644 --- a/radio/aidl/android/hardware/radio/ims/media/IImsMediaSessionListener.aidl +++ b/radio/aidl/android/hardware/radio/ims/media/IImsMediaSessionListener.aidl @@ -21,9 +21,11 @@ import android.hardware.radio.ims.media.MediaQualityStatus; import android.hardware.radio.ims.media.RtpConfig; import android.hardware.radio.ims.media.RtpError; import android.hardware.radio.ims.media.RtpHeaderExtension; +import android.hardware.radio.ims.media.RtpReceptionStats; /** * Interface declaring listener functions for unsolicited IMS media notifications per session. + * @hide */ @VintfStability oneway interface IImsMediaSessionListener { @@ -36,6 +38,8 @@ oneway interface IImsMediaSessionListener { * RtpError :INTERNAL_ERR * RtpError :NO_MEMORY * RtpError :NO_RESOURCES + * + * This is available when android.hardware.telephony.ims is defined. */ void onModifySessionResponse(in RtpConfig config, RtpError error); @@ -48,6 +52,8 @@ oneway interface IImsMediaSessionListener { * packets from the most recently added config. * * @param config The remote config where the media is received + * + * This is available when android.hardware.telephony.ims is defined. */ void onFirstMediaPacketReceived(in RtpConfig config); @@ -55,6 +61,8 @@ oneway interface IImsMediaSessionListener { * RTP header extension received from the other party * * @param extensions content of the received RTP header extension + * + * This is available when android.hardware.telephony.ims is defined. */ void onHeaderExtensionReceived(in List extensions); @@ -63,6 +71,8 @@ oneway interface IImsMediaSessionListener { * {@link MediaQualityThreshold} set by {@link IImsMediaSession#setMediaQualityThreshold()}. * * @param quality The object of MediaQualityStatus with the rtp and the rtcp statistics. + * + * This is available when android.hardware.telephony.ims is defined. */ void notifyMediaQualityStatus(in MediaQualityStatus quality); @@ -72,6 +82,8 @@ oneway interface IImsMediaSessionListener { * See 3GPP TS 26.114. * * @param config containing desired bitrate and direction + * + * This is available when android.hardware.telephony.ims is defined. */ void triggerAnbrQuery(in RtpConfig config); @@ -80,6 +92,8 @@ oneway interface IImsMediaSessionListener { * * @param dtmfDigit single char having one of 12 values: 0-9, *, # * @param durationMs The duration to play the tone in milliseconds unit + * + * This is available when android.hardware.telephony.ims is defined. */ void onDtmfReceived(char dtmfDigit, int durationMs); @@ -87,6 +101,18 @@ oneway interface IImsMediaSessionListener { * Notifies when a change to call quality has occurred * * @param CallQuality The call quality statistics of ongoing call since last report + * + * This is available when android.hardware.telephony.ims is defined. */ void onCallQualityChanged(in CallQuality callQuality); + + /** + * Notifies the RTP reception statistics periodically after + * IImsMediaSession#requestRtpReceptionStats(intervalMs) is invoked. + * + * @param stats The RTP reception statistics + * + * This is available when android.hardware.telephony.ims is defined. + */ + void notifyRtpReceptionStats(in RtpReceptionStats stats); } diff --git a/radio/aidl/android/hardware/radio/ims/media/LocalEndPoint.aidl b/radio/aidl/android/hardware/radio/ims/media/LocalEndPoint.aidl index 2bd48c6fd7b1d63e63c69db9a57976b24497ee1b..29f25bbb8283574328c97a6f8bcc69661c34327d 100644 --- a/radio/aidl/android/hardware/radio/ims/media/LocalEndPoint.aidl +++ b/radio/aidl/android/hardware/radio/ims/media/LocalEndPoint.aidl @@ -18,7 +18,9 @@ package android.hardware.radio.ims.media; import android.os.ParcelFileDescriptor; +/** @hide */ @VintfStability +@JavaDerive(toString=true) parcelable LocalEndPoint { /** Socket file descriptor for RTP traffic */ ParcelFileDescriptor rtpFd; diff --git a/radio/aidl/android/hardware/radio/ims/media/MediaDirection.aidl b/radio/aidl/android/hardware/radio/ims/media/MediaDirection.aidl index e5c34c7c1bb9600877b135da524e7b2135d472ae..4ae36dfb8b3400cb1375d2320f5193f66699eb2b 100644 --- a/radio/aidl/android/hardware/radio/ims/media/MediaDirection.aidl +++ b/radio/aidl/android/hardware/radio/ims/media/MediaDirection.aidl @@ -26,9 +26,11 @@ package android.hardware.radio.ims.media; * Receive-Only : RTP_RX | RTCP_TX | RTCP_RX - eg. Remote Hold. * Send-Receive : RTP_TX | RTP_RX | RTCP_TX | RTCP_RX - eg. Active call. * Send-Only : RTP_TX | RTCP_TX | RTCP_RX - eg. Simplex call, voice mail, etc + * @hide */ @VintfStability @Backing(type="int") +@JavaDerive(toString=true) enum MediaDirection { /** * No RTP/RTCP flow in either direction. The implementation diff --git a/radio/aidl/android/hardware/radio/ims/media/MediaQualityStatus.aidl b/radio/aidl/android/hardware/radio/ims/media/MediaQualityStatus.aidl index b99e50152289e5f184a6ed5248efa069edb6be48..b617f911686703261c74dee91f9fc4285bc4c793 100644 --- a/radio/aidl/android/hardware/radio/ims/media/MediaQualityStatus.aidl +++ b/radio/aidl/android/hardware/radio/ims/media/MediaQualityStatus.aidl @@ -16,7 +16,9 @@ package android.hardware.radio.ims.media; +/** @hide */ @VintfStability +@JavaDerive(toString=true) parcelable MediaQualityStatus { /** * Rtp inactivity observed as per threshold set by diff --git a/radio/aidl/android/hardware/radio/ims/media/MediaQualityThreshold.aidl b/radio/aidl/android/hardware/radio/ims/media/MediaQualityThreshold.aidl index bf98928ef0b9bd36f9a87a389d2c2799761d0026..25473d0408a564276513e32e6cfed60c7b5e86ca 100644 --- a/radio/aidl/android/hardware/radio/ims/media/MediaQualityThreshold.aidl +++ b/radio/aidl/android/hardware/radio/ims/media/MediaQualityThreshold.aidl @@ -16,7 +16,9 @@ package android.hardware.radio.ims.media; +/** @hide */ @VintfStability +@JavaDerive(toString=true) parcelable MediaQualityThreshold { /** Array including threshold values in milliseconds for monitoring RTP inactivity */ int[] rtpInactivityTimerMillis; diff --git a/radio/aidl/android/hardware/radio/ims/media/RtcpConfig.aidl b/radio/aidl/android/hardware/radio/ims/media/RtcpConfig.aidl index 98bbfc6aeb1367000f8aebd6dfd60d3acebeedc0..9cb3c0e5955f8f9c93060b726510c106031b75f7 100644 --- a/radio/aidl/android/hardware/radio/ims/media/RtcpConfig.aidl +++ b/radio/aidl/android/hardware/radio/ims/media/RtcpConfig.aidl @@ -16,7 +16,9 @@ package android.hardware.radio.ims.media; +/** @hide */ @VintfStability +@JavaDerive(toString=true) parcelable RtcpConfig { /** Canonical name that will be sent to all session participants */ String canonicalName; diff --git a/radio/aidl/android/hardware/radio/ims/media/RtcpXrReportBlockType.aidl b/radio/aidl/android/hardware/radio/ims/media/RtcpXrReportBlockType.aidl index 7f6839a6bc0f1032c2855cd1b62e5f4415ac0048..88180d7151c26760f1b7ba699838f155a634506f 100644 --- a/radio/aidl/android/hardware/radio/ims/media/RtcpXrReportBlockType.aidl +++ b/radio/aidl/android/hardware/radio/ims/media/RtcpXrReportBlockType.aidl @@ -16,25 +16,28 @@ package android.hardware.radio.ims.media; -/** RTP Control Protocol Extended Reports (RTCP XR) Blocks, See RFC 3611 section 4 */ - +/** + * RTP Control Protocol Extended Reports (RTCP XR) Blocks, See RFC 3611 section 4 + * @hide + */ @VintfStability @Backing(type="int") +@JavaDerive(toString=true) enum RtcpXrReportBlockType { /** Disable RTCP XR */ RTCPXR_NONE = 0, /** Loss RLE Report Block */ - RTCPXR_LOSS_RLE_REPORT_BLOCK = 1 << 0, + RTCPXR_LOSS_RLE_REPORT_BLOCK = 1 << 0, /** Duplicate RLE Report Block */ - RTCPXR_DUPLICATE_RLE_REPORT_BLOCK = 1 << 1, + RTCPXR_DUPLICATE_RLE_REPORT_BLOCK = 1 << 1, /** Packet Receipt Times Report Block */ - RTCPXR_PACKET_RECEIPT_TIMES_REPORT_BLOCK = 1 << 2, + RTCPXR_PACKET_RECEIPT_TIMES_REPORT_BLOCK = 1 << 2, /** Receiver Reference Time Report Block */ - RTCPXR_RECEIVER_REFERENCE_TIME_REPORT_BLOCK = 1 << 3, + RTCPXR_RECEIVER_REFERENCE_TIME_REPORT_BLOCK = 1 << 3, /** DLRR Report Block */ - RTCPXR_DLRR_REPORT_BLOCK = 1 << 4, + RTCPXR_DLRR_REPORT_BLOCK = 1 << 4, /** Statistics Summary Report Block */ - RTCPXR_STATISTICS_SUMMARY_REPORT_BLOCK = 1 << 5, + RTCPXR_STATISTICS_SUMMARY_REPORT_BLOCK = 1 << 5, /** VoIP Metrics Report Block */ - RTCPXR_VOIP_METRICS_REPORT_BLOCK = 1 << 6, + RTCPXR_VOIP_METRICS_REPORT_BLOCK = 1 << 6, } diff --git a/radio/aidl/android/hardware/radio/ims/media/RtpAddress.aidl b/radio/aidl/android/hardware/radio/ims/media/RtpAddress.aidl index 2db73a3fbdf2d79f81a8f6b098b1cfb91edf027f..c17e4b24c532d7fda5847bf85e8c8130b917ebcb 100644 --- a/radio/aidl/android/hardware/radio/ims/media/RtpAddress.aidl +++ b/radio/aidl/android/hardware/radio/ims/media/RtpAddress.aidl @@ -16,7 +16,9 @@ package android.hardware.radio.ims.media; +/** @hide */ @VintfStability +@JavaDerive(toString=true) parcelable RtpAddress { /** Point to point IP address */ String ipAddress; diff --git a/radio/aidl/android/hardware/radio/ims/media/RtpConfig.aidl b/radio/aidl/android/hardware/radio/ims/media/RtpConfig.aidl index f93b1125aaaa164c028de0fba21915ab471eefd1..3c5c4dd7560d2a2054a19f392aeea5f2b4ea5eef 100644 --- a/radio/aidl/android/hardware/radio/ims/media/RtpConfig.aidl +++ b/radio/aidl/android/hardware/radio/ims/media/RtpConfig.aidl @@ -22,7 +22,9 @@ import android.hardware.radio.ims.media.RtcpConfig; import android.hardware.radio.ims.media.RtpAddress; import android.hardware.radio.ims.media.RtpSessionParams; +/** @hide */ @VintfStability +@JavaDerive(toString=true) parcelable RtpConfig { /** Media flow direction. The bitfield of MediaDirection(s) */ int direction; diff --git a/radio/aidl/android/hardware/radio/ims/media/RtpError.aidl b/radio/aidl/android/hardware/radio/ims/media/RtpError.aidl index 11a3468da2cae9cbfbec5ffad3f588cbdc1598b2..84f972f37fa075c82f69a2c8b62cee773045b040 100644 --- a/radio/aidl/android/hardware/radio/ims/media/RtpError.aidl +++ b/radio/aidl/android/hardware/radio/ims/media/RtpError.aidl @@ -16,8 +16,10 @@ package android.hardware.radio.ims.media; +/** @hide */ @VintfStability @Backing(type="int") +@JavaDerive(toString=true) enum RtpError { /** Success */ NONE = 0, diff --git a/radio/aidl/android/hardware/radio/ims/media/RtpHeaderExtension.aidl b/radio/aidl/android/hardware/radio/ims/media/RtpHeaderExtension.aidl index 76b13dc62923cb554e652c14299290438dc18f60..19e855a353c901053733fd62d2f80190d4fe11fc 100644 --- a/radio/aidl/android/hardware/radio/ims/media/RtpHeaderExtension.aidl +++ b/radio/aidl/android/hardware/radio/ims/media/RtpHeaderExtension.aidl @@ -16,8 +16,12 @@ package android.hardware.radio.ims.media; -/** RTP Header Extensions, see RFC 8285 */ +/** + * RTP Header Extensions, see RFC 8285 + * @hide + */ @VintfStability +@JavaDerive(toString=true) parcelable RtpHeaderExtension { /** Local identifier */ int localId; diff --git a/radio/aidl/android/hardware/radio/ims/media/RtpReceptionStats.aidl b/radio/aidl/android/hardware/radio/ims/media/RtpReceptionStats.aidl new file mode 100644 index 0000000000000000000000000000000000000000..1239d13474455b6dc225fb22fb09690eae1c09e1 --- /dev/null +++ b/radio/aidl/android/hardware/radio/ims/media/RtpReceptionStats.aidl @@ -0,0 +1,31 @@ +/* + * Copyright (C) 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.hardware.radio.ims.media; + +@VintfStability +parcelable RtpReceptionStats { + /** The timestamp of the latest RTP packet received */ + int rtpTimestamp; + /** The sequence number of latest RTP packet received */ + int rtpSequenceNumber; + /** The system clock time in millisecond of latest RTP packet received */ + int timeDurationMs; + /** The jitter buffer size in millisecond when latest RTP packet received */ + int jitterBufferMs; + /** The round trip time delay in millisecond when latest RTP packet received */ + int roundTripTimeMs; +} diff --git a/radio/aidl/android/hardware/radio/ims/media/RtpSessionParams.aidl b/radio/aidl/android/hardware/radio/ims/media/RtpSessionParams.aidl index f93c52c088f945d94b11cbaa97274ed6c756a25c..ae5c7e6557ffd5025a8fa8b07f702a735f9caf15 100644 --- a/radio/aidl/android/hardware/radio/ims/media/RtpSessionParams.aidl +++ b/radio/aidl/android/hardware/radio/ims/media/RtpSessionParams.aidl @@ -19,7 +19,9 @@ package android.hardware.radio.ims.media; import android.hardware.radio.ims.media.CodecParams; import android.hardware.radio.ims.media.DtmfParams; +/** @hide */ @VintfStability +@JavaDerive(toString=true) parcelable RtpSessionParams { /** * ptime: Recommended length of time in milliseconds represented by the media diff --git a/radio/aidl/android/hardware/radio/messaging/CdmaBroadcastSmsConfigInfo.aidl b/radio/aidl/android/hardware/radio/messaging/CdmaBroadcastSmsConfigInfo.aidl index 4173f156a2f031a8fd1d19680995aa15d60c4525..35a6a8d9b477d25566d86a4819bba79c2d50e38f 100644 --- a/radio/aidl/android/hardware/radio/messaging/CdmaBroadcastSmsConfigInfo.aidl +++ b/radio/aidl/android/hardware/radio/messaging/CdmaBroadcastSmsConfigInfo.aidl @@ -16,6 +16,7 @@ package android.hardware.radio.messaging; +/** @hide */ @VintfStability @JavaDerive(toString=true) parcelable CdmaBroadcastSmsConfigInfo { diff --git a/radio/aidl/android/hardware/radio/messaging/CdmaSmsAck.aidl b/radio/aidl/android/hardware/radio/messaging/CdmaSmsAck.aidl index 85ef692a86c3aa0833e10017cae7dd7c52fdbf50..2544ab5cf01378381c7a9a4b69f5e26599b35b86 100644 --- a/radio/aidl/android/hardware/radio/messaging/CdmaSmsAck.aidl +++ b/radio/aidl/android/hardware/radio/messaging/CdmaSmsAck.aidl @@ -16,6 +16,7 @@ package android.hardware.radio.messaging; +/** @hide */ @VintfStability @JavaDerive(toString=true) parcelable CdmaSmsAck { diff --git a/radio/aidl/android/hardware/radio/messaging/CdmaSmsAddress.aidl b/radio/aidl/android/hardware/radio/messaging/CdmaSmsAddress.aidl index 8e521df0c12064fbc5f97eb6f59666354e761e6c..a7ad23356580e1b17aa4d70637b1a80b1db1bedc 100644 --- a/radio/aidl/android/hardware/radio/messaging/CdmaSmsAddress.aidl +++ b/radio/aidl/android/hardware/radio/messaging/CdmaSmsAddress.aidl @@ -16,6 +16,7 @@ package android.hardware.radio.messaging; +/** @hide */ @VintfStability @JavaDerive(toString=true) parcelable CdmaSmsAddress { diff --git a/radio/aidl/android/hardware/radio/messaging/CdmaSmsMessage.aidl b/radio/aidl/android/hardware/radio/messaging/CdmaSmsMessage.aidl index d4fb26f411034f4f7d9c2fe45dad3f0777b9c99b..51388b6f6fb90510b28b92f97564a069eb27f362 100644 --- a/radio/aidl/android/hardware/radio/messaging/CdmaSmsMessage.aidl +++ b/radio/aidl/android/hardware/radio/messaging/CdmaSmsMessage.aidl @@ -19,6 +19,7 @@ package android.hardware.radio.messaging; import android.hardware.radio.messaging.CdmaSmsAddress; import android.hardware.radio.messaging.CdmaSmsSubaddress; +/** @hide */ @VintfStability @JavaDerive(toString=true) parcelable CdmaSmsMessage { diff --git a/radio/aidl/android/hardware/radio/messaging/CdmaSmsSubaddress.aidl b/radio/aidl/android/hardware/radio/messaging/CdmaSmsSubaddress.aidl index 18e58370857ff4e6b88b69970b97dfb0f9619eb3..19d84ffb35cc0ed3316adfca64c364beb2cdcbbd 100644 --- a/radio/aidl/android/hardware/radio/messaging/CdmaSmsSubaddress.aidl +++ b/radio/aidl/android/hardware/radio/messaging/CdmaSmsSubaddress.aidl @@ -16,6 +16,7 @@ package android.hardware.radio.messaging; +/** @hide */ @VintfStability @JavaDerive(toString=true) parcelable CdmaSmsSubaddress { diff --git a/radio/aidl/android/hardware/radio/messaging/CdmaSmsWriteArgs.aidl b/radio/aidl/android/hardware/radio/messaging/CdmaSmsWriteArgs.aidl index 41919857dc4d650206016b61575d909355aa6c89..897ec80ce9f0ec4ddb610dae9782fba750c38825 100644 --- a/radio/aidl/android/hardware/radio/messaging/CdmaSmsWriteArgs.aidl +++ b/radio/aidl/android/hardware/radio/messaging/CdmaSmsWriteArgs.aidl @@ -18,6 +18,7 @@ package android.hardware.radio.messaging; import android.hardware.radio.messaging.CdmaSmsMessage; +/** @hide */ @VintfStability @JavaDerive(toString=true) parcelable CdmaSmsWriteArgs { diff --git a/radio/aidl/android/hardware/radio/messaging/GsmBroadcastSmsConfigInfo.aidl b/radio/aidl/android/hardware/radio/messaging/GsmBroadcastSmsConfigInfo.aidl index 5138c3c0d322e333a08dbebf07d8c84e486bdf7a..b4ab51860d9d047e09a849b17878a93f60f9e6e8 100644 --- a/radio/aidl/android/hardware/radio/messaging/GsmBroadcastSmsConfigInfo.aidl +++ b/radio/aidl/android/hardware/radio/messaging/GsmBroadcastSmsConfigInfo.aidl @@ -18,6 +18,7 @@ package android.hardware.radio.messaging; /** * Which types of Cell Broadcast Message (CBM) are to be received by the ME + * @hide */ @VintfStability @JavaDerive(toString=true) diff --git a/radio/aidl/android/hardware/radio/messaging/GsmSmsMessage.aidl b/radio/aidl/android/hardware/radio/messaging/GsmSmsMessage.aidl index b256c9a8bc611b19db80ce87d37ee633c34cd867..9a1a7b97130f28f5844353ff5fe7007b030cbf87 100644 --- a/radio/aidl/android/hardware/radio/messaging/GsmSmsMessage.aidl +++ b/radio/aidl/android/hardware/radio/messaging/GsmSmsMessage.aidl @@ -16,6 +16,7 @@ package android.hardware.radio.messaging; +/** @hide */ @VintfStability @JavaDerive(toString=true) parcelable GsmSmsMessage { diff --git a/radio/aidl/android/hardware/radio/messaging/IRadioMessaging.aidl b/radio/aidl/android/hardware/radio/messaging/IRadioMessaging.aidl index 8bd84a301a5504ee71d2cd9618fbbcc796e669ec..945453c771814e1afb05b652423b4e2fcf492815 100644 --- a/radio/aidl/android/hardware/radio/messaging/IRadioMessaging.aidl +++ b/radio/aidl/android/hardware/radio/messaging/IRadioMessaging.aidl @@ -35,6 +35,7 @@ import android.hardware.radio.messaging.SmsWriteArgs; * duration of a method call. If clients provide colliding serials (including passing the same * serial to different methods), multiple responses (one for each method call) must still be served. * setResponseFunctions must work with IRadioMessagingResponse and IRadioMessagingIndication. + * @hide */ @VintfStability oneway interface IRadioMessaging { @@ -49,6 +50,8 @@ oneway interface IRadioMessaging { * @param ackPdu acknowledgement TPDU in hexadecimal format * * Response function is IRadioMessagingResponse.acknowledgeIncomingGsmSmsWithPduResponse() + * + * This is available when android.hardware.telephony.messaging is defined. */ void acknowledgeIncomingGsmSmsWithPdu(in int serial, in boolean success, in String ackPdu); @@ -60,6 +63,8 @@ oneway interface IRadioMessaging { * @param smsAck Cdma Sms ack to be sent described by CdmaSmsAck * * Response function is IRadioMessagingResponse.acknowledgeLastIncomingCdmaSmsResponse() + * + * This is available when android.hardware.telephony.cdma is defined. */ void acknowledgeLastIncomingCdmaSms(in int serial, in CdmaSmsAck smsAck); @@ -74,6 +79,8 @@ oneway interface IRadioMessaging { * in TS 23.040, 9.2.3.22. * * Response function is IRadioMessagingResponse.acknowledgeLastIncomingGsmSmsResponse() + * + * This is available when android.hardware.telephony.messaging is defined. */ void acknowledgeLastIncomingGsmSms( in int serial, in boolean success, in SmsAcknowledgeFailCause cause); @@ -85,6 +92,8 @@ oneway interface IRadioMessaging { * @param index record index of the message to delete * * Response function is IRadioMessagingResponse.deleteSmsOnRuimResponse() + * + * This is available when android.hardware.telephony.cdma is defined. */ void deleteSmsOnRuim(in int serial, in int index); @@ -95,6 +104,8 @@ oneway interface IRadioMessaging { * @param index Record index of the message to delete. * * Response function is IRadioMessagingResponse.deleteSmsOnSimResponse() + * + * This is available when android.hardware.telephony.messaging is defined. */ void deleteSmsOnSim(in int serial, in int index); @@ -104,6 +115,8 @@ oneway interface IRadioMessaging { * @param serial Serial number of request. * * Response function is IRadioMessagingResponse.getCdmaBroadcastConfigResponse() + * + * This is available when android.hardware.telephony.cdma is defined. */ void getCdmaBroadcastConfig(in int serial); @@ -113,6 +126,8 @@ oneway interface IRadioMessaging { * @param serial Serial number of request. * * Response function is IRadioMessagingResponse.getGsmBroadcastConfigResponse() + * + * This is available when android.hardware.telephony.messaging is defined. */ void getGsmBroadcastConfig(in int serial); @@ -122,6 +137,8 @@ oneway interface IRadioMessaging { * @param serial Serial number of request. * * Response function is IRadioMessagingResponse.getSmscAddressResponse() + * + * This is available when android.hardware.telephony.messaging is defined. */ void getSmscAddress(in int serial); @@ -133,6 +150,8 @@ oneway interface IRadioMessaging { * false if memory capacity is exceeded * * Response function is IRadioMessagingResponse.reportSmsMemoryStatusResponse() + * + * This is available when android.hardware.telephony.messaging is defined. */ void reportSmsMemoryStatus(in int serial, in boolean available); @@ -140,6 +159,8 @@ oneway interface IRadioMessaging { * When response type received from a radio indication or radio response is * RadioIndicationType:UNSOLICITED_ACK_EXP or RadioResponseType:SOLICITED_ACK_EXP respectively, * acknowledge the receipt of those messages by sending responseAcknowledgement(). + * + * This is available when android.hardware.telephony.messaging is defined. */ void responseAcknowledgement(); @@ -150,6 +171,8 @@ oneway interface IRadioMessaging { * @param sms CdmaSmsMessage to be sent * * Response function is IRadioMessagingResponse.sendCdmaSmsResponse() + * + * This is available when android.hardware.telephony.cdma is defined. */ void sendCdmaSms(in int serial, in CdmaSmsMessage sms); @@ -161,6 +184,8 @@ oneway interface IRadioMessaging { * @param sms CdmaSmsMessage to be sent * * Response function is IRadioMessagingResponse.sendCdmaSmsExpectMoreResponse() + * + * This is available when android.hardware.telephony.cdma is defined. */ void sendCdmaSmsExpectMore(in int serial, in CdmaSmsMessage sms); @@ -173,6 +198,8 @@ oneway interface IRadioMessaging { * @param message ImsSmsMessage to be sent * * Response function is IRadioMessagingResponse.sendImsSmsResponse() + * + * This is available when android.hardware.telephony.ims is defined. */ void sendImsSms(in int serial, in ImsSmsMessage message); @@ -185,6 +212,8 @@ oneway interface IRadioMessaging { * @param message GsmSmsMessage to be sent * * Response function is IRadioMessagingResponse.sendSmsResponse() + * + * This is available when android.hardware.telephony.messaging is defined. */ void sendSms(in int serial, in GsmSmsMessage message); @@ -199,6 +228,8 @@ oneway interface IRadioMessaging { * @param message GsmSmsMessage to be sent * * Response function is IRadioMessagingResponse.sendSmsExpectMoreResponse() + * + * This is available when android.hardware.telephony.messaging is defined. */ void sendSmsExpectMore(in int serial, in GsmSmsMessage message); @@ -210,6 +241,8 @@ oneway interface IRadioMessaging { * true = activate, false = turn off * * Response function is IRadioMessagingResponse.setCdmaBroadcastActivationResponse() + * + * This is available when android.hardware.telephony.cdma is defined. */ void setCdmaBroadcastActivation(in int serial, in boolean activate); @@ -220,6 +253,8 @@ oneway interface IRadioMessaging { * @param configInfo CDMA Broadcast SMS config to be set. * * Response function is IRadioMessagingResponse.setCdmaBroadcastConfigResponse() + * + * This is available when android.hardware.telephony.cdma is defined. */ void setCdmaBroadcastConfig(in int serial, in CdmaBroadcastSmsConfigInfo[] configInfo); @@ -231,6 +266,8 @@ oneway interface IRadioMessaging { * Cell Broadcast SMS. true = activate, false = turn off * * Response function is IRadioMessagingResponse.setGsmBroadcastActivationResponse() + * + * This is available when android.hardware.telephony.messaging is defined. */ void setGsmBroadcastActivation(in int serial, in boolean activate); @@ -241,6 +278,8 @@ oneway interface IRadioMessaging { * @param configInfo Setting of GSM/WCDMA Cell broadcast config * * Response function is IRadioMessagingResponse.setGsmBroadcastConfigResponse() + * + * This is available when android.hardware.telephony.messaging is defined. */ void setGsmBroadcastConfig(in int serial, in GsmBroadcastSmsConfigInfo[] configInfo); @@ -249,6 +288,8 @@ oneway interface IRadioMessaging { * * @param radioMessagingResponse Object containing response functions * @param radioMessagingIndication Object containing radio indications + * + * This is available when android.hardware.telephony.messaging is defined. */ void setResponseFunctions(in IRadioMessagingResponse radioMessagingResponse, in IRadioMessagingIndication radioMessagingIndication); @@ -260,6 +301,8 @@ oneway interface IRadioMessaging { * @param smsc Short Message Service Center address to set * * Response function is IRadioMessagingResponse.setSmscAddressResponse() + * + * This is available when android.hardware.telephony.messaging is defined. */ void setSmscAddress(in int serial, in String smsc); @@ -270,6 +313,8 @@ oneway interface IRadioMessaging { * @param cdmaSms CdmaSmsWriteArgs * * Response function is IRadioMessagingResponse.writeSmsToRuimResponse() + * + * This is available when android.hardware.telephony.cdma is defined. */ void writeSmsToRuim(in int serial, in CdmaSmsWriteArgs cdmaSms); @@ -280,6 +325,8 @@ oneway interface IRadioMessaging { * @param smsWriteArgs SmsWriteArgs * * Response function is IRadioMessagingResponse.writeSmsToSimResponse() + * + * This is available when android.hardware.telephony.messaging is defined. */ void writeSmsToSim(in int serial, in SmsWriteArgs smsWriteArgs); } diff --git a/radio/aidl/android/hardware/radio/messaging/IRadioMessagingIndication.aidl b/radio/aidl/android/hardware/radio/messaging/IRadioMessagingIndication.aidl index 8834cd91c07a9a25c263d997b651c49c71668991..a177c2cbddcda29f3d63670b7c432bf0619a54a6 100644 --- a/radio/aidl/android/hardware/radio/messaging/IRadioMessagingIndication.aidl +++ b/radio/aidl/android/hardware/radio/messaging/IRadioMessagingIndication.aidl @@ -21,6 +21,7 @@ import android.hardware.radio.messaging.CdmaSmsMessage; /** * Interface declaring unsolicited radio indications for messaging APIs. + * @hide */ @VintfStability oneway interface IRadioMessagingIndication { diff --git a/radio/aidl/android/hardware/radio/messaging/IRadioMessagingResponse.aidl b/radio/aidl/android/hardware/radio/messaging/IRadioMessagingResponse.aidl index 8cbc869d33f3a7e278a687fe55cd450fe853f7b5..f0d799909b27f2ff836f1107d984ccda93a0bb6b 100644 --- a/radio/aidl/android/hardware/radio/messaging/IRadioMessagingResponse.aidl +++ b/radio/aidl/android/hardware/radio/messaging/IRadioMessagingResponse.aidl @@ -23,6 +23,7 @@ import android.hardware.radio.messaging.SendSmsResult; /** * Interface declaring response functions to solicited radio requests for messaging APIs. + * @hide */ @VintfStability oneway interface IRadioMessagingResponse { @@ -30,6 +31,8 @@ oneway interface IRadioMessagingResponse { * @param info Response info struct containing response type, serial no. and error * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.messaging is not + * defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:INTERNAL_ERR @@ -43,6 +46,7 @@ oneway interface IRadioMessagingResponse { * @param info Response info struct containing response type, serial no. and error * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.cdma is not defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:INVALID_ARGUMENTS @@ -65,6 +69,8 @@ oneway interface IRadioMessagingResponse { * @param info Response info struct containing response type, serial no. and error * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.messaging is not + * defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:INTERNAL_ERR @@ -87,6 +93,7 @@ oneway interface IRadioMessagingResponse { * @param info Response info struct containing response type, serial no. and error * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.cdma is not defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:INVALID_ARGUMENTS @@ -108,6 +115,8 @@ oneway interface IRadioMessagingResponse { * @param info Response info struct containing response type, serial no. and error * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.messaging is not + * defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:SIM_FULL @@ -130,6 +139,7 @@ oneway interface IRadioMessagingResponse { * @param configs Vector of CDMA Broadcast SMS configs. * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.cdma is not defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:INVALID_ARGUMENTS @@ -152,6 +162,8 @@ oneway interface IRadioMessagingResponse { * @param configs Vector of GSM/WCDMA Cell broadcast configs * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.messaging is not + * defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:INVALID_ARGUMENTS @@ -174,6 +186,8 @@ oneway interface IRadioMessagingResponse { * @param smsc Short Message Service Center address on the device * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.messaging is not + * defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:INVALID_ARGUMENTS @@ -195,6 +209,8 @@ oneway interface IRadioMessagingResponse { * @param info Response info struct containing response type, serial no. and error * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.messaging is not + * defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:INVALID_ARGUMENTS @@ -215,6 +231,7 @@ oneway interface IRadioMessagingResponse { * @param sms Response to sms sent as defined by SendSmsResult * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.cdma is not defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:SMS_SEND_FAIL_RETRY @@ -248,6 +265,7 @@ oneway interface IRadioMessagingResponse { * @param sms Sms result struct as defined by SendSmsResult * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.cdma is not defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:INVALID_ARGUMENTS @@ -281,6 +299,7 @@ oneway interface IRadioMessagingResponse { * @param sms Response to sms sent as defined by SendSmsResult * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.ims is not defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:SMS_SEND_FAIL_RETRY @@ -308,6 +327,8 @@ oneway interface IRadioMessagingResponse { * @param sms Response to sms sent as defined by SendSmsResult * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.messaging is not + * defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:SMS_SEND_FAIL_RETRY @@ -340,6 +361,8 @@ oneway interface IRadioMessagingResponse { * @param sms Response to sms sent as defined by SendSmsResult * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.messaging is not + * defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:SMS_SEND_FAIL_RETRY @@ -370,6 +393,7 @@ oneway interface IRadioMessagingResponse { * @param info Response info struct containing response type, serial no. and error * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.cdma is not defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:INVALID_ARGUMENTS @@ -390,6 +414,7 @@ oneway interface IRadioMessagingResponse { * @param info Response info struct containing response type, serial no. and error * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.cdma is not * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:INVALID_ARGUMENTS @@ -409,6 +434,8 @@ oneway interface IRadioMessagingResponse { * @param info Response info struct containing response type, serial no. and error * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.messaging is not + * defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:INVALID_ARGUMENTS @@ -429,6 +456,8 @@ oneway interface IRadioMessagingResponse { * @param info Response info struct containing response type, serial no. and error * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.messaging is not + * defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:INVALID_ARGUMENTS @@ -448,6 +477,8 @@ oneway interface IRadioMessagingResponse { * @param info Response info struct containing response type, serial no. and error * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.messaging is not + * defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:INVALID_ARGUMENTS @@ -470,6 +501,7 @@ oneway interface IRadioMessagingResponse { * @param index record index where the cmda sms message is stored * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.cdma is not defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:INVALID_ARGUMENTS @@ -496,6 +528,8 @@ oneway interface IRadioMessagingResponse { * @param index record index where the message is stored * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.messaging is not + * defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:SIM_FULL diff --git a/radio/aidl/android/hardware/radio/messaging/ImsSmsMessage.aidl b/radio/aidl/android/hardware/radio/messaging/ImsSmsMessage.aidl index d4be04460def4fde81f8db1edeb7e3b79135e71f..5f9f82b7e362ff3fff85fef472118c9ec4c3a9a6 100644 --- a/radio/aidl/android/hardware/radio/messaging/ImsSmsMessage.aidl +++ b/radio/aidl/android/hardware/radio/messaging/ImsSmsMessage.aidl @@ -20,6 +20,7 @@ import android.hardware.radio.RadioTechnologyFamily; import android.hardware.radio.messaging.CdmaSmsMessage; import android.hardware.radio.messaging.GsmSmsMessage; +/** @hide */ @VintfStability @JavaDerive(toString=true) parcelable ImsSmsMessage { diff --git a/radio/aidl/android/hardware/radio/messaging/SendSmsResult.aidl b/radio/aidl/android/hardware/radio/messaging/SendSmsResult.aidl index 80e059c5fb11f5021050ae4eb42a4aa61650654c..ea9372703494902e4a21844ff7d4b210030c3c84 100644 --- a/radio/aidl/android/hardware/radio/messaging/SendSmsResult.aidl +++ b/radio/aidl/android/hardware/radio/messaging/SendSmsResult.aidl @@ -16,6 +16,7 @@ package android.hardware.radio.messaging; +/** @hide */ @VintfStability @JavaDerive(toString=true) parcelable SendSmsResult { diff --git a/radio/aidl/android/hardware/radio/messaging/SmsAcknowledgeFailCause.aidl b/radio/aidl/android/hardware/radio/messaging/SmsAcknowledgeFailCause.aidl index eb15bf1129723516199e78e3c244e2e8798b7174..6f529ebfb1bffed96401a4bdba9e38408b311034 100644 --- a/radio/aidl/android/hardware/radio/messaging/SmsAcknowledgeFailCause.aidl +++ b/radio/aidl/android/hardware/radio/messaging/SmsAcknowledgeFailCause.aidl @@ -16,6 +16,7 @@ package android.hardware.radio.messaging; +/** @hide */ @VintfStability @Backing(type="int") @JavaDerive(toString=true) diff --git a/radio/aidl/android/hardware/radio/messaging/SmsWriteArgs.aidl b/radio/aidl/android/hardware/radio/messaging/SmsWriteArgs.aidl index 6eef9417d783872e39d9306770d302acc9d93d99..64ce606617abae91d666b8a78112876cbc53c1ce 100644 --- a/radio/aidl/android/hardware/radio/messaging/SmsWriteArgs.aidl +++ b/radio/aidl/android/hardware/radio/messaging/SmsWriteArgs.aidl @@ -16,6 +16,7 @@ package android.hardware.radio.messaging; +/** @hide */ @VintfStability @JavaDerive(toString=true) parcelable SmsWriteArgs { diff --git a/radio/aidl/android/hardware/radio/modem/ActivityStatsInfo.aidl b/radio/aidl/android/hardware/radio/modem/ActivityStatsInfo.aidl index b2a56d470df7454ed5bbefbdb651dcdf78254821..db77c51be849f41b737642a2bf43018b5b8c1da6 100644 --- a/radio/aidl/android/hardware/radio/modem/ActivityStatsInfo.aidl +++ b/radio/aidl/android/hardware/radio/modem/ActivityStatsInfo.aidl @@ -18,6 +18,7 @@ package android.hardware.radio.modem; import android.hardware.radio.modem.ActivityStatsTechSpecificInfo; +/** @hide */ @VintfStability @JavaDerive(toString=true) parcelable ActivityStatsInfo { diff --git a/radio/aidl/android/hardware/radio/modem/ActivityStatsTechSpecificInfo.aidl b/radio/aidl/android/hardware/radio/modem/ActivityStatsTechSpecificInfo.aidl index fcc2df20e94a1d79c37c3451d8607232ac221bab..7ca4021bf8c87b3d82813da4da465f67a412a667 100644 --- a/radio/aidl/android/hardware/radio/modem/ActivityStatsTechSpecificInfo.aidl +++ b/radio/aidl/android/hardware/radio/modem/ActivityStatsTechSpecificInfo.aidl @@ -18,6 +18,7 @@ package android.hardware.radio.modem; import android.hardware.radio.AccessNetwork; +/** @hide */ @VintfStability @JavaDerive(toString=true) parcelable ActivityStatsTechSpecificInfo { diff --git a/radio/aidl/android/hardware/radio/modem/DeviceStateType.aidl b/radio/aidl/android/hardware/radio/modem/DeviceStateType.aidl index ad0d59cdf703a08841b7946636912e2ef71d65bf..c1f4cd6b53ac1899a7289aae1ade9b249f06aae5 100644 --- a/radio/aidl/android/hardware/radio/modem/DeviceStateType.aidl +++ b/radio/aidl/android/hardware/radio/modem/DeviceStateType.aidl @@ -16,6 +16,7 @@ package android.hardware.radio.modem; +/** @hide */ @VintfStability @Backing(type="int") @JavaDerive(toString=true) diff --git a/radio/aidl/android/hardware/radio/modem/HardwareConfig.aidl b/radio/aidl/android/hardware/radio/modem/HardwareConfig.aidl index 8eb1f2d1a9454e913a718beac9f01d50f31dd669..323e5c94cddd1b2b835a7d298f0624f3104acea4 100644 --- a/radio/aidl/android/hardware/radio/modem/HardwareConfig.aidl +++ b/radio/aidl/android/hardware/radio/modem/HardwareConfig.aidl @@ -19,6 +19,7 @@ package android.hardware.radio.modem; import android.hardware.radio.modem.HardwareConfigModem; import android.hardware.radio.modem.HardwareConfigSim; +/** @hide */ @VintfStability @JavaDerive(toString=true) parcelable HardwareConfig { diff --git a/radio/aidl/android/hardware/radio/modem/HardwareConfigModem.aidl b/radio/aidl/android/hardware/radio/modem/HardwareConfigModem.aidl index f5e2c278e4673efafd65d5afc64bec240454714e..1ba3562e62fa0d29ae90754e08baee9ff51d337e 100644 --- a/radio/aidl/android/hardware/radio/modem/HardwareConfigModem.aidl +++ b/radio/aidl/android/hardware/radio/modem/HardwareConfigModem.aidl @@ -18,6 +18,7 @@ package android.hardware.radio.modem; import android.hardware.radio.RadioTechnology; +/** @hide */ @VintfStability @JavaDerive(toString=true) parcelable HardwareConfigModem { diff --git a/radio/aidl/android/hardware/radio/modem/HardwareConfigSim.aidl b/radio/aidl/android/hardware/radio/modem/HardwareConfigSim.aidl index c82bc6e44428b47271f04eeed5e478fcd45b6c36..a5747c1a16fd2b424dc3a62c85cabce0424c7890 100644 --- a/radio/aidl/android/hardware/radio/modem/HardwareConfigSim.aidl +++ b/radio/aidl/android/hardware/radio/modem/HardwareConfigSim.aidl @@ -16,6 +16,7 @@ package android.hardware.radio.modem; +/** @hide */ @VintfStability @JavaDerive(toString=true) parcelable HardwareConfigSim { diff --git a/radio/aidl/android/hardware/radio/modem/IRadioModem.aidl b/radio/aidl/android/hardware/radio/modem/IRadioModem.aidl index 2011c53e1382bee723a1339c35333930b82c830f..bfca5a9ef4ddfb9e5051d3970889b07a72ee9d98 100644 --- a/radio/aidl/android/hardware/radio/modem/IRadioModem.aidl +++ b/radio/aidl/android/hardware/radio/modem/IRadioModem.aidl @@ -31,6 +31,7 @@ import android.hardware.radio.modem.ResetNvType; * duration of a method call. If clients provide colliding serials (including passing the same * serial to different methods), multiple responses (one for each method call) must still be served. * setResponseFunctions must work with IRadioModemResponse and IRadioModemIndication. + * @hide */ @VintfStability oneway interface IRadioModem { @@ -47,6 +48,8 @@ oneway interface IRadioModem { * @param on True to turn on the logical modem, otherwise turn it off. * * Response function is IRadioModemResponse.enableModemResponse() + * + * This is available when android.hardware.telephony is defined. */ void enableModem(in int serial, in boolean on); @@ -56,6 +59,8 @@ oneway interface IRadioModem { * @param serial Serial number of request. * * Response function is IRadioModemResponse.getBasebandVersionResponse() + * + * This is available when android.hardware.telephony is defined. */ void getBasebandVersion(in int serial); @@ -67,6 +72,8 @@ oneway interface IRadioModem { * @param serial Serial number of request. * * Response function is IRadioModemResponse.getDeviceIdentityResponse() + * + * This is available when android.hardware.telephony is defined. * @deprecated use getImei(int serial) */ void getDeviceIdentity(in int serial); @@ -77,6 +84,8 @@ oneway interface IRadioModem { * @param serial Serial number of request. * * Response function is IRadioModemResponse.getHardwareConfigResponse() + * + * This is available when android.hardware.telephony is defined. */ void getHardwareConfig(in int serial); @@ -88,6 +97,8 @@ oneway interface IRadioModem { * @param serial Serial number of request. * * Response function is IRadioModemResponse.getModemActivityInfoResponse() + * + * This is available when android.hardware.telephony.radio.access is defined. */ void getModemActivityInfo(in int serial); @@ -98,6 +109,8 @@ oneway interface IRadioModem { * @param serial Serial number of request. * * Response function is IRadioModemResponse.getModemStackStatusResponse() + * + * This is available when android.hardware.telephony is defined. */ void getModemStackStatus(in int serial); @@ -107,6 +120,8 @@ oneway interface IRadioModem { * @param serial Serial number of request. * * Response function is IRadioModemResponse.getRadioCapabilityResponse() + * + * This is available when android.hardware.telephony.radio.access is defined. */ void getRadioCapability(in int serial); @@ -145,6 +160,8 @@ oneway interface IRadioModem { * * Response function is IRadioModemResponse.nvWriteCdmaPrlResponse() * + * This is available when android.hardware.telephony.cdma is defined. + * * @deprecated NV APIs are deprecated starting from Android U. */ void nvWriteCdmaPrl(in int serial, in byte[] prl); @@ -169,6 +186,8 @@ oneway interface IRadioModem { * @param serial Serial number of request. * * Response function is IRadioModemResponse.requestShutdownResponse() + * + * This is available when android.hardware.telephony.radio.access is defined. */ void requestShutdown(in int serial); @@ -176,6 +195,8 @@ oneway interface IRadioModem { * When response type received from a radio indication or radio response is * RadioIndicationType:UNSOLICITED_ACK_EXP or RadioResponseType:SOLICITED_ACK_EXP respectively, * acknowledge the receipt of those messages by sending responseAcknowledgement(). + * + * This is available when android.hardware.telephony is defined. */ void responseAcknowledgement(); @@ -188,6 +209,8 @@ oneway interface IRadioModem { * @param state The updated state. See the definition of state at DeviceStateType. * * Response function is IRadioModemResponse.sendDeviceStateResponse() + * + * This is available when android.hardware.telephony is defined. */ void sendDeviceState(in int serial, in DeviceStateType deviceStateType, in boolean state); @@ -200,6 +223,8 @@ oneway interface IRadioModem { * @param rc RadioCapability structure to be set * * Response function is IRadioModemResponse.setRadioCapabilityResponse() + * + * This is available when android.hardware.telephony.radio.access is defined. */ void setRadioCapability(in int serial, in RadioCapability rc); @@ -224,6 +249,8 @@ oneway interface IRadioModem { * on this modem or not. No effect if forEmergencyCall is false, or powerOn is false. * * Response function is IRadioConfigResponse.setRadioPowerResponse() + * + * This is available when android.hardware.telephony.radio.access is defined. */ void setRadioPower(in int serial, in boolean powerOn, in boolean forEmergencyCall, in boolean preferredForEmergencyCall); @@ -233,6 +260,8 @@ oneway interface IRadioModem { * * @param radioModemResponse Object containing response functions * @param radioModemIndication Object containing radio indications + * + * This is available when android.hardware.telephony is defined. */ void setResponseFunctions(in IRadioModemResponse radioModemResponse, in IRadioModemIndication radioModemIndication); @@ -243,6 +272,8 @@ oneway interface IRadioModem { * @param serial : Serial number of request. * * Response function is IRadioModemResponse.getImeiResponse() + * + * This is available when android.hardware.telephony.gsm is defined. */ - void getImei(in int serial); + void getImei(in int serial); } diff --git a/radio/aidl/android/hardware/radio/modem/IRadioModemIndication.aidl b/radio/aidl/android/hardware/radio/modem/IRadioModemIndication.aidl index c61de99cd66ade0cc61466acf9eb7c10b030e0e5..ba3c510589c7bd397ee659feddbe20700f3f94ca 100644 --- a/radio/aidl/android/hardware/radio/modem/IRadioModemIndication.aidl +++ b/radio/aidl/android/hardware/radio/modem/IRadioModemIndication.aidl @@ -20,9 +20,11 @@ import android.hardware.radio.RadioIndicationType; import android.hardware.radio.modem.HardwareConfig; import android.hardware.radio.modem.RadioCapability; import android.hardware.radio.modem.RadioState; +import android.hardware.radio.modem.ImeiInfo; /** * Interface declaring unsolicited radio indications for modem APIs. + * @hide */ @VintfStability oneway interface IRadioModemIndication { @@ -75,4 +77,12 @@ oneway interface IRadioModemIndication { * @param type Type of radio indication */ void rilConnected(in RadioIndicationType type); + + /** + * Indicates when there is a change in the IMEI mapping. + * + * @param type Type of radio indication + * @param imeiInfo IMEI information + */ + void onImeiMappingChanged(in RadioIndicationType type, in ImeiInfo imeiInfo); } diff --git a/radio/aidl/android/hardware/radio/modem/IRadioModemResponse.aidl b/radio/aidl/android/hardware/radio/modem/IRadioModemResponse.aidl index fd4bffb659e8568aaf398af6900bbf4671bb9430..6d2504c24f8667b1d126cfe9d85288860fc3f956 100644 --- a/radio/aidl/android/hardware/radio/modem/IRadioModemResponse.aidl +++ b/radio/aidl/android/hardware/radio/modem/IRadioModemResponse.aidl @@ -19,11 +19,12 @@ package android.hardware.radio.modem; import android.hardware.radio.RadioResponseInfo; import android.hardware.radio.modem.ActivityStatsInfo; import android.hardware.radio.modem.HardwareConfig; -import android.hardware.radio.modem.RadioCapability; import android.hardware.radio.modem.ImeiInfo; +import android.hardware.radio.modem.RadioCapability; /** * Interface declaring response functions to solicited radio requests for modem APIs. + * @hide */ @VintfStability oneway interface IRadioModemResponse { @@ -40,6 +41,7 @@ oneway interface IRadioModemResponse { * @param info Response info struct containing response type, serial no. and error * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony is not defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:MODEM_ERR @@ -54,6 +56,7 @@ oneway interface IRadioModemResponse { * @param version string containing version string for log reporting * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony is not defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:EMPTY_RECORD @@ -78,6 +81,7 @@ oneway interface IRadioModemResponse { * accessing the device. * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony is not defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:NO_MEMORY @@ -99,6 +103,7 @@ oneway interface IRadioModemResponse { * @param config Array of HardwareConfig of the radio. * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony is not defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE */ @@ -109,6 +114,8 @@ oneway interface IRadioModemResponse { * @param activityInfo modem activity information * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.radio.access is not + * defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:NO_MEMORY @@ -125,6 +132,7 @@ oneway interface IRadioModemResponse { * @param info Response info struct containing response type, serial no. and error * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony is not defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:MODEM_ERR @@ -136,6 +144,8 @@ oneway interface IRadioModemResponse { * @param rc Radio capability as defined by RadioCapability in types.hal * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.radio.access is not + * defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:OPERATION_NOT_ALLOWED @@ -174,6 +184,7 @@ oneway interface IRadioModemResponse { * @param info Response info struct containing response type, serial no. and error * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.cdma is not defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * @@ -196,6 +207,8 @@ oneway interface IRadioModemResponse { * @param info Response info struct containing response type, serial no. and error * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.radio.access is not + * defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:OPERATION_NOT_ALLOWED @@ -211,6 +224,7 @@ oneway interface IRadioModemResponse { * @param info Response info struct containing response type, serial no. and error * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony is not defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:NO_MEMORY @@ -228,6 +242,8 @@ oneway interface IRadioModemResponse { * feedback return status * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.radio.access is not + * defined * RadioError:NONE means a unsol radioCapability() will be sent within 30 seconds. * RadioError:RADIO_NOT_AVAILABLE * RadioError:OPERATION_NOT_ALLOWED @@ -246,6 +262,8 @@ oneway interface IRadioModemResponse { * @param info Response info struct containing response type, serial no. and error * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.radio.access is not + * defined * RadioError:NONE * RadioError:INTERNAL_ERR * RadioError:INVALID_ARGUMENTS @@ -264,6 +282,7 @@ oneway interface IRadioModemResponse { * @param imeiInfo IMEI information * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.gsm is not defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:MODEM_ERR diff --git a/radio/aidl/android/hardware/radio/modem/ImeiInfo.aidl b/radio/aidl/android/hardware/radio/modem/ImeiInfo.aidl index 2d25bb71c1e979bc9d0b861339041c906c4929b7..6d33505233dd8a11a211d0231b2a01e6261c826f 100644 --- a/radio/aidl/android/hardware/radio/modem/ImeiInfo.aidl +++ b/radio/aidl/android/hardware/radio/modem/ImeiInfo.aidl @@ -18,26 +18,25 @@ package android.hardware.radio.modem; /** * ImeiInfo to encapsulate the IMEI information from modem + * @hide */ - @VintfStability @JavaDerive(toString=true) parcelable ImeiInfo { - @VintfStability @Backing(type="int") /** * ImeiType enum is used identify the IMEI as primary or secondary as mentioned in GSMA TS.37 */ enum ImeiType { - /** - * This is the primary IMEI of the device as mentioned in the GSMA TS.37. In a multi-SIM - * device the modem must set one IMEI with this type as mentioned in GSMA TS37_2.2_REQ_8. - * A single SIM with one IMEI must by default set that IMEI with this type. - */ - PRIMARY = 1, - /** This is not the primary IMEI of the device */ - SECONDARY = 2, + /** + * This is the primary IMEI of the device as mentioned in the GSMA TS.37. In a multi-SIM + * device the modem must set one IMEI with this type as mentioned in GSMA TS37_2.2_REQ_8. + * A single SIM with one IMEI must by default set that IMEI with this type. + */ + PRIMARY = 1, + /** This is not the primary IMEI of the device */ + SECONDARY = 2, } /** Primary or secondary IMEI as mentioned in GSMA spec TS.37 */ @@ -48,8 +47,8 @@ parcelable ImeiInfo { * SIM activations or swaps. */ String imei; - /** + /** * IMEI software version, see 3gpp spec 23.003 section 6. */ String svn; -} \ No newline at end of file +} diff --git a/radio/aidl/android/hardware/radio/modem/NvItem.aidl b/radio/aidl/android/hardware/radio/modem/NvItem.aidl index 310b1ad60192132e6f8b5764ab48db6476c5e32d..b405137f5628842f6a004683745a164decf4fb66 100644 --- a/radio/aidl/android/hardware/radio/modem/NvItem.aidl +++ b/radio/aidl/android/hardware/radio/modem/NvItem.aidl @@ -16,7 +16,10 @@ package android.hardware.radio.modem; -/** @deprecated NV APIs are deprecated starting from Android U. */ +/** + * @deprecated NV APIs are deprecated starting from Android U. + * @hide + */ @VintfStability @Backing(type="int") @JavaDerive(toString=true) diff --git a/radio/aidl/android/hardware/radio/modem/NvWriteItem.aidl b/radio/aidl/android/hardware/radio/modem/NvWriteItem.aidl index 6472f23d785aefbf53e6936c4882b058ad4f4526..c57253b76be1ded7b546d817fbca570bc550f359 100644 --- a/radio/aidl/android/hardware/radio/modem/NvWriteItem.aidl +++ b/radio/aidl/android/hardware/radio/modem/NvWriteItem.aidl @@ -18,7 +18,10 @@ package android.hardware.radio.modem; import android.hardware.radio.modem.NvItem; -/** @deprecated NV APIs are deprecated starting from Android U. */ +/** + * @deprecated NV APIs are deprecated starting from Android U. + * @hide + */ @VintfStability @JavaDerive(toString=true) parcelable NvWriteItem { diff --git a/radio/aidl/android/hardware/radio/modem/RadioCapability.aidl b/radio/aidl/android/hardware/radio/modem/RadioCapability.aidl index 16cba09248f7e32fd1e631e70d22284759aaee8e..97815958628eedd9a957a131bea00f16e4c4bce6 100644 --- a/radio/aidl/android/hardware/radio/modem/RadioCapability.aidl +++ b/radio/aidl/android/hardware/radio/modem/RadioCapability.aidl @@ -16,6 +16,7 @@ package android.hardware.radio.modem; +/** @hide */ @VintfStability @JavaDerive(toString=true) parcelable RadioCapability { diff --git a/radio/aidl/android/hardware/radio/modem/RadioState.aidl b/radio/aidl/android/hardware/radio/modem/RadioState.aidl index dedad25483c82b44f14d244677938c9094f19faa..c36dbe08e4997208de82b7ad8077b31783dabfa8 100644 --- a/radio/aidl/android/hardware/radio/modem/RadioState.aidl +++ b/radio/aidl/android/hardware/radio/modem/RadioState.aidl @@ -16,6 +16,7 @@ package android.hardware.radio.modem; +/** @hide */ @VintfStability @Backing(type="int") @JavaDerive(toString=true) diff --git a/radio/aidl/android/hardware/radio/modem/ResetNvType.aidl b/radio/aidl/android/hardware/radio/modem/ResetNvType.aidl index 6476fe87043c5e9907e4ea300fb6f4a935bdc4a6..e290a52635e4c763335b85f07db3004606c6c8e5 100644 --- a/radio/aidl/android/hardware/radio/modem/ResetNvType.aidl +++ b/radio/aidl/android/hardware/radio/modem/ResetNvType.aidl @@ -16,7 +16,10 @@ package android.hardware.radio.modem; -/** Note: This will be deprecated along with nvResetConfig in Android U. */ +/** + * Note: This will be deprecated along with nvResetConfig in Android U. + * @hide + */ @VintfStability @Backing(type="int") @JavaDerive(toString=true) diff --git a/radio/aidl/android/hardware/radio/network/AccessTechnologySpecificInfo.aidl b/radio/aidl/android/hardware/radio/network/AccessTechnologySpecificInfo.aidl index 8b95ced7e8e9a22866be6b9fe2f74ec4a4afff73..9c48a8d83815c69ce68211c5d2ff4666f20d2c74 100644 --- a/radio/aidl/android/hardware/radio/network/AccessTechnologySpecificInfo.aidl +++ b/radio/aidl/android/hardware/radio/network/AccessTechnologySpecificInfo.aidl @@ -20,6 +20,7 @@ import android.hardware.radio.network.Cdma2000RegistrationInfo; import android.hardware.radio.network.EutranRegistrationInfo; import android.hardware.radio.network.NrVopsInfo; +/** @hide */ @VintfStability @JavaDerive(toString=true) union AccessTechnologySpecificInfo { diff --git a/radio/aidl/android/hardware/radio/network/BarringInfo.aidl b/radio/aidl/android/hardware/radio/network/BarringInfo.aidl index 2759406689dbcbb237f672a0d63da4d285f2ccff..f12e35c0930c0d3a1ffb3e9c5c642c02357bfadc 100644 --- a/radio/aidl/android/hardware/radio/network/BarringInfo.aidl +++ b/radio/aidl/android/hardware/radio/network/BarringInfo.aidl @@ -18,6 +18,7 @@ package android.hardware.radio.network; import android.hardware.radio.network.BarringTypeSpecificInfo; +/** @hide */ @VintfStability @JavaDerive(toString=true) parcelable BarringInfo { diff --git a/radio/aidl/android/hardware/radio/network/BarringTypeSpecificInfo.aidl b/radio/aidl/android/hardware/radio/network/BarringTypeSpecificInfo.aidl index 3db3bf36a5e30cd38b2c2705ab81b734faeefad6..b4a3bdfcf662fb8f0ed4da61be33ef3a498de0a8 100644 --- a/radio/aidl/android/hardware/radio/network/BarringTypeSpecificInfo.aidl +++ b/radio/aidl/android/hardware/radio/network/BarringTypeSpecificInfo.aidl @@ -16,6 +16,7 @@ package android.hardware.radio.network; +/** @hide */ @VintfStability @JavaDerive(toString=true) parcelable BarringTypeSpecificInfo { diff --git a/radio/aidl/android/hardware/radio/network/Cdma2000RegistrationInfo.aidl b/radio/aidl/android/hardware/radio/network/Cdma2000RegistrationInfo.aidl index b06fabb5422f01c2b701d72660e2807b3989e7ed..91b85004c7884a4b646c96038489d7da4629872e 100644 --- a/radio/aidl/android/hardware/radio/network/Cdma2000RegistrationInfo.aidl +++ b/radio/aidl/android/hardware/radio/network/Cdma2000RegistrationInfo.aidl @@ -16,6 +16,7 @@ package android.hardware.radio.network; +/** @hide */ @VintfStability @JavaDerive(toString=true) parcelable Cdma2000RegistrationInfo { diff --git a/radio/aidl/android/hardware/radio/network/CdmaRoamingType.aidl b/radio/aidl/android/hardware/radio/network/CdmaRoamingType.aidl index 2fea519a2a54eb859d6b7b395e797ad5669ef3a2..0bb7c0410a0a4c11efae200a1a0262511b7369a2 100644 --- a/radio/aidl/android/hardware/radio/network/CdmaRoamingType.aidl +++ b/radio/aidl/android/hardware/radio/network/CdmaRoamingType.aidl @@ -16,6 +16,7 @@ package android.hardware.radio.network; +/** @hide */ @VintfStability @Backing(type="int") @JavaDerive(toString=true) diff --git a/radio/aidl/android/hardware/radio/network/CdmaSignalStrength.aidl b/radio/aidl/android/hardware/radio/network/CdmaSignalStrength.aidl index 1286f67fc9d523bb1d00c36c425e30a0b77a7961..ae7aa93236e0d0ee27a32a22b1ba8d276c9fe10d 100644 --- a/radio/aidl/android/hardware/radio/network/CdmaSignalStrength.aidl +++ b/radio/aidl/android/hardware/radio/network/CdmaSignalStrength.aidl @@ -16,6 +16,7 @@ package android.hardware.radio.network; +/** @hide */ @VintfStability @JavaDerive(toString=true) parcelable CdmaSignalStrength { diff --git a/radio/aidl/android/hardware/radio/network/CellConnectionStatus.aidl b/radio/aidl/android/hardware/radio/network/CellConnectionStatus.aidl index da36ff06f073a683d6482b7a9d54a040c52b6740..3bc19e1670f21b16fb8c4d05a4025a43ea81fe90 100644 --- a/radio/aidl/android/hardware/radio/network/CellConnectionStatus.aidl +++ b/radio/aidl/android/hardware/radio/network/CellConnectionStatus.aidl @@ -16,6 +16,7 @@ package android.hardware.radio.network; +/** @hide */ @VintfStability @Backing(type="int") @JavaDerive(toString=true) diff --git a/radio/aidl/android/hardware/radio/network/CellIdentity.aidl b/radio/aidl/android/hardware/radio/network/CellIdentity.aidl index e34866b2f46feb740601cf125e16edf272b995dc..61420876804dc8cc7e7c47e0bd444f932c2c463d 100644 --- a/radio/aidl/android/hardware/radio/network/CellIdentity.aidl +++ b/radio/aidl/android/hardware/radio/network/CellIdentity.aidl @@ -25,6 +25,7 @@ import android.hardware.radio.network.CellIdentityWcdma; /** * A union representing the CellIdentity of a single cell. + * @hide */ @VintfStability @JavaDerive(toString=true) diff --git a/radio/aidl/android/hardware/radio/network/CellIdentityCdma.aidl b/radio/aidl/android/hardware/radio/network/CellIdentityCdma.aidl index 5bb26c1c94eb1b4c27ef13a20abbc41cc0bd7fdb..b93988fd2ee5c38768f817e059b7bcde95c86834 100644 --- a/radio/aidl/android/hardware/radio/network/CellIdentityCdma.aidl +++ b/radio/aidl/android/hardware/radio/network/CellIdentityCdma.aidl @@ -18,6 +18,7 @@ package android.hardware.radio.network; import android.hardware.radio.network.OperatorInfo; +/** @hide */ @VintfStability @JavaDerive(toString=true) parcelable CellIdentityCdma { diff --git a/radio/aidl/android/hardware/radio/network/CellIdentityGsm.aidl b/radio/aidl/android/hardware/radio/network/CellIdentityGsm.aidl index 60f42b652d81d245852e4a3da15d3fcd401408d6..bc02adc28dcc18b1a46f1d41f45fbf1797363bd8 100644 --- a/radio/aidl/android/hardware/radio/network/CellIdentityGsm.aidl +++ b/radio/aidl/android/hardware/radio/network/CellIdentityGsm.aidl @@ -18,6 +18,7 @@ package android.hardware.radio.network; import android.hardware.radio.network.OperatorInfo; +/** @hide */ @VintfStability @JavaDerive(toString=true) parcelable CellIdentityGsm { diff --git a/radio/aidl/android/hardware/radio/network/CellIdentityLte.aidl b/radio/aidl/android/hardware/radio/network/CellIdentityLte.aidl index bfa58acf0553fbd63189145cae92537749065fae..27c25809b5b1fea3464a8f84c1058a5e8cc44812 100644 --- a/radio/aidl/android/hardware/radio/network/CellIdentityLte.aidl +++ b/radio/aidl/android/hardware/radio/network/CellIdentityLte.aidl @@ -20,6 +20,7 @@ import android.hardware.radio.network.ClosedSubscriberGroupInfo; import android.hardware.radio.network.EutranBands; import android.hardware.radio.network.OperatorInfo; +/** @hide */ @VintfStability @JavaDerive(toString=true) parcelable CellIdentityLte { diff --git a/radio/aidl/android/hardware/radio/network/CellIdentityNr.aidl b/radio/aidl/android/hardware/radio/network/CellIdentityNr.aidl index d51a18ec90c1bd445fda5aa405ec8dc451c59997..419284567f707a723e2e2f0278cef8348a4afb90 100644 --- a/radio/aidl/android/hardware/radio/network/CellIdentityNr.aidl +++ b/radio/aidl/android/hardware/radio/network/CellIdentityNr.aidl @@ -22,6 +22,7 @@ import android.hardware.radio.network.OperatorInfo; /** * The CellIdentity structure should be reported once for each element of the PLMN-IdentityInfoList * broadcast in SIB1 CellAccessRelatedInfo as per 3GPP TS 38.331 Section 6.3.2. + * @hide */ @VintfStability @JavaDerive(toString=true) diff --git a/radio/aidl/android/hardware/radio/network/CellIdentityTdscdma.aidl b/radio/aidl/android/hardware/radio/network/CellIdentityTdscdma.aidl index f6e790f64f3fb769359530cd7042aff47c7078f6..33ffc6f6101b40f5f720e8201fadf6a37214e1b9 100644 --- a/radio/aidl/android/hardware/radio/network/CellIdentityTdscdma.aidl +++ b/radio/aidl/android/hardware/radio/network/CellIdentityTdscdma.aidl @@ -19,6 +19,7 @@ package android.hardware.radio.network; import android.hardware.radio.network.ClosedSubscriberGroupInfo; import android.hardware.radio.network.OperatorInfo; +/** @hide */ @VintfStability @JavaDerive(toString=true) parcelable CellIdentityTdscdma { diff --git a/radio/aidl/android/hardware/radio/network/CellIdentityWcdma.aidl b/radio/aidl/android/hardware/radio/network/CellIdentityWcdma.aidl index a76509b3dc60fc97f8c34e0f6f0d0af6e276dc5c..b6e328a2f4a16d3c8002662cb8edea0c4d61d2b6 100644 --- a/radio/aidl/android/hardware/radio/network/CellIdentityWcdma.aidl +++ b/radio/aidl/android/hardware/radio/network/CellIdentityWcdma.aidl @@ -19,6 +19,7 @@ package android.hardware.radio.network; import android.hardware.radio.network.ClosedSubscriberGroupInfo; import android.hardware.radio.network.OperatorInfo; +/** @hide */ @VintfStability @JavaDerive(toString=true) parcelable CellIdentityWcdma { diff --git a/radio/aidl/android/hardware/radio/network/CellInfo.aidl b/radio/aidl/android/hardware/radio/network/CellInfo.aidl index 161ac718a6bd7c04a7eec6f6555e3266856d179c..4895326db4bdc524858805643f2b80ffc62bc22c 100644 --- a/radio/aidl/android/hardware/radio/network/CellInfo.aidl +++ b/radio/aidl/android/hardware/radio/network/CellInfo.aidl @@ -19,6 +19,7 @@ package android.hardware.radio.network; import android.hardware.radio.network.CellConnectionStatus; import android.hardware.radio.network.CellInfoRatSpecificInfo; +/** @hide */ @VintfStability @JavaDerive(toString=true) parcelable CellInfo { diff --git a/radio/aidl/android/hardware/radio/network/CellInfoCdma.aidl b/radio/aidl/android/hardware/radio/network/CellInfoCdma.aidl index 540810420968aae501f71bdceabb31259ea76bfa..0a2bc542137ebea9d77ad40eb10602a5388ae874 100644 --- a/radio/aidl/android/hardware/radio/network/CellInfoCdma.aidl +++ b/radio/aidl/android/hardware/radio/network/CellInfoCdma.aidl @@ -20,6 +20,7 @@ import android.hardware.radio.network.CdmaSignalStrength; import android.hardware.radio.network.CellIdentityCdma; import android.hardware.radio.network.EvdoSignalStrength; +/** @hide */ @VintfStability @JavaDerive(toString=true) parcelable CellInfoCdma { diff --git a/radio/aidl/android/hardware/radio/network/CellInfoGsm.aidl b/radio/aidl/android/hardware/radio/network/CellInfoGsm.aidl index cadcd913d0778cc4e32f44d2167ce42f93dbfae1..db845108850bc033db53e010d27a1ffd103a428a 100644 --- a/radio/aidl/android/hardware/radio/network/CellInfoGsm.aidl +++ b/radio/aidl/android/hardware/radio/network/CellInfoGsm.aidl @@ -19,6 +19,7 @@ package android.hardware.radio.network; import android.hardware.radio.network.CellIdentityGsm; import android.hardware.radio.network.GsmSignalStrength; +/** @hide */ @VintfStability @JavaDerive(toString=true) parcelable CellInfoGsm { diff --git a/radio/aidl/android/hardware/radio/network/CellInfoLte.aidl b/radio/aidl/android/hardware/radio/network/CellInfoLte.aidl index 443a6689a7ca853381b23c517ae701c4700c25e5..3d9b2f30735d240c11a288d70e3162e5d7a521d0 100644 --- a/radio/aidl/android/hardware/radio/network/CellInfoLte.aidl +++ b/radio/aidl/android/hardware/radio/network/CellInfoLte.aidl @@ -19,6 +19,7 @@ package android.hardware.radio.network; import android.hardware.radio.network.CellIdentityLte; import android.hardware.radio.network.LteSignalStrength; +/** @hide */ @VintfStability @JavaDerive(toString=true) parcelable CellInfoLte { diff --git a/radio/aidl/android/hardware/radio/network/CellInfoNr.aidl b/radio/aidl/android/hardware/radio/network/CellInfoNr.aidl index 6b3d4f4ec9bdbeedb4ed41107688a314eb026378..61591a931ab08607b4f198e4d36087afaf754532 100644 --- a/radio/aidl/android/hardware/radio/network/CellInfoNr.aidl +++ b/radio/aidl/android/hardware/radio/network/CellInfoNr.aidl @@ -19,6 +19,7 @@ package android.hardware.radio.network; import android.hardware.radio.network.CellIdentityNr; import android.hardware.radio.network.NrSignalStrength; +/** @hide */ @VintfStability @JavaDerive(toString=true) parcelable CellInfoNr { diff --git a/radio/aidl/android/hardware/radio/network/CellInfoRatSpecificInfo.aidl b/radio/aidl/android/hardware/radio/network/CellInfoRatSpecificInfo.aidl index 76e92a4b3e2d7b68d1af817d8cd9480f80ba6025..10a4a5f993a8d35fb733b50e9f3832ac982f8dd8 100644 --- a/radio/aidl/android/hardware/radio/network/CellInfoRatSpecificInfo.aidl +++ b/radio/aidl/android/hardware/radio/network/CellInfoRatSpecificInfo.aidl @@ -23,6 +23,7 @@ import android.hardware.radio.network.CellInfoNr; import android.hardware.radio.network.CellInfoTdscdma; import android.hardware.radio.network.CellInfoWcdma; +/** @hide */ @VintfStability @JavaDerive(toString=true) union CellInfoRatSpecificInfo { diff --git a/radio/aidl/android/hardware/radio/network/CellInfoTdscdma.aidl b/radio/aidl/android/hardware/radio/network/CellInfoTdscdma.aidl index fb9c984b47bd36a8a176ca0e4da1dd0608efeff2..ff0fff312178bc0f459db5cf9db1369f4241a701 100644 --- a/radio/aidl/android/hardware/radio/network/CellInfoTdscdma.aidl +++ b/radio/aidl/android/hardware/radio/network/CellInfoTdscdma.aidl @@ -19,6 +19,7 @@ package android.hardware.radio.network; import android.hardware.radio.network.CellIdentityTdscdma; import android.hardware.radio.network.TdscdmaSignalStrength; +/** @hide */ @VintfStability @JavaDerive(toString=true) parcelable CellInfoTdscdma { diff --git a/radio/aidl/android/hardware/radio/network/CellInfoWcdma.aidl b/radio/aidl/android/hardware/radio/network/CellInfoWcdma.aidl index 2d6a2e55d977ff19fca0c47d6435abdab46f2f0a..c38e306dbf4dcd8c628cb32b0a6c73ca5f459797 100644 --- a/radio/aidl/android/hardware/radio/network/CellInfoWcdma.aidl +++ b/radio/aidl/android/hardware/radio/network/CellInfoWcdma.aidl @@ -19,6 +19,7 @@ package android.hardware.radio.network; import android.hardware.radio.network.CellIdentityWcdma; import android.hardware.radio.network.WcdmaSignalStrength; +/** @hide */ @VintfStability @JavaDerive(toString=true) parcelable CellInfoWcdma { diff --git a/radio/aidl/android/hardware/radio/network/CellularIdentifier.aidl b/radio/aidl/android/hardware/radio/network/CellularIdentifier.aidl new file mode 100644 index 0000000000000000000000000000000000000000..6d43920532bee08e8018dabb5c7bb6edf5f41a58 --- /dev/null +++ b/radio/aidl/android/hardware/radio/network/CellularIdentifier.aidl @@ -0,0 +1,28 @@ +/* + * Copyright 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.hardware.radio.network; + +/** @hide **/ +@VintfStability +@Backing(type="int") +@JavaDerive(toString=true) +enum CellularIdentifier { + UNKNOWN = 0, + IMSI = 1, + IMEI = 2, + SUCI = 3, +} diff --git a/radio/aidl/android/hardware/radio/network/CellularIdentifierDisclosure.aidl b/radio/aidl/android/hardware/radio/network/CellularIdentifierDisclosure.aidl new file mode 100644 index 0000000000000000000000000000000000000000..52b411616f6ff922cf3ceac5d575984f2925d9e1 --- /dev/null +++ b/radio/aidl/android/hardware/radio/network/CellularIdentifierDisclosure.aidl @@ -0,0 +1,39 @@ +/* + * Copyright 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.hardware.radio.network; + +import android.hardware.radio.network.CellularIdentifier; +import android.hardware.radio.network.NasProtocolMessage; + +/** + * A single occurrence of a cellular identifier being sent in the clear pre-authentication. See + * IRadioNetwork.setCellularIdentifierTransparencyEnabled for more details. + * + * @hide + */ +@JavaDerive(toString=true) +@VintfStability +parcelable CellularIdentifierDisclosure { + // The PLMN-ID to which the UE transmitted the cellular identifier + String plmn; + // The type of cellular identifier that was disclosed + CellularIdentifier identifier; + // The NAS protocol message within which the cellular identifier was transmitted. + NasProtocolMessage protocolMessage; + // Whether or not this cellular identifier disclosure is in service of an emergency call. + boolean isEmergency; +} diff --git a/radio/aidl/android/hardware/radio/network/ClosedSubscriberGroupInfo.aidl b/radio/aidl/android/hardware/radio/network/ClosedSubscriberGroupInfo.aidl index a2d82d76cfa0a699c3449f99bf9aa72b852a9b03..d61c1dc685d76cd4d50681673c09b7541abd9348 100644 --- a/radio/aidl/android/hardware/radio/network/ClosedSubscriberGroupInfo.aidl +++ b/radio/aidl/android/hardware/radio/network/ClosedSubscriberGroupInfo.aidl @@ -16,6 +16,7 @@ package android.hardware.radio.network; +/** @hide */ @VintfStability @JavaDerive(toString=true) parcelable ClosedSubscriberGroupInfo { diff --git a/radio/aidl/android/hardware/radio/network/ConnectionEvent.aidl b/radio/aidl/android/hardware/radio/network/ConnectionEvent.aidl new file mode 100644 index 0000000000000000000000000000000000000000..2e39ebf791c6da48f46ce8840402577b2ce0fe94 --- /dev/null +++ b/radio/aidl/android/hardware/radio/network/ConnectionEvent.aidl @@ -0,0 +1,55 @@ +/* + * Copyright 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.hardware.radio.network; + +/** + * See IRadioNetwork.securityAlgorithmsUpdated for more details. + * + * @hide + */ +@VintfStability +@Backing(type="int") +@JavaDerive(toString=true) +enum ConnectionEvent { + // 2G GSM circuit switched + CS_SIGNALLING_GSM = 0, + + // 2G GPRS packet services + PS_SIGNALLING_GPRS = 1, + + // 3G circuit switched + CS_SIGNALLING_3G = 2, + + // 3G packet switched + PS_SIGNALLING_3G = 3, + + // 4G LTE packet services + NAS_SIGNALLING_LTE = 4, + AS_SIGNALLING_LTE = 5, + + // VoLTE + VOLTE_SIP = 6, + VOLTE_RTP = 7, + + // 5G packet services + NAS_SIGNALLING_5G = 8, + AS_SIGNALLING_5G = 9, + + // VoNR + VONR_SIP = 10, + VONR_RTP = 11, +} diff --git a/radio/aidl/android/hardware/radio/network/Domain.aidl b/radio/aidl/android/hardware/radio/network/Domain.aidl index be5f3204a1b00b1767ac52be345faa0999d4c55a..bb169bda4182747ad6a2a1271c80df5901b98dc6 100644 --- a/radio/aidl/android/hardware/radio/network/Domain.aidl +++ b/radio/aidl/android/hardware/radio/network/Domain.aidl @@ -16,6 +16,7 @@ package android.hardware.radio.network; +/** @hide */ @VintfStability @Backing(type="int") @JavaDerive(toString=true) diff --git a/radio/aidl/android/hardware/radio/network/EmergencyMode.aidl b/radio/aidl/android/hardware/radio/network/EmergencyMode.aidl index 25031a9790b6f11547803974866b0b356f824dc9..7a2ed9c2a35b2193d4ba3d4dcac33f4603264a56 100644 --- a/radio/aidl/android/hardware/radio/network/EmergencyMode.aidl +++ b/radio/aidl/android/hardware/radio/network/EmergencyMode.aidl @@ -16,6 +16,7 @@ package android.hardware.radio.network; +/** @hide */ @VintfStability @Backing(type="int") @JavaDerive(toString=true) diff --git a/radio/aidl/android/hardware/radio/network/EmergencyNetworkScanTrigger.aidl b/radio/aidl/android/hardware/radio/network/EmergencyNetworkScanTrigger.aidl index 0a22e4c93a3d9965910eab33f3b15268fec8f6fd..ea4bfebb6e2048e65700b55e460e74564d83625c 100644 --- a/radio/aidl/android/hardware/radio/network/EmergencyNetworkScanTrigger.aidl +++ b/radio/aidl/android/hardware/radio/network/EmergencyNetworkScanTrigger.aidl @@ -18,9 +18,10 @@ package android.hardware.radio.network; import android.hardware.radio.AccessNetwork; import android.hardware.radio.network.EmergencyScanType; +/** @hide */ @VintfStability @JavaDerive(toString=true) -parcelable EmergencyNetworkScanTrigger{ +parcelable EmergencyNetworkScanTrigger { /** * Access network to be prioritized during emergency scan. The 1st entry has the highest * priority. diff --git a/radio/aidl/android/hardware/radio/network/EmergencyRegResult.aidl b/radio/aidl/android/hardware/radio/network/EmergencyRegResult.aidl index 221514999595589c1fd051e5631d4a118502cc00..af2750ee0743bb3102976c092ee503140543b448 100644 --- a/radio/aidl/android/hardware/radio/network/EmergencyRegResult.aidl +++ b/radio/aidl/android/hardware/radio/network/EmergencyRegResult.aidl @@ -19,6 +19,7 @@ import android.hardware.radio.AccessNetwork; import android.hardware.radio.network.Domain; import android.hardware.radio.network.RegState; +/** @hide */ @VintfStability @JavaDerive(toString=true) parcelable EmergencyRegResult { diff --git a/radio/aidl/android/hardware/radio/network/EmergencyScanType.aidl b/radio/aidl/android/hardware/radio/network/EmergencyScanType.aidl index 72c54903c1f2ac38b4a493a0450b2da301d957a2..efa6c02c9a52aaa90c7915a694590c7562f3a025 100644 --- a/radio/aidl/android/hardware/radio/network/EmergencyScanType.aidl +++ b/radio/aidl/android/hardware/radio/network/EmergencyScanType.aidl @@ -16,6 +16,7 @@ package android.hardware.radio.network; +/** @hide */ @VintfStability @Backing(type="int") @JavaDerive(toString=true) diff --git a/radio/aidl/android/hardware/radio/network/EutranBands.aidl b/radio/aidl/android/hardware/radio/network/EutranBands.aidl index 72e76e3effe8c9196cadd58375c3e0d8ac46620e..969a1b74464e89610b79b198a2bd4e438398b640 100644 --- a/radio/aidl/android/hardware/radio/network/EutranBands.aidl +++ b/radio/aidl/android/hardware/radio/network/EutranBands.aidl @@ -18,6 +18,7 @@ package android.hardware.radio.network; /** * EUTRAN bands up to V16.4.0 + * @hide */ @VintfStability @Backing(type="int") diff --git a/radio/aidl/android/hardware/radio/network/EutranRegistrationInfo.aidl b/radio/aidl/android/hardware/radio/network/EutranRegistrationInfo.aidl index b986944214c92989a6290ce71281c31edf7db431..fb319c14540fde411ecd97a791902c8629ae5847 100644 --- a/radio/aidl/android/hardware/radio/network/EutranRegistrationInfo.aidl +++ b/radio/aidl/android/hardware/radio/network/EutranRegistrationInfo.aidl @@ -19,6 +19,7 @@ package android.hardware.radio.network; import android.hardware.radio.network.LteVopsInfo; import android.hardware.radio.network.NrIndicators; +/** @hide */ @VintfStability @JavaDerive(toString=true) parcelable EutranRegistrationInfo { diff --git a/radio/aidl/android/hardware/radio/network/EvdoSignalStrength.aidl b/radio/aidl/android/hardware/radio/network/EvdoSignalStrength.aidl index c3b3898b1f5bfff16091259e7c010c7ecbc919c0..fc7cc1b92bd434c30be75253b070caf5915e5620 100644 --- a/radio/aidl/android/hardware/radio/network/EvdoSignalStrength.aidl +++ b/radio/aidl/android/hardware/radio/network/EvdoSignalStrength.aidl @@ -16,6 +16,7 @@ package android.hardware.radio.network; +/** @hide */ @VintfStability @JavaDerive(toString=true) parcelable EvdoSignalStrength { diff --git a/radio/aidl/android/hardware/radio/network/GeranBands.aidl b/radio/aidl/android/hardware/radio/network/GeranBands.aidl index 0e5b7b20a4edee31956d313589560e11b145b0f2..29d829fde3dce98e6db963510fc22873aca34ee3 100644 --- a/radio/aidl/android/hardware/radio/network/GeranBands.aidl +++ b/radio/aidl/android/hardware/radio/network/GeranBands.aidl @@ -16,6 +16,7 @@ package android.hardware.radio.network; +/** @hide */ @VintfStability @Backing(type="int") @JavaDerive(toString=true) diff --git a/radio/aidl/android/hardware/radio/network/GsmSignalStrength.aidl b/radio/aidl/android/hardware/radio/network/GsmSignalStrength.aidl index 796f80fde1182840feed27d544217d796c4f4789..d569cf75fd88090cec8d2fce3cad314de7038546 100644 --- a/radio/aidl/android/hardware/radio/network/GsmSignalStrength.aidl +++ b/radio/aidl/android/hardware/radio/network/GsmSignalStrength.aidl @@ -16,6 +16,7 @@ package android.hardware.radio.network; +/** @hide */ @VintfStability @JavaDerive(toString=true) parcelable GsmSignalStrength { diff --git a/radio/aidl/android/hardware/radio/network/IRadioNetwork.aidl b/radio/aidl/android/hardware/radio/network/IRadioNetwork.aidl index f22cdb0f12e721b0763fe3a2e89767cb6830ab39..5f26195076b2d73fcb26b77674cdeafe507bf575 100644 --- a/radio/aidl/android/hardware/radio/network/IRadioNetwork.aidl +++ b/radio/aidl/android/hardware/radio/network/IRadioNetwork.aidl @@ -32,11 +32,13 @@ import android.hardware.radio.network.UsageSetting; /** * This interface is used by telephony and telecom to talk to cellular radio for network APIs. + * All functions apply to both terrestrial and extraterrestrial (satellite) based cellular networks. * All the functions have minimum one parameter: * serial: which corresponds to serial no. of request. Serial numbers must only be memorized for the * duration of a method call. If clients provide colliding serials (including passing the same * serial to different methods), multiple responses (one for each method call) must still be served. * setResponseFunctions must work with IRadioNetworkResponse and IRadioNetworkIndication. + * @hide */ @VintfStability oneway interface IRadioNetwork { @@ -46,6 +48,8 @@ oneway interface IRadioNetwork { * @param serial Serial number of request. * * Response function is IRadioNetworkResponse.getAllowedNetworkTypesBitmapResponse() + * + * This is available when android.hardware.telephony.radio.access is defined. */ void getAllowedNetworkTypesBitmap(in int serial); @@ -55,6 +59,8 @@ oneway interface IRadioNetwork { * @param serial Serial number of request. * * Response function is IRadioNetworkResponse.getAvailableBandModesResponse() + * + * This is available when android.hardware.telephony.radio.access is defined. */ void getAvailableBandModes(in int serial); @@ -64,6 +70,8 @@ oneway interface IRadioNetwork { * @param serial Serial number of request. * * Response function is IRadioNetworkResponse.getAvailableNetworksResponse() + * + * This is available when android.hardware.telephony.radio.access is defined. */ void getAvailableNetworks(in int serial); @@ -73,6 +81,8 @@ oneway interface IRadioNetwork { * @param serial Serial number of request. * * Response function is IRadioNetworkResponse.getBarringInfoResponse() + * + * This is available when android.hardware.telephony.radio.access is defined. */ void getBarringInfo(in int serial); @@ -82,6 +92,8 @@ oneway interface IRadioNetwork { * @param serial Serial number of request. * * Response function is IRadioNetworkResponse.getCdmaRoamingPreferenceResponse() + * + * This is available when android.hardware.telephony.cdma is defined. */ void getCdmaRoamingPreference(in int serial); @@ -94,6 +106,8 @@ oneway interface IRadioNetwork { * @param serial Serial number of request. * * Response function is IRadioNetworkResponse.getCellInfoListResponse() + * + * This is available when android.hardware.telephony.radio.access is defined. */ void getCellInfoList(in int serial); @@ -103,6 +117,8 @@ oneway interface IRadioNetwork { * @param serial Serial number of request. * * Response function is IRadioNetworkResponse.getDataRegistrationStateResponse() + * + * This is available when android.hardware.telephony.radio.access is defined. */ void getDataRegistrationState(in int serial); @@ -113,6 +129,8 @@ oneway interface IRadioNetwork { * * Response function is IRadioNetworkResponse.getImsRegistrationStateResponse() * + * This is available when android.hardware.telephony.ims is defined. + * * @deprecated Deprecated starting from Android U. */ void getImsRegistrationState(in int serial); @@ -123,6 +141,8 @@ oneway interface IRadioNetwork { * @param serial Serial number of request. * * Response function is IRadioNetworkResponse.getNetworkSelectionModeResponse() + * + * This is available when android.hardware.telephony.radio.access is defined. */ void getNetworkSelectionMode(in int serial); @@ -132,6 +152,8 @@ oneway interface IRadioNetwork { * @param serial Serial number of request. * * Response function is IRadioNetworkResponse.getOperatorResponse() + * + * This is available when android.hardware.telephony.radio.access is defined. */ void getOperator(in int serial); @@ -141,6 +163,8 @@ oneway interface IRadioNetwork { * @param serial Serial number of request. * * Response function is IRadioNetworkResponse.getSignalStrengthResponse() + * + * This is available when android.hardware.telephony.radio.access is defined. */ void getSignalStrength(in int serial); @@ -150,6 +174,8 @@ oneway interface IRadioNetwork { * @param serial Serial number of request. * * Response function is IRadioNetworkResponse.getSystemSelectionChannelsResponse() + * + * This is available when android.hardware.telephony.radio.access is defined. */ void getSystemSelectionChannels(in int serial); @@ -160,6 +186,8 @@ oneway interface IRadioNetwork { * @param serial Serial number of request. * * Response function is IRadioNetworkResponse.getVoiceRadioTechnologyResponse() + * + * This is available when android.hardware.telephony.radio.access is defined. */ void getVoiceRadioTechnology(in int serial); @@ -169,6 +197,8 @@ oneway interface IRadioNetwork { * @param serial Serial number of request. * * Response function is IRadioNetworkResponse.getVoiceRegistrationStateResponse() + * + * This is available when android.hardware.telephony.radio.access is defined. */ void getVoiceRegistrationState(in int serial); @@ -178,6 +208,8 @@ oneway interface IRadioNetwork { * @param serial Serial number of request. * * Response function is IRadioNetworkResponse.isNrDualConnectivityEnabledResponse() + * + * This is available when android.hardware.telephony.radio.access is defined. */ void isNrDualConnectivityEnabled(in int serial); @@ -185,6 +217,8 @@ oneway interface IRadioNetwork { * When response type received from a radio indication or radio response is * RadioIndicationType:UNSOLICITED_ACK_EXP or RadioResponseType:SOLICITED_ACK_EXP respectively, * acknowledge the receipt of those messages by sending responseAcknowledgement(). + * + * This is available when android.hardware.telephony.radio.access is defined. */ void responseAcknowledgement(); @@ -197,6 +231,8 @@ oneway interface IRadioNetwork { * @param networkTypeBitmap a 32-bit bearer bitmap of RadioAccessFamily * * Response function is IRadioNetworkResponse.setAllowedNetworkTypesBitmapResponse() + * + * This is available when android.hardware.telephony.radio.access is defined. */ void setAllowedNetworkTypesBitmap(in int serial, in int networkTypeBitmap); @@ -207,6 +243,8 @@ oneway interface IRadioNetwork { * @param mode RadioBandMode * * Response function is IRadioNetworkResponse.setBandModeResponse() + * + * This is available when android.hardware.telephony.radio.access is defined. */ void setBandMode(in int serial, in RadioBandMode mode); @@ -219,6 +257,8 @@ oneway interface IRadioNetwork { * @param newPassword new password * * Response function is IRadioNetworkResponse.setBarringPasswordResponse() + * + * This is available when android.hardware.telephony.radio.access is defined. */ void setBarringPassword( in int serial, in String facility, in String oldPassword, in String newPassword); @@ -230,6 +270,8 @@ oneway interface IRadioNetwork { * @param type CdmaRoamingType defined in types.hal * * Response function is IRadioNetworkResponse.setCdmaRoamingPreferenceResponse() + * + * This is available when android.hardware.telephony.cdma is defined. */ void setCdmaRoamingPreference(in int serial, in CdmaRoamingType type); @@ -242,6 +284,8 @@ oneway interface IRadioNetwork { * @param rate minimum time in milliseconds to indicate time between unsolicited cellInfoList() * * Response function is IRadioNetworkResponse.setCellInfoListRateResponse() + * + * This is available when android.hardware.telephony.radio.access is defined. */ void setCellInfoListRate(in int serial, in int rate); @@ -255,6 +299,8 @@ oneway interface IRadioNetwork { * indications are enabled. See IndicationFilter for the definition of each bit. * * Response function is IRadioNetworkResponse.setIndicationFilterResponse() + * + * This is available when android.hardware.telephony.radio.access is defined. */ void setIndicationFilter(in int serial, in int indicationFilter); @@ -279,6 +325,8 @@ oneway interface IRadioNetwork { * @param accessNetwork The type of network for which to apply these thresholds. * * Response function is IRadioNetworkResponse.setLinkCapacityReportingCriteriaResponse(). + * + * This is available when android.hardware.telephony.radio.access is defined. */ void setLinkCapacityReportingCriteria(in int serial, in int hysteresisMs, in int hysteresisDlKbps, in int hysteresisUlKbps, in int[] thresholdsDownlinkKbps, @@ -294,6 +342,8 @@ oneway interface IRadioNetwork { * @param enable true=updates enabled (+CREG=2), false=updates disabled (+CREG=1) * * Response function is IRadioNetworkResponse.setLocationUpdatesResponse() + * + * This is available when android.hardware.telephony.radio.access is defined. */ void setLocationUpdates(in int serial, in boolean enable); @@ -304,6 +354,8 @@ oneway interface IRadioNetwork { * @param serial Serial number of request. * * Response function is IRadioNetworkResponse.setNetworkSelectionModeAutomaticResponse() + * + * This is available when android.hardware.telephony.radio.access is defined. */ void setNetworkSelectionModeAutomatic(in int serial); @@ -320,6 +372,8 @@ oneway interface IRadioNetwork { * the next best RAN for network registration. * * Response function is IRadioNetworkResponse.setNetworkSelectionModeManualResponse() + * + * This is available when android.hardware.telephony.radio.access is defined. */ void setNetworkSelectionModeManual( in int serial, in String operatorNumeric, in AccessNetwork ran); @@ -336,6 +390,8 @@ oneway interface IRadioNetwork { * {NrDualConnectivityState:DISABLE_IMMEDIATE} * * Response function is IRadioNetworkResponse.setNrDualConnectivityStateResponse() + * + * This is available when android.hardware.telephony.radio.access is defined. */ void setNrDualConnectivityState( in int serial, in NrDualConnectivityState nrDualConnectivityState); @@ -345,6 +401,8 @@ oneway interface IRadioNetwork { * * @param radioNetworkResponse Object containing response functions * @param radioNetworkIndication Object containing radio indications + * + * This is available when android.hardware.telephony.radio.access is defined. */ void setResponseFunctions(in IRadioNetworkResponse radioNetworkResponse, in IRadioNetworkIndication radioNetworkIndication); @@ -363,6 +421,8 @@ oneway interface IRadioNetwork { * criteria. See SignalThresholdInfo for details. * * Response function is IRadioNetworkResponse.setSignalStrengthReportingCriteriaResponse() + * + * This is available when android.hardware.telephony.radio.access is defined. */ void setSignalStrengthReportingCriteria( in int serial, in SignalThresholdInfo[] signalThresholdInfos); @@ -375,6 +435,8 @@ oneway interface IRadioNetwork { * @param enable true = notifications enabled, false = notifications disabled. * * Response function is IRadioNetworkResponse.setSuppServiceNotificationsResponse() + * + * This is available when android.hardware.telephony.calling is defined. */ void setSuppServiceNotifications(in int serial, in boolean enable); @@ -388,6 +450,8 @@ oneway interface IRadioNetwork { * @param specifiers which bands to scan. Only used if specifyChannels is true. * * Response function is IRadioNetworkResponse.setSystemSelectionChannelsResponse() + * + * This is available when android.hardware.telephony.radio.access is defined. */ void setSystemSelectionChannels( in int serial, in boolean specifyChannels, in RadioAccessSpecifier[] specifiers); @@ -399,6 +463,8 @@ oneway interface IRadioNetwork { * @param request Defines the radio networks/bands/channels which need to be scanned. * * Response function is IRadioNetworkResponse.startNetworkScanResponse() + * + * This is available when android.hardware.telephony.radio.access is defined. */ void startNetworkScan(in int serial, in NetworkScanRequest request); @@ -408,6 +474,8 @@ oneway interface IRadioNetwork { * @param serial Serial number of request. * * Response function is IRadioNetworkResponse.stopNetworkScanResponse() + * + * This is available when android.hardware.telephony.radio.access is defined. */ void stopNetworkScan(in int serial); @@ -418,6 +486,8 @@ oneway interface IRadioNetwork { * @param netPin Network depersonlization code * * Response function is IRadioNetworkResponse.supplyNetworkDepersonalizationResponse() + * + * This is available when android.hardware.telephony.radio.access is defined. */ void supplyNetworkDepersonalization(in int serial, in String netPin); @@ -430,6 +500,8 @@ oneway interface IRadioNetwork { * * @param serial Serial number of request. * @param usageSetting the usage setting for the current SIM. + * + * This is available when android.hardware.telephony is defined. */ oneway void setUsageSetting(in int serial, in UsageSetting usageSetting); @@ -439,6 +511,8 @@ oneway interface IRadioNetwork { *

      Gets the usage setting in accordance with 3gpp 24.301 sec 4.3 and 3gpp 24.501 sec 4.3. * * @param serial Serial number of request. + * + * This is available when android.hardware.telephony is defined. */ oneway void getUsageSetting(in int serial); @@ -450,6 +524,8 @@ oneway interface IRadioNetwork { * type of service to be scanned. * * Response function is IRadioEmergencyResponse.setEmergencyModeResponse() + * + * This is available when android.hardware.telephony.radio.access is defined. */ void setEmergencyMode(int serial, in EmergencyMode emcModeType); @@ -461,6 +537,8 @@ oneway interface IRadioNetwork { * See {@link EmergencyNetworkScanTrigger}. * * Response function is IRadioEmergencyResponse.triggerEmergencyNetworkScanResponse() + * + * This is available when android.hardware.telephony.radio.access is defined. */ void triggerEmergencyNetworkScan(int serial, in EmergencyNetworkScanTrigger request); @@ -473,6 +551,8 @@ oneway interface IRadioNetwork { * otherwise the modem shall resume from the last search. * * Response function is IRadioEmergencyResponse.cancelEmergencyNetworkScan() + * + * This is available when android.hardware.telephony.radio.access is defined. */ void cancelEmergencyNetworkScan(int serial, boolean resetScan); @@ -482,6 +562,8 @@ oneway interface IRadioNetwork { * @param serial Serial number of the request. * * Response function is IRadioEmergencyResponse.exitEmergencyModeResponse() + * + * This is available when android.hardware.telephony.radio.access is defined. */ void exitEmergencyMode(in int serial); @@ -512,6 +594,8 @@ oneway interface IRadioNetwork { * Otherwise, false. * * Response callback is IRadioResponse.setNullCipherAndIntegrityEnabledResponse() + * + * This is available when android.hardware.telephony.radio.access is defined. */ void setNullCipherAndIntegrityEnabled(in int serial, in boolean enabled); @@ -527,6 +611,8 @@ oneway interface IRadioNetwork { * @param serial Serial number of the request. * * Response callback is IRadioNetworkResponse.isNullCipherAndIntegrityEnabledResponse() + * + * This is available when android.hardware.telephony.radio.access is defined. */ void isNullCipherAndIntegrityEnabled(in int serial); @@ -536,6 +622,8 @@ oneway interface IRadioNetwork { * @param serial Serial number of request. * * Response function is IRadioNetworkResponse.isN1ModeEnabledResponse() + * + * This is available when android.hardware.telephony.radio.access is defined. */ void isN1ModeEnabled(in int serial); @@ -553,6 +641,76 @@ oneway interface IRadioNetwork { * @param enable {@code true} to enable N1 mode, {@code false} to disable N1 mode. * * Response function is IRadioNetworkResponse.setN1ModeEnabledResponse() + * + * This is available when android.hardware.telephony.radio.access is defined. */ void setN1ModeEnabled(in int serial, boolean enable); + + /** + * Get whether pre-auth cellular identifier in-the-clear transparency is enabled. If + * IRadioNetworkInterface.setCellularIdentifierTransparencyEnabled has been called, this should + * return the value of the `enabled` parameter of the last successful call and false if + * IRadioNetworkInterface.setCellularIdentifierTransparencyEnabled has not been called yet. + * + * @param serial Serial number of request + * + * Response callback is IRadioNetworkResponse.isCellularIdentifierTransparencyEnabledResponse + * + * This is available when android.hardware.telephony.access is defined. + */ + void isCellularIdentifierTransparencyEnabled(in int serial); + + /** + * Enable or disable transparency for in-the-clear cellular identifiers. If the value of enabled + * is true, the modem must call IRadioNetworkIndication.cellularIdentifierDisclosed when an + * IMSI, IMEI, or unciphered SUCI (in 5G SA) appears in one of the following UE-initiated NAS + * messages before a security context is established. + * + * Note: Cellular identifiers disclosed in uplink messages covered under a NAS Security Context + * as well as identifiers disclosed in downlink messages are out of scope. + * + * This feature applies to 2g, 3g, 4g, and 5g (SA and NSA) messages sent before a security + * context is established. In scope message definitions and their associated spec references can + * be found in NasProtocolMessage. + * + * If the value of enabled is false, the modem must not call + * IRadioNetworkIndication.sentCellularIdentifierDisclosure again until a subsequent call + * re-enables this functionality. The modem may choose to stop tracking cellular identifiers in + * the clear during this time. + * + * @param serial Serial number of request + * @param enabled Whether or not to enable sending indications for cellular identifiers in the + * clear + * + * Response function is IRadioNetworkResponse.setCellularIdentifierTransparencyEnabledResponse + * + * This is available when android.hardware.telephony.access is defined. + */ + void setCellularIdentifierTransparencyEnabled(in int serial, in boolean enabled); + + /** + * Enables or disables security algorithm update reports via indication API + * {@link IRadioNetworkIndication.securityAlgorithmsUpdated()}. + * + * @param serial Serial number of request. + * @param enable {@code true} to enable security algorithm update reports, {@code false} to + * disable. + * + * Response function is IRadioNetworkResponse.setSecurityAlgorithmsUpdatedEnabledResponse() + * + * This is available when android.hardware.telephony.access is defined. + */ + void setSecurityAlgorithmsUpdatedEnabled(in int serial, boolean enable); + + /** + * Checks whether security algorithm update reports are enabled via indication API + * {@link IRadioNetworkIndication.securityAlgorithmsUpdated()}. + * + * @param serial Serial number of request. + * + * Response function is IRadioNetworkResponse.isSecurityAlgorithmsUpdatedEnabledResponse() + * + * This is available when android.hardware.telephony.access is defined. + */ + void isSecurityAlgorithmsUpdatedEnabled(in int serial); } diff --git a/radio/aidl/android/hardware/radio/network/IRadioNetworkIndication.aidl b/radio/aidl/android/hardware/radio/network/IRadioNetworkIndication.aidl index 47d932d909ca3e54395ecfee3b6440c85d2939e0..9c2502d931421705f211bada85896127dc289bd9 100644 --- a/radio/aidl/android/hardware/radio/network/IRadioNetworkIndication.aidl +++ b/radio/aidl/android/hardware/radio/network/IRadioNetworkIndication.aidl @@ -21,16 +21,19 @@ import android.hardware.radio.RadioTechnology; import android.hardware.radio.network.BarringInfo; import android.hardware.radio.network.CellIdentity; import android.hardware.radio.network.CellInfo; +import android.hardware.radio.network.CellularIdentifierDisclosure; +import android.hardware.radio.network.EmergencyRegResult; import android.hardware.radio.network.LinkCapacityEstimate; import android.hardware.radio.network.NetworkScanResult; import android.hardware.radio.network.PhoneRestrictedState; import android.hardware.radio.network.PhysicalChannelConfig; +import android.hardware.radio.network.SecurityAlgorithmUpdate; import android.hardware.radio.network.SignalStrength; import android.hardware.radio.network.SuppSvcNotification; -import android.hardware.radio.network.EmergencyRegResult; /** * Interface declaring unsolicited radio indications for network APIs. + * @hide */ @VintfStability oneway interface IRadioNetworkIndication { @@ -199,4 +202,50 @@ oneway interface IRadioNetworkIndication { * @param result the result of the Emergency Network Scan */ void emergencyNetworkScanResult(in RadioIndicationType type, in EmergencyRegResult result); + + /** + * Report a cellular identifier disclosure event. See + * IRadioNetwork.setCellularIdnetifierTransparencyEnabled for more details. + * + * A non-exhaustive list of when this method should be called follows: + * + * - If a device attempts an IMSI attach to the network. + * - If a device includes an IMSI in the IDENTITY_RESPONSE message on the NAS and a security + * context has not yet been established. + * - If a device includes an IMSI in a DETACH_REQUEST message sent on the NAS and the message is + * sent before a security context has been established. + * - If a device includes an IMSI in a TRACKING_AREA_UPDATE message sent on the NAS and the + * message is sent before a security context has been established. + * - If a device uses a 2G network to send a LOCATION_UPDATE_REQUEST message on the NAS that + * includes an IMSI or IMEI. + * - If a device uses a 2G network to send a AUTHENTICATION_AND_CIPHERING_RESPONSE message on + * the NAS and the message includes an IMEISV. + * + * @param type Type of radio indication + * @param disclosure A CellularIdentifierDisclosure as specified by + * IRadioNetwork.setCellularIdentifierTransparencyEnabled. + * + */ + void cellularIdentifierDisclosed( + in RadioIndicationType type, in CellularIdentifierDisclosure disclosure); + + /* + * Indicates that a new ciphering or integrity algorithm was used for a particular voice, + * signaling, or data connection attempt for a given PLMN and/or access network. Due to + * power concerns, once a connection type has been reported on, follow-up reports about that + * connection type are only generated if there is any change to the previously reported + * encryption or integrity. Thus the AP is only to be notified when there is new information. + * List is reset upon rebooting thus info about initial connections is always passed to the + * AP after a reboot. List is also reset if the SIM is changed or if there has been a change + * in the access network. + * + * Note: a change only in cell ID should not trigger an update, as the design is intended to + * be agnostic to dual connectivity ("secondary serving cells"). + * + * @param type Type of radio indication + * @param securityAlgorithmUpdate SecurityAlgorithmUpdate encapsulates details of security + * algorithm updates + */ + void securityAlgorithmsUpdated( + in RadioIndicationType type, in SecurityAlgorithmUpdate securityAlgorithmUpdate); } diff --git a/radio/aidl/android/hardware/radio/network/IRadioNetworkResponse.aidl b/radio/aidl/android/hardware/radio/network/IRadioNetworkResponse.aidl index 457b5b91494170dc0cdf5630f24c0fcd8cbadddf..d9eea03c7e3eed4c6b752d1d1a8ba0f7ffc75c21 100644 --- a/radio/aidl/android/hardware/radio/network/IRadioNetworkResponse.aidl +++ b/radio/aidl/android/hardware/radio/network/IRadioNetworkResponse.aidl @@ -33,6 +33,7 @@ import android.hardware.radio.network.UsageSetting; /** * Interface declaring response functions to solicited radio requests for network APIs. + * @hide */ @VintfStability oneway interface IRadioNetworkResponse { @@ -50,6 +51,8 @@ oneway interface IRadioNetworkResponse { * @param networkTypeBitmap a 32-bit bitmap of RadioAccessFamily. * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.radio.access is not + * defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:OPERATION_NOT_ALLOWED @@ -66,6 +69,8 @@ oneway interface IRadioNetworkResponse { * @param bandModes List of RadioBandMode listing supported modes * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.radio.access is not + * defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:INVALID_ARGUMENTS @@ -83,6 +88,8 @@ oneway interface IRadioNetworkResponse { * @param networkInfos List of network operator information as OperatorInfos * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.radio.access is not + * defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:OPERATION_NOT_ALLOWED @@ -103,6 +110,8 @@ oneway interface IRadioNetworkResponse { * @param barringInfos a vector of barring info for all barring service types * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.radio.access is not + * defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:INTERNAL_ERR @@ -116,6 +125,7 @@ oneway interface IRadioNetworkResponse { * @param type CdmaRoamingType * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.cdma is not defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:INVALID_ARGUMENTS @@ -134,6 +144,8 @@ oneway interface IRadioNetworkResponse { * @param cellInfo List of current cell information known to radio * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.radio.access is not + * defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:INTERNAL_ERR @@ -145,6 +157,8 @@ oneway interface IRadioNetworkResponse { * @param dataRegResponse Current data registration response as defined by RegStateResult * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.radio.access is not + * defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:INTERNAL_ERR @@ -159,6 +173,7 @@ oneway interface IRadioNetworkResponse { * @param ratFamily RadioTechnologyFamily. This value is valid only if isRegistered is true. * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.ims is not defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:INTERNAL_ERR @@ -177,6 +192,8 @@ oneway interface IRadioNetworkResponse { * @param selection false for automatic selection, true for manual selection * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.radio.access is not + * defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:NO_MEMORY @@ -196,6 +213,8 @@ oneway interface IRadioNetworkResponse { * @param numeric is 5 or 6 digit numeric code (MCC + MNC) or empty string if unregistered * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.radio.access is not + * defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:NO_MEMORY @@ -212,6 +231,8 @@ oneway interface IRadioNetworkResponse { * @param signalStrength Current signal strength * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.radio.access is not + * defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:INTERNAL_ERR @@ -223,6 +244,8 @@ oneway interface IRadioNetworkResponse { * @param specifiers List of RadioAccessSpecifiers that are scanned. * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.radio.access is not + * defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:INTERNAL_ERR @@ -236,6 +259,8 @@ oneway interface IRadioNetworkResponse { * @param rat Current voice RAT * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.radio.access is not + * defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:INTERNAL_ERR @@ -250,6 +275,8 @@ oneway interface IRadioNetworkResponse { * @param voiceRegResponse Current Voice registration response as defined by RegStateResult * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.radio.access is not + * defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:INTERNAL_ERR @@ -263,6 +290,8 @@ oneway interface IRadioNetworkResponse { * else false. * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.radio.access is not + * defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:INTERNAL_ERR @@ -273,6 +302,8 @@ oneway interface IRadioNetworkResponse { * @param info Response info struct containing response type, serial no. and error * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.radio.access is not + * defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:OPERATION_NOT_ALLOWED @@ -288,6 +319,8 @@ oneway interface IRadioNetworkResponse { * @param info Response info struct containing response type, serial no. and error * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.radio.access is not + * defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:OPERATION_NOT_ALLOWED @@ -305,6 +338,8 @@ oneway interface IRadioNetworkResponse { * @param info Response info struct containing response type, serial no. and error * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.radio.access is not + * defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:SS_MODIFIED_TO_DIAL @@ -325,6 +360,7 @@ oneway interface IRadioNetworkResponse { * @param info Response info struct containing response type, serial no. and error * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.cdma is not defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:NO_MEMORY @@ -343,6 +379,8 @@ oneway interface IRadioNetworkResponse { * @param info Response info struct containing response type, serial no. and error * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.radio.access is not + * defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:NO_MEMORY @@ -358,6 +396,8 @@ oneway interface IRadioNetworkResponse { * @param info Response info struct containing response type, serial no. and error * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.radio.access is not + * defined * RadioError:NONE * RadioError:INVALID_ARGUMENTS * RadioError:RADIO_NOT_AVAILABLE @@ -370,6 +410,8 @@ oneway interface IRadioNetworkResponse { * @param info Response info struct containing response type, serial no. and error * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.radio.access is not + * defined * RadioError:NONE * RadioError:INVALID_ARGUMENTS * RadioError:RADIO_NOT_AVAILABLE @@ -381,6 +423,8 @@ oneway interface IRadioNetworkResponse { * @param info Response info struct containing response type, serial no. and error * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.radio.access is not + * defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:NO_MEMORY @@ -398,6 +442,8 @@ oneway interface IRadioNetworkResponse { * @param info Response info struct containing response type, serial no. and error * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.radio.access is not + * defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:ILLEGAL_SIM_OR_ME @@ -419,6 +465,8 @@ oneway interface IRadioNetworkResponse { * @param info Response info struct containing response type, serial no. and error * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.radio.access is not + * defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:ILLEGAL_SIM_OR_ME @@ -441,6 +489,8 @@ oneway interface IRadioNetworkResponse { * @param info Response info struct containing response type, serial no. and error * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.radio.access is not + * defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:INTERNAL_ERR @@ -452,6 +502,8 @@ oneway interface IRadioNetworkResponse { * @param info Response info struct containing response type, serial no. and error * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.radio.access is not + * defined * RadioError:NONE * RadioError:INVALID_ARGUMENTS * RadioError:RADIO_NOT_AVAILABLE @@ -462,6 +514,7 @@ oneway interface IRadioNetworkResponse { * @param info Response info struct containing response type, serial no. and error * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.calling is not defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:INVALID_ARGUMENTS @@ -480,6 +533,8 @@ oneway interface IRadioNetworkResponse { * @param info Response info struct containing response type, serial no. and error * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.radio.access is not + * defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:INTERNAL_ERR @@ -491,6 +546,8 @@ oneway interface IRadioNetworkResponse { * @param info Response info struct containing response type, serial no. and error * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.radio.access is not + * defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:DEVICE_IN_USE @@ -504,6 +561,8 @@ oneway interface IRadioNetworkResponse { * @param info Response info struct containing response type, serial no. and error * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.radio.access is not + * defined * RadioError:NONE * RadioError:INTERNAL_ERR * RadioError:MODEM_ERR @@ -515,6 +574,8 @@ oneway interface IRadioNetworkResponse { * @param remainingRetries Number of retries remaining, must be equal to -1 if unknown. * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.radio.access is not + * defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:PASSWORD_INCORRECT (code is invalid) @@ -534,6 +595,7 @@ oneway interface IRadioNetworkResponse { * @param info Response info struct containing response type, serial no. and error. * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony is not defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:INVALID_STATE @@ -548,6 +610,7 @@ oneway interface IRadioNetworkResponse { * @param usageSetting the usage setting for the current SIM. * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony is not defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:INVALID_STATE @@ -564,6 +627,8 @@ oneway interface IRadioNetworkResponse { * @param regState the current registration state of the modem. * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.radio.access is not + * defined * RadioError:NONE * RadioError:REQUEST_NOT_SUPPORTED * RadioError:RADIO_NOT_AVAILABLE @@ -579,6 +644,8 @@ oneway interface IRadioNetworkResponse { * @param info Response info struct containing response type, serial no. and error. * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.radio.access is not + * defined * RadioError:NONE * RadioError:REQUEST_NOT_SUPPORTED * RadioError:RADIO_NOT_AVAILABLE @@ -594,6 +661,8 @@ oneway interface IRadioNetworkResponse { * @param info Response info struct containing response type, serial no. and error. * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.radio.access is not + * defined * RadioError:NONE * RadioError:REQUEST_NOT_SUPPORTED * RadioError:RADIO_NOT_AVAILABLE @@ -608,6 +677,8 @@ oneway interface IRadioNetworkResponse { * @param info Response info struct containing response type, serial no. and error. * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.radio.access is not + * defined * RadioError:NONE * RadioError:REQUEST_NOT_SUPPORTED * RadioError:RADIO_NOT_AVAILABLE @@ -619,10 +690,11 @@ oneway interface IRadioNetworkResponse { * @param info Response info struct containing response type, serial no. and error * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.radio.access is not + * defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:MODEM_ERR - * RadioError:REQUEST_NOT_SUPPORTED */ void setNullCipherAndIntegrityEnabledResponse(in RadioResponseInfo info); @@ -631,10 +703,11 @@ oneway interface IRadioNetworkResponse { * @param enabled the last known state of null ciphering and integrity algorithms * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.radio.access is not + * defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:MODEM_ERR - * RadioError:REQUEST_NOT_SUPPORTED */ void isNullCipherAndIntegrityEnabledResponse(in RadioResponseInfo info, in boolean isEnabled); @@ -646,6 +719,8 @@ oneway interface IRadioNetworkResponse { * @param isEnabled Indicates whether N1 mode is enabled or not. * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.radio.access is not + * defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:INTERNAL_ERR @@ -660,6 +735,8 @@ oneway interface IRadioNetworkResponse { * @param info Response info struct containing response type, serial no. and error. * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.radio.access is not + * defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:INTERNAL_ERR @@ -667,4 +744,66 @@ oneway interface IRadioNetworkResponse { * RadioError:INVALID_STATE */ void setN1ModeEnabledResponse(in RadioResponseInfo info); + + /** + * Response of isCellularIdentifierTransparencyEnabled. + * + * @param info Response info struct containing response type, serial no. and error. + * @param isEnabled Indicates whether cellular identifier transparency is enabled or not. + * + * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.radio.access is not + * defined + * RadioError:NONE + * RadioError:RADIO_NOT_AVAILABLE + * RadioError:INTERNAL_ERR + */ + void isCellularIdentifierTransparencyEnabledResponse( + in RadioResponseInfo info, boolean isEnabled); + + /** + * Response of setCellularIdentifierTransparencyEnabled. + * + * @param info Response info struct containing response type, serial no. and error. + * + * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.radio.access is not + * defined + * RadioError:NONE + * RadioError:RADIO_NOT_AVAILABLE + * RadioError:INTERNAL_ERR + * RadioError:INVALID_STATE + */ + void setCellularIdentifierTransparencyEnabledResponse(in RadioResponseInfo info); + + /** + * Response of setSecurityAlgorithmsUpdatedEnabled. + * + * @param info Response info struct containing response type, serial no. and error. + * + * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.radio.access is not + * defined + * RadioError:NONE + * RadioError:RADIO_NOT_AVAILABLE + * RadioError:INTERNAL_ERR + * RadioError:INVALID_STATE + */ + void setSecurityAlgorithmsUpdatedEnabledResponse(in RadioResponseInfo info); + + /** + * Response of isSecurityAlgorithmsUpdatedEnabled. + * + * @param info Response info struct containing response type, serial no. and error. + * @param isEnabled Indicates whether cellular ciphering transparency is enabled or not. + * + * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.radio.access is not + * defined + * RadioError:NONE + * RadioError:RADIO_NOT_AVAILABLE + * RadioError:INTERNAL_ERR + */ + void isSecurityAlgorithmsUpdatedEnabledResponse( + in RadioResponseInfo info, in boolean isEnabled); } diff --git a/radio/aidl/android/hardware/radio/network/IndicationFilter.aidl b/radio/aidl/android/hardware/radio/network/IndicationFilter.aidl index 9cab28d1e31216921faf757b62ab0f55d90a025d..7b95273ee3fcbbe9bb88a92c2ce2e04f6c7ea55a 100644 --- a/radio/aidl/android/hardware/radio/network/IndicationFilter.aidl +++ b/radio/aidl/android/hardware/radio/network/IndicationFilter.aidl @@ -16,6 +16,7 @@ package android.hardware.radio.network; +/** @hide */ @VintfStability @Backing(type="int") @JavaDerive(toString=true) diff --git a/radio/aidl/android/hardware/radio/network/LceDataInfo.aidl b/radio/aidl/android/hardware/radio/network/LceDataInfo.aidl index fdbdc2b455ee3ba74c7705cf5543b23a9699a1d1..c855b18ae79a122bc03e6af474643915b06b135f 100644 --- a/radio/aidl/android/hardware/radio/network/LceDataInfo.aidl +++ b/radio/aidl/android/hardware/radio/network/LceDataInfo.aidl @@ -16,6 +16,7 @@ package android.hardware.radio.network; +/** @hide */ @VintfStability @JavaDerive(toString=true) parcelable LceDataInfo { diff --git a/radio/aidl/android/hardware/radio/network/LinkCapacityEstimate.aidl b/radio/aidl/android/hardware/radio/network/LinkCapacityEstimate.aidl index 6461719cc113323565db02a88b6260009f684e48..0aea27cb314e77ee646c9a3ed67a3fb918a6531f 100644 --- a/radio/aidl/android/hardware/radio/network/LinkCapacityEstimate.aidl +++ b/radio/aidl/android/hardware/radio/network/LinkCapacityEstimate.aidl @@ -16,6 +16,7 @@ package android.hardware.radio.network; +/** @hide */ @VintfStability @JavaDerive(toString=true) parcelable LinkCapacityEstimate { diff --git a/radio/aidl/android/hardware/radio/network/LteSignalStrength.aidl b/radio/aidl/android/hardware/radio/network/LteSignalStrength.aidl index 2d97c4565e5ebcf8c29a7c87b494699690cb1149..21d3ec71573e916163d710ff82d5a3ffb16093e7 100644 --- a/radio/aidl/android/hardware/radio/network/LteSignalStrength.aidl +++ b/radio/aidl/android/hardware/radio/network/LteSignalStrength.aidl @@ -16,6 +16,7 @@ package android.hardware.radio.network; +/** @hide */ @VintfStability @JavaDerive(toString=true) parcelable LteSignalStrength { diff --git a/radio/aidl/android/hardware/radio/network/LteVopsInfo.aidl b/radio/aidl/android/hardware/radio/network/LteVopsInfo.aidl index fb3b986fed802bda23ac2f13c47da77129252b93..a320acb120c0afc62382c5412b4015a3a281fd1e 100644 --- a/radio/aidl/android/hardware/radio/network/LteVopsInfo.aidl +++ b/radio/aidl/android/hardware/radio/network/LteVopsInfo.aidl @@ -19,6 +19,7 @@ package android.hardware.radio.network; /** * Type to define the LTE specific network capabilities for voice over PS including emergency and * normal voice calls. + * @hide */ @VintfStability @JavaDerive(toString=true) diff --git a/radio/aidl/android/hardware/radio/network/NasProtocolMessage.aidl b/radio/aidl/android/hardware/radio/network/NasProtocolMessage.aidl new file mode 100644 index 0000000000000000000000000000000000000000..5a23661b8389f3c670d3e7468eb0e00fb0964b32 --- /dev/null +++ b/radio/aidl/android/hardware/radio/network/NasProtocolMessage.aidl @@ -0,0 +1,68 @@ +/* + * Copyright 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.hardware.radio.network; + +/** + * Each enum value represents a message type on the Non-Access Stratum (NAS). The relevant cellular + * generation is noted for each message type. Sample spec references are provided, but generally + * only reference one network generation's spec. + * + * @hide + */ +@VintfStability +@Backing(type="int") +@JavaDerive(toString=true) +enum NasProtocolMessage { + UNKNOWN = 0, + // Sample Reference: 3GPP TS 24.301 8.2.4 + // Applies to 2g, 3g, and 4g networks + ATTACH_REQUEST = 1, + // Sample Reference: 3GPP TS 24.301 8.2.19 + // Applies to 2g, 3g, 4g, and 5g networks + IDENTITY_RESPONSE = 2, + // Sample Reference: 3GPP TS 24.301 8.2.11 + // Applies to 2g, 3g, and 4g networks + DETACH_REQUEST = 3, + // Sample Reference: 3GPP TS 24.301 8.2.29 + // Note: that per the spec, only temporary IDs should be sent + // in the TAU Request, but since the EPS Mobile Identity field + // supports IMSIs, this is included as an extra safety measure + // to combat implementation bugs. + // Applies to 4g and 5g networks + TRACKING_AREA_UPDATE_REQUEST = 4, + // Sample Reference: 3GPP TS 24.008 4.4.3 + // Applies to 2g and 3g networks + LOCATION_UPDATE_REQUEST = 5, + // Reference: 3GPP TS 24.008 4.7.7.1 + // Applies to 2g and 3g networks + AUTHENTICATION_AND_CIPHERING_RESPONSE = 6, + // Reference: 3GPP TS 24.501 8.2.6 + // Applies to 5g networks + REGISTRATION_REQUEST = 7, + // Reference: 3GPP TS 24.501 8.2.12 + // Applies to 5g networks + DEREGISTRATION_REQUEST = 8, + // Reference: 3GPP TS 24.008 9.2.4 + // Applies to 2g and 3g networks + CM_REESTABLISHMENT_REQUEST = 9, + // Reference: 3GPP TS 24.008 9.2.9 + // Applies to 2g and 3g networks + CM_SERVICE_REQUEST = 10, + // Reference: 3GPP TS 24.008 9.2.14 + // Applies to 2g and 3g networks. Used for circuit-switched detach. + IMSI_DETACH_INDICATION = 11 +} diff --git a/radio/aidl/android/hardware/radio/network/NetworkScanRequest.aidl b/radio/aidl/android/hardware/radio/network/NetworkScanRequest.aidl index ae173c7eac1de6c9faa9ac2f336750df19885a07..37f2cf1fab5f0f5f3b6086f88da1e81d7261754f 100644 --- a/radio/aidl/android/hardware/radio/network/NetworkScanRequest.aidl +++ b/radio/aidl/android/hardware/radio/network/NetworkScanRequest.aidl @@ -18,6 +18,7 @@ package android.hardware.radio.network; import android.hardware.radio.network.RadioAccessSpecifier; +/** @hide */ @VintfStability @JavaDerive(toString=true) parcelable NetworkScanRequest { diff --git a/radio/aidl/android/hardware/radio/network/NetworkScanResult.aidl b/radio/aidl/android/hardware/radio/network/NetworkScanResult.aidl index 6d83f74690030b6b3694b10fb091151e4b78ae9c..4465046cbbf7c61932c1af774718f61688bd0032 100644 --- a/radio/aidl/android/hardware/radio/network/NetworkScanResult.aidl +++ b/radio/aidl/android/hardware/radio/network/NetworkScanResult.aidl @@ -19,6 +19,7 @@ package android.hardware.radio.network; import android.hardware.radio.RadioError; import android.hardware.radio.network.CellInfo; +/** @hide */ @VintfStability @JavaDerive(toString=true) parcelable NetworkScanResult { diff --git a/radio/aidl/android/hardware/radio/network/NgranBands.aidl b/radio/aidl/android/hardware/radio/network/NgranBands.aidl index 53c7a3d4e7c7414d7b5901140fd0aa5d6ca99c18..a87a0d137606308502f929fca967cdd2cbf466f0 100644 --- a/radio/aidl/android/hardware/radio/network/NgranBands.aidl +++ b/radio/aidl/android/hardware/radio/network/NgranBands.aidl @@ -18,6 +18,7 @@ package android.hardware.radio.network; /** * NGRAN bands up to V16.5.0 + * @hide */ @VintfStability @Backing(type="int") diff --git a/radio/aidl/android/hardware/radio/network/NrDualConnectivityState.aidl b/radio/aidl/android/hardware/radio/network/NrDualConnectivityState.aidl index e293dff81815b314294b470c35deffbfd8ab6a44..00e19fe29f08cfe6f47f23ddca411eadbe6c1641 100644 --- a/radio/aidl/android/hardware/radio/network/NrDualConnectivityState.aidl +++ b/radio/aidl/android/hardware/radio/network/NrDualConnectivityState.aidl @@ -18,6 +18,7 @@ package android.hardware.radio.network; /** * NR Dual connectivity state + * @hide */ @VintfStability @Backing(type="byte") diff --git a/radio/aidl/android/hardware/radio/network/NrIndicators.aidl b/radio/aidl/android/hardware/radio/network/NrIndicators.aidl index 32cc964007b85f31076155bf80d1f91ea15a9c4b..214272c9a428e7e01b2f1e3bac4a8490a1f4a89f 100644 --- a/radio/aidl/android/hardware/radio/network/NrIndicators.aidl +++ b/radio/aidl/android/hardware/radio/network/NrIndicators.aidl @@ -18,6 +18,7 @@ package android.hardware.radio.network; /** * The parameters of NR 5G Non-Standalone. + * @hide */ @VintfStability @JavaDerive(toString=true) diff --git a/radio/aidl/android/hardware/radio/network/NrSignalStrength.aidl b/radio/aidl/android/hardware/radio/network/NrSignalStrength.aidl index 30ae067ec035efb6d431d4c9c014c52f5447f978..65daf36a5c392d0d8811e2ed86d73f0e45f4f6ec 100644 --- a/radio/aidl/android/hardware/radio/network/NrSignalStrength.aidl +++ b/radio/aidl/android/hardware/radio/network/NrSignalStrength.aidl @@ -16,6 +16,7 @@ package android.hardware.radio.network; +/** @hide */ @VintfStability @JavaDerive(toString=true) parcelable NrSignalStrength { diff --git a/radio/aidl/android/hardware/radio/network/NrVopsInfo.aidl b/radio/aidl/android/hardware/radio/network/NrVopsInfo.aidl index 197f401e7e233f1ac7c94f9976ce322541f317b7..71961a3e08263469911c17c9115af22ab5cb9a13 100644 --- a/radio/aidl/android/hardware/radio/network/NrVopsInfo.aidl +++ b/radio/aidl/android/hardware/radio/network/NrVopsInfo.aidl @@ -19,6 +19,7 @@ package android.hardware.radio.network; /** * Type to define the NR specific network capabilities for voice over PS including emergency and * normal voice calls. + * @hide */ @VintfStability @JavaDerive(toString=true) diff --git a/radio/aidl/android/hardware/radio/network/OperatorInfo.aidl b/radio/aidl/android/hardware/radio/network/OperatorInfo.aidl index 56f4dcad360ad94a05ba445e36b090a4d84de505..36dbadf94dc0af60f12f8304dbc0a99760bf6b60 100644 --- a/radio/aidl/android/hardware/radio/network/OperatorInfo.aidl +++ b/radio/aidl/android/hardware/radio/network/OperatorInfo.aidl @@ -16,6 +16,7 @@ package android.hardware.radio.network; +/** @hide */ @VintfStability @JavaDerive(toString=true) parcelable OperatorInfo { diff --git a/radio/aidl/android/hardware/radio/network/PhoneRestrictedState.aidl b/radio/aidl/android/hardware/radio/network/PhoneRestrictedState.aidl index 23ae3b1a82ed7c11e1bfdb78d7837c3f1fd16409..de3527c2caf80d784ec438521b497644cffaa8ce 100644 --- a/radio/aidl/android/hardware/radio/network/PhoneRestrictedState.aidl +++ b/radio/aidl/android/hardware/radio/network/PhoneRestrictedState.aidl @@ -16,6 +16,7 @@ package android.hardware.radio.network; +/** @hide */ @VintfStability @Backing(type="int") @JavaDerive(toString=true) diff --git a/radio/aidl/android/hardware/radio/network/PhysicalChannelConfig.aidl b/radio/aidl/android/hardware/radio/network/PhysicalChannelConfig.aidl index 9996953dcb527034cc6e21e0a51a2062b8434d94..ecb946333d1505e52af7b0e968a76260d2f7237e 100644 --- a/radio/aidl/android/hardware/radio/network/PhysicalChannelConfig.aidl +++ b/radio/aidl/android/hardware/radio/network/PhysicalChannelConfig.aidl @@ -20,6 +20,7 @@ import android.hardware.radio.RadioTechnology; import android.hardware.radio.network.CellConnectionStatus; import android.hardware.radio.network.PhysicalChannelConfigBand; +/** @hide */ @VintfStability @JavaDerive(toString=true) parcelable PhysicalChannelConfig { diff --git a/radio/aidl/android/hardware/radio/network/PhysicalChannelConfigBand.aidl b/radio/aidl/android/hardware/radio/network/PhysicalChannelConfigBand.aidl index 707a032494394de34be80f9c314891d8c58ee44b..aa0e9b256a1a31b56638939682e4365c2d9a8364 100644 --- a/radio/aidl/android/hardware/radio/network/PhysicalChannelConfigBand.aidl +++ b/radio/aidl/android/hardware/radio/network/PhysicalChannelConfigBand.aidl @@ -21,6 +21,7 @@ import android.hardware.radio.network.GeranBands; import android.hardware.radio.network.NgranBands; import android.hardware.radio.network.UtranBands; +/** @hide */ @VintfStability @JavaDerive(toString=true) union PhysicalChannelConfigBand { diff --git a/radio/aidl/android/hardware/radio/network/RadioAccessSpecifier.aidl b/radio/aidl/android/hardware/radio/network/RadioAccessSpecifier.aidl index 85042489a9c5e6a820642cd5a8944d2fb4c0a8eb..b3cee47e2757feaca2c3bc5338fe6085fb01e21e 100644 --- a/radio/aidl/android/hardware/radio/network/RadioAccessSpecifier.aidl +++ b/radio/aidl/android/hardware/radio/network/RadioAccessSpecifier.aidl @@ -19,6 +19,7 @@ package android.hardware.radio.network; import android.hardware.radio.AccessNetwork; import android.hardware.radio.network.RadioAccessSpecifierBands; +/** @hide */ @VintfStability @JavaDerive(toString=true) parcelable RadioAccessSpecifier { diff --git a/radio/aidl/android/hardware/radio/network/RadioAccessSpecifierBands.aidl b/radio/aidl/android/hardware/radio/network/RadioAccessSpecifierBands.aidl index 38afee56930a5845b6522ffce4bb548c83982e28..4bf694ab0bf3cab36b507f520c28a6034bff326a 100644 --- a/radio/aidl/android/hardware/radio/network/RadioAccessSpecifierBands.aidl +++ b/radio/aidl/android/hardware/radio/network/RadioAccessSpecifierBands.aidl @@ -21,6 +21,7 @@ import android.hardware.radio.network.GeranBands; import android.hardware.radio.network.NgranBands; import android.hardware.radio.network.UtranBands; +/** @hide */ @VintfStability @JavaDerive(toString=true) union RadioAccessSpecifierBands { diff --git a/radio/aidl/android/hardware/radio/network/RadioBandMode.aidl b/radio/aidl/android/hardware/radio/network/RadioBandMode.aidl index 45c4a516db9b2219860f5a0ba9d9995f1d4d1d7f..364a562490c90e7f994539e420fcff79921222f7 100644 --- a/radio/aidl/android/hardware/radio/network/RadioBandMode.aidl +++ b/radio/aidl/android/hardware/radio/network/RadioBandMode.aidl @@ -16,6 +16,7 @@ package android.hardware.radio.network; +/** @hide */ @VintfStability @Backing(type="int") @JavaDerive(toString=true) diff --git a/radio/aidl/android/hardware/radio/network/RegState.aidl b/radio/aidl/android/hardware/radio/network/RegState.aidl index bdba4c4a7829afe67be30a0e3351fce68cf7b0cb..de2d5f67a8d528e0d1fdd2a267706701b6e04b61 100644 --- a/radio/aidl/android/hardware/radio/network/RegState.aidl +++ b/radio/aidl/android/hardware/radio/network/RegState.aidl @@ -20,6 +20,7 @@ package android.hardware.radio.network; * Please note that registration state UNKNOWN is treated as "out of service" in Android telephony. * Registration state REG_DENIED must be returned if Location Update Reject (with cause 17 - Network * Failure) is received repeatedly from the network, to facilitate "managed roaming". + * @hide */ @VintfStability @Backing(type="int") diff --git a/radio/aidl/android/hardware/radio/network/RegStateResult.aidl b/radio/aidl/android/hardware/radio/network/RegStateResult.aidl index f1d2972fc9112b3901aac4153110d3ea628caac8..57a73c0b26beaa63a3c7f7f1aea1f952ca89b60b 100644 --- a/radio/aidl/android/hardware/radio/network/RegStateResult.aidl +++ b/radio/aidl/android/hardware/radio/network/RegStateResult.aidl @@ -22,6 +22,7 @@ import android.hardware.radio.network.CellIdentity; import android.hardware.radio.network.RegState; import android.hardware.radio.network.RegistrationFailCause; +/** @hide */ @VintfStability @JavaDerive(toString=true) parcelable RegStateResult { diff --git a/radio/aidl/android/hardware/radio/network/RegistrationFailCause.aidl b/radio/aidl/android/hardware/radio/network/RegistrationFailCause.aidl index 9549f2e841b8fbbdb24eec5f2b5a2dc894d80ed6..2955f9658d25eb976f15801b6340bbdfab67cac1 100644 --- a/radio/aidl/android/hardware/radio/network/RegistrationFailCause.aidl +++ b/radio/aidl/android/hardware/radio/network/RegistrationFailCause.aidl @@ -19,6 +19,7 @@ package android.hardware.radio.network; /** * Call fail causes for Circuit-switched service enumerated in 3GPP TS 24.008, 10.5.3.6 and * 10.5.147. Additional detail is available in 3GPP TS 24.008 Annex G. + * @hide */ @VintfStability @Backing(type="int") diff --git a/radio/aidl/android/hardware/radio/network/SecurityAlgorithm.aidl b/radio/aidl/android/hardware/radio/network/SecurityAlgorithm.aidl new file mode 100644 index 0000000000000000000000000000000000000000..71c654c53d60a4a8bc6403f5a648400de0974f2b --- /dev/null +++ b/radio/aidl/android/hardware/radio/network/SecurityAlgorithm.aidl @@ -0,0 +1,90 @@ +/* + * Copyright 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.hardware.radio.network; + +/** + * See IRadioNetwork.securityAlgorithmsUpdated for more details. + * + * @hide + */ +@VintfStability +@Backing(type="int") +@JavaDerive(toString=true) +enum SecurityAlgorithm { + // GSM CS services (3GPP TS 43.020) + A50 = 0, + A51 = 1, + A52 = 2, + A53 = 3, + A54 = 4, + + // GPRS PS services (3GPP TS 43.020) + // These also refer to the respective integrity counterparts. + // E.g. GEA1 = GIA1 + GEA0 = 14, + GEA1 = 15, + GEA2 = 16, + GEA3 = 17, + GEA4 = 18, + GEA5 = 19, + + // 3G PS/CS services (3GPP TS 33.102) + UEA0 = 29, + UEA1 = 30, + UEA2 = 31, + + // 4G PS services & 5G NSA (3GPP TS 33.401) + EEA0 = 41, + EEA1 = 42, + EEA2 = 43, + EEA3 = 44, + + // 5G PS services (3GPP TS 33.401 for 5G NSA and 3GPP TS 33.501 for 5G SA) + NEA0 = 55, + NEA1 = 56, + NEA2 = 57, + NEA3 = 58, + + // SIP layer security (See 3GPP TS 33.203) + SIP_NULL = 68, + AES_GCM = 69, + AES_GMAC = 70, + AES_CBC = 71, + DES_EDE3_CBC = 72, + AES_EDE3_CBC = 73, + HMAC_SHA1_96 = 74, + HMAC_SHA1_96_null = 75, + HMAC_MD5_96 = 76, + HMAC_MD5_96_null = 77, + + // RTP (see 3GPP TS 33.328) + SRTP_AES_COUNTER = 87, + SRTP_AES_F8 = 88, + SRTP_HMAC_SHA1 = 89, + + // ePDG (3GPP TS 33.402) + ENCR_AES_GCM_16 = 99, + ENCR_AES_CBC = 100, + AUTH_HMAC_SHA2_256_128 = 101, + + /** Unknown */ + UNKNOWN = 113, + OTHER = 114, + + /** For proprietary algorithms */ + ORYX = 124, +} diff --git a/radio/aidl/android/hardware/radio/network/SecurityAlgorithmUpdate.aidl b/radio/aidl/android/hardware/radio/network/SecurityAlgorithmUpdate.aidl new file mode 100644 index 0000000000000000000000000000000000000000..e945d3be29d3cea2314f011654407d9e04108ea9 --- /dev/null +++ b/radio/aidl/android/hardware/radio/network/SecurityAlgorithmUpdate.aidl @@ -0,0 +1,48 @@ +/* + * Copyright 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.hardware.radio.network; + +import android.hardware.radio.network.ConnectionEvent; +import android.hardware.radio.network.SecurityAlgorithm; + +/** + * A single occurrence capturing a notable change to previously reported + * cryptography algorithms for a given network and network event. + * + * @hide + */ +@JavaDerive(toString=true) +@VintfStability +parcelable SecurityAlgorithmUpdate { + /** + * Type of connection event which is being reported on + */ + ConnectionEvent connectionEvent; + /** + * Encryption algorithm which was used + */ + SecurityAlgorithm encryption; + /** + * Integrity algorithm which was used + */ + SecurityAlgorithm integrity; + /** + * Whether or not this connection event is associated with an + * unauthenticated / unencrypted emergency session + */ + boolean isUnprotectedEmergency; +} diff --git a/radio/aidl/android/hardware/radio/network/SignalStrength.aidl b/radio/aidl/android/hardware/radio/network/SignalStrength.aidl index ddb45822b74558730fa318676ef87bb6d995714d..5fed522d6aa7512a6c8f8092bd32510317726e87 100644 --- a/radio/aidl/android/hardware/radio/network/SignalStrength.aidl +++ b/radio/aidl/android/hardware/radio/network/SignalStrength.aidl @@ -24,6 +24,7 @@ import android.hardware.radio.network.NrSignalStrength; import android.hardware.radio.network.TdscdmaSignalStrength; import android.hardware.radio.network.WcdmaSignalStrength; +/** @hide */ @VintfStability @JavaDerive(toString=true) parcelable SignalStrength { diff --git a/radio/aidl/android/hardware/radio/network/SignalThresholdInfo.aidl b/radio/aidl/android/hardware/radio/network/SignalThresholdInfo.aidl index 0a8e9ceee7500ad3d859143eb449b2c300ea46ff..e440a648584ee77a503a27da09e00f3e7b3c30ca 100644 --- a/radio/aidl/android/hardware/radio/network/SignalThresholdInfo.aidl +++ b/radio/aidl/android/hardware/radio/network/SignalThresholdInfo.aidl @@ -20,6 +20,7 @@ import android.hardware.radio.AccessNetwork; /** * Contains the threshold values of each signal measurement type. + * @hide */ @VintfStability @JavaDerive(toString=true) diff --git a/radio/aidl/android/hardware/radio/network/SuppSvcNotification.aidl b/radio/aidl/android/hardware/radio/network/SuppSvcNotification.aidl index d4229e1b1aed05ea153f678fa7940cf3fe94c22d..3b8c8b2171532deac10fd009c0d1d9a625604838 100644 --- a/radio/aidl/android/hardware/radio/network/SuppSvcNotification.aidl +++ b/radio/aidl/android/hardware/radio/network/SuppSvcNotification.aidl @@ -16,6 +16,7 @@ package android.hardware.radio.network; +/** @hide */ @VintfStability @JavaDerive(toString=true) parcelable SuppSvcNotification { diff --git a/radio/aidl/android/hardware/radio/network/TdscdmaSignalStrength.aidl b/radio/aidl/android/hardware/radio/network/TdscdmaSignalStrength.aidl index ec9ca6bb6992b74fc7859b96413d3ac9929edc01..4afdd0f40408ea039062ec0b68f9824d9d9e87f1 100644 --- a/radio/aidl/android/hardware/radio/network/TdscdmaSignalStrength.aidl +++ b/radio/aidl/android/hardware/radio/network/TdscdmaSignalStrength.aidl @@ -16,6 +16,7 @@ package android.hardware.radio.network; +/** @hide */ @VintfStability @JavaDerive(toString=true) parcelable TdscdmaSignalStrength { diff --git a/radio/aidl/android/hardware/radio/network/UsageSetting.aidl b/radio/aidl/android/hardware/radio/network/UsageSetting.aidl index 5a714a436d169e72bcae765fb89c714deacefb33..0b6cfdd20d915935571ca2b7112a405b72f5287f 100644 --- a/radio/aidl/android/hardware/radio/network/UsageSetting.aidl +++ b/radio/aidl/android/hardware/radio/network/UsageSetting.aidl @@ -21,6 +21,7 @@ package android.hardware.radio.network; * *

      Also refer to "UE's usage setting" as defined in 3gpp 24.301 section 3.1 and 3gpp 23.221 * Annex A. + * @hide */ @VintfStability @Backing(type="int") diff --git a/radio/aidl/android/hardware/radio/network/UtranBands.aidl b/radio/aidl/android/hardware/radio/network/UtranBands.aidl index a0fd427c28bad254c4ace5e837a63fac8079ca19..8478b6607c48cb0e8439a99393fbb976e1d0a0c3 100644 --- a/radio/aidl/android/hardware/radio/network/UtranBands.aidl +++ b/radio/aidl/android/hardware/radio/network/UtranBands.aidl @@ -18,6 +18,7 @@ package android.hardware.radio.network; /** * UTRAN bands up to V15.0.0 + * @hide */ @VintfStability @Backing(type="int") diff --git a/radio/aidl/android/hardware/radio/network/WcdmaSignalStrength.aidl b/radio/aidl/android/hardware/radio/network/WcdmaSignalStrength.aidl index 7595c0542ea62f7d1d30b0d0b2ea01c5cc2764b8..ace89ed7a98db3a15119e1e9c0d3d37fdef5a2bd 100644 --- a/radio/aidl/android/hardware/radio/network/WcdmaSignalStrength.aidl +++ b/radio/aidl/android/hardware/radio/network/WcdmaSignalStrength.aidl @@ -16,6 +16,7 @@ package android.hardware.radio.network; +/** @hide */ @VintfStability @JavaDerive(toString=true) parcelable WcdmaSignalStrength { diff --git a/radio/aidl/android/hardware/radio/sap/ISap.aidl b/radio/aidl/android/hardware/radio/sap/ISap.aidl index 552e602b75f0437006e9375c30aba21197382fe6..04eee439e941a195c78a6f4c63c4290006c30340 100644 --- a/radio/aidl/android/hardware/radio/sap/ISap.aidl +++ b/radio/aidl/android/hardware/radio/sap/ISap.aidl @@ -28,6 +28,8 @@ oneway interface ISap { * @param serial Id to match req-resp. Resp must include same serial. * @param type APDU command type * @param command CommandAPDU/CommandAPDU7816 parameter depending on type + * + * This is available when android.hardware.telephony.subscription is defined. */ void apduReq(in int serial, in SapApduType type, in byte[] command); @@ -36,6 +38,8 @@ oneway interface ISap { * * @param serial Id to match req-resp. Resp must include same serial. * @param maxMsgSizeBytes MaxMsgSize to be used for SIM Access Profile connection + * + * This is available when android.hardware.telephony.subscription is defined. */ void connectReq(in int serial, in int maxMsgSizeBytes); @@ -43,6 +47,8 @@ oneway interface ISap { * DISCONNECT_REQ from SAP 1.1 spec 5.1.3 * * @param serial Id to match req-resp. Resp must include same serial. + * + * This is available when android.hardware.telephony.subscription is defined. */ void disconnectReq(in int serial); @@ -51,6 +57,8 @@ oneway interface ISap { * * @param serial Id to match req-resp. Resp must include same serial. * @param powerOn true for on, false for off + * + * This is available when android.hardware.telephony.subscription is defined. */ void powerReq(in int serial, in boolean powerOn); @@ -58,6 +66,8 @@ oneway interface ISap { * RESET_SIM_REQ from SAP 1.1 spec 5.1.14 * * @param serial Id to match req-resp. Resp must include same serial. + * + * This is available when android.hardware.telephony.subscription is defined. */ void resetSimReq(in int serial); @@ -65,6 +75,8 @@ oneway interface ISap { * Set callback that has response and unsolicited indication functions * * @param sapCallback Object containing response and unosolicited indication callbacks + * + * This is available when android.hardware.telephony.subscription is defined. */ void setCallback(in ISapCallback sapCallback); @@ -73,6 +85,8 @@ oneway interface ISap { * * @param serial Id to match req-resp. Resp must include same serial. * @param transferProtocol Transport Protocol + * + * This is available when android.hardware.telephony.subscription is defined. */ void setTransferProtocolReq(in int serial, in SapTransferProtocol transferProtocol); @@ -80,6 +94,8 @@ oneway interface ISap { * TRANSFER_ATR_REQ from SAP 1.1 spec 5.1.8 * * @param serial Id to match req-resp. Resp must include same serial. + * + * This is available when android.hardware.telephony.subscription is defined. */ void transferAtrReq(in int serial); @@ -87,6 +103,8 @@ oneway interface ISap { * TRANSFER_CARD_READER_STATUS_REQ from SAP 1.1 spec 5.1.17 * * @param serial Id to match req-resp. Resp must include same serial. + * + * This is available when android.hardware.telephony.subscription is defined. */ void transferCardReaderStatusReq(in int serial); } diff --git a/radio/aidl/android/hardware/radio/sap/ISapCallback.aidl b/radio/aidl/android/hardware/radio/sap/ISapCallback.aidl index 34111eb7ffc236c4595c1758773c0acc384329ee..37a94b8b5a52b3b6d0f386bb3b282d53f2bda05b 100644 --- a/radio/aidl/android/hardware/radio/sap/ISapCallback.aidl +++ b/radio/aidl/android/hardware/radio/sap/ISapCallback.aidl @@ -29,6 +29,8 @@ oneway interface ISapCallback { * @param serial Id to match req-resp. Value must match the one in req. * @param resultCode ResultCode to indicate if command was processed correctly * Possible values: + * SapResultCode:NOT_SUPPORTED when android.hardware.telephony.subscription is not + * defined * SapResultCode:SUCCESS, * SapResultCode:GENERIC_FAILURE, * SapResultCode:CARD_NOT_ACCESSSIBLE, @@ -77,6 +79,8 @@ oneway interface ISapCallback { * @param serial Id to match req-resp. Value must match the one in req. * @param resultCode ResultCode to indicate if command was processed correctly * Possible values: + * SapResultCode:NOT_SUPPORTED when android.hardware.telephony.subscription is not + * defined * SapResultCode:SUCCESS, * SapResultCode:GENERIC_FAILURE, * SapResultCode:CARD_NOT_ACCESSSIBLE, (possible only for power on req) @@ -92,6 +96,8 @@ oneway interface ISapCallback { * @param serial Id to match req-resp. Value must match the one in req. * @param resultCode ResultCode to indicate if command was processed correctly * Possible values: + * SapResultCode:NOT_SUPPORTED when android.hardware.telephony.subscription is not + * defined * SapResultCode:SUCCESS, * SapResultCode:GENERIC_FAILURE, * SapResultCode:CARD_NOT_ACCESSSIBLE, @@ -114,6 +120,8 @@ oneway interface ISapCallback { * @param serial Id to match req-resp. Value must match the one in req. * @param resultCode ResultCode to indicate if command was processed correctly * Possible values: + * SapResultCode:NOT_SUPPORTED when android.hardware.telephony.subscription is not + * defined * SapResultCode:SUCCESS, * SapResultCode:GENERIC_FAILURE, * SapResultCode:CARD_ALREADY_POWERED_OFF, @@ -130,6 +138,8 @@ oneway interface ISapCallback { * @param serial Id to match req-resp. Value must match the one in req. * @param resultCode ResultCode to indicate if command was processed correctly * Possible values: + * SapResultCode:NOT_SUPPORTED when android.hardware.telephony.subscription is not + * defined * SapResultCode:SUCCESS, * SapResultCode:GENERIC_FAILURE * SapResultCode:DATA_NOT_AVAILABLE @@ -145,6 +155,8 @@ oneway interface ISapCallback { * @param serial Id to match req-resp. Value must match the one in req. * @param resultCode ResultCode to indicate if command was processed correctly * Possible values: + * SapResultCode:NOT_SUPPORTED when android.hardware.telephony.subscription is not + * defined * SapResultCode:SUCCESS * SapResultCode:NOT_SUPPORTED */ diff --git a/radio/aidl/android/hardware/radio/sim/AppStatus.aidl b/radio/aidl/android/hardware/radio/sim/AppStatus.aidl index c072f6a321ae372c3cbbc2ed47e8bbf4e184696e..7fe8e40c9ec6574e2d415fe866078ff312160ba5 100644 --- a/radio/aidl/android/hardware/radio/sim/AppStatus.aidl +++ b/radio/aidl/android/hardware/radio/sim/AppStatus.aidl @@ -19,6 +19,7 @@ package android.hardware.radio.sim; import android.hardware.radio.sim.PersoSubstate; import android.hardware.radio.sim.PinState; +/** @hide */ @VintfStability @JavaDerive(toString=true) parcelable AppStatus { diff --git a/radio/aidl/android/hardware/radio/sim/CardPowerState.aidl b/radio/aidl/android/hardware/radio/sim/CardPowerState.aidl index f8b5922c3b0ca1b3aaf9d7d701e3c59bedcaac17..2598dcb19ff4d0948f88523c5eb506c13b4bf037 100644 --- a/radio/aidl/android/hardware/radio/sim/CardPowerState.aidl +++ b/radio/aidl/android/hardware/radio/sim/CardPowerState.aidl @@ -16,6 +16,7 @@ package android.hardware.radio.sim; +/** @hide */ @VintfStability @Backing(type="int") @JavaDerive(toString=true) diff --git a/radio/aidl/android/hardware/radio/sim/CardStatus.aidl b/radio/aidl/android/hardware/radio/sim/CardStatus.aidl index 1419c51de603f01cdb0680a743f4b101e91c66c1..043bfa4d20a1d1ed7a74a337f79a2012b22e8e48 100644 --- a/radio/aidl/android/hardware/radio/sim/CardStatus.aidl +++ b/radio/aidl/android/hardware/radio/sim/CardStatus.aidl @@ -21,6 +21,7 @@ import android.hardware.radio.config.SlotPortMapping; import android.hardware.radio.sim.AppStatus; import android.hardware.radio.sim.PinState; +/** @hide */ @VintfStability @JavaDerive(toString=true) parcelable CardStatus { diff --git a/radio/aidl/android/hardware/radio/sim/Carrier.aidl b/radio/aidl/android/hardware/radio/sim/Carrier.aidl index d25214f5429c07ecb355cf4978dd354ee41195df..8b270885785b46219fb3e12d6e90217fa0f370bc 100644 --- a/radio/aidl/android/hardware/radio/sim/Carrier.aidl +++ b/radio/aidl/android/hardware/radio/sim/Carrier.aidl @@ -16,6 +16,7 @@ package android.hardware.radio.sim; +/** @hide */ @VintfStability @JavaDerive(toString=true) parcelable Carrier { diff --git a/radio/aidl/android/hardware/radio/sim/CarrierInfo.aidl b/radio/aidl/android/hardware/radio/sim/CarrierInfo.aidl new file mode 100644 index 0000000000000000000000000000000000000000..a8904978acbcb6c311206a090cd3d736e0cd0ad8 --- /dev/null +++ b/radio/aidl/android/hardware/radio/sim/CarrierInfo.aidl @@ -0,0 +1,70 @@ +/* + * Copyright (C) 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.hardware.radio.sim; + +import android.hardware.radio.sim.Plmn; + +/** @hide */ +@VintfStability +@JavaDerive(toString=true) +parcelable CarrierInfo { + /** + * MCC (Mobile Country Code) of Carrier. Wild char is either '*' or '?'. + */ + String mcc; + + /** + * MNC (Mobile Network Code) of the Carrier. Wild char is either '*' or '?'. + */ + String mnc; + /** + * Service Provider Name(SPN) of the SIM card of the Carrier. + */ + @nullable + String spn; + /** + * GID1 value of the SIM card of the Carrier. + */ + @nullable + String gid1; + /** + * GID2 value of the SIM card of the Carrier. + */ + @nullable + String gid2; + + /** + * IMSI (International Mobile Subscriber Identity) prefix. Wild char is '*'. + */ + @nullable + String imsiPrefix; + /** + * Equivalent HPLMN of the SIM card of the Carrier. + */ + @nullable + List ephlmn; + /** + * ICCID (Integrated Circuit Card Identification) of the SIM card. + */ + @nullable + String iccid; + /** + * IMPI (IMS Private Identity) of the SIM card of the Carrier. + */ + @nullable + String impi; +} \ No newline at end of file diff --git a/radio/aidl/android/hardware/radio/sim/CarrierRestrictions.aidl b/radio/aidl/android/hardware/radio/sim/CarrierRestrictions.aidl index edbec2c4f85e4cb5824ca2ac5818382c1e845cb0..0002d5a9f47f3dc3ce84feb34482b6e848430f60 100644 --- a/radio/aidl/android/hardware/radio/sim/CarrierRestrictions.aidl +++ b/radio/aidl/android/hardware/radio/sim/CarrierRestrictions.aidl @@ -17,7 +17,9 @@ package android.hardware.radio.sim; import android.hardware.radio.sim.Carrier; +import android.hardware.radio.sim.CarrierInfo; +/** @hide */ @VintfStability @JavaDerive(toString=true) parcelable CarrierRestrictions { @@ -25,12 +27,12 @@ parcelable CarrierRestrictions { @Backing(type="int") /** This enum defines the carrier restriction status values */ enum CarrierRestrictionStatus { - /** - * Carrier restriction status value is unknown, used in cases where modem is dependent on - * external module to know about the lock status and the module hasn’t yet provided the lock - * status. For example, when the lock status is maintained on a cloud server and device has - * just booted after out of box and not yet connected to the internet. - */ + /** + * Carrier restriction status value is unknown, used in cases where modem is dependent on + * external module to know about the lock status and the module hasn’t yet provided the lock + * status. For example, when the lock status is maintained on a cloud server and device has + * just booted after out of box and not yet connected to the internet. + */ UNKNOWN = 0, /** There is no carrier restriction on the device */ NOT_RESTRICTED = 1, @@ -39,12 +41,14 @@ parcelable CarrierRestrictions { } /** * Allowed carriers + * @deprecated use @List allowedCarrierInfoList */ Carrier[] allowedCarriers; /** * Explicitly excluded carriers which match allowed_carriers. Eg. allowedCarriers match mcc/mnc, * excludedCarriers has same mcc/mnc and gid1 is ABCD. It means except the carrier whose gid1 * is ABCD, all carriers with the same mcc/mnc are allowed. + * @deprecated use @List excludedCarrierInfoList */ Carrier[] excludedCarriers; /** @@ -58,4 +62,14 @@ parcelable CarrierRestrictions { boolean allowedCarriersPrioritized; /** Current restriction status as defined in CarrierRestrictionStatus enum */ CarrierRestrictionStatus status; -} + + /** Allowed carriers. */ + CarrierInfo[] allowedCarrierInfoList = {}; + + /** + * Explicitly excluded carriers which match allowed_carriers. Eg. allowedCarriers match mcc/mnc, + * excludedCarriers has same mcc/mnc and gid1 is ABCD. It means except the carrier whose gid1 + * is ABCD, all carriers with the same mcc/mnc are allowed. + */ + CarrierInfo[] excludedCarrierInfoList = {}; +} \ No newline at end of file diff --git a/radio/aidl/android/hardware/radio/sim/CdmaSubscriptionSource.aidl b/radio/aidl/android/hardware/radio/sim/CdmaSubscriptionSource.aidl index 6aa6926c272fa826236f4b81e8f8f360a4f22e36..4c6c1efbbe65d9cdd9adee131b5b9dde2c2eb87e 100644 --- a/radio/aidl/android/hardware/radio/sim/CdmaSubscriptionSource.aidl +++ b/radio/aidl/android/hardware/radio/sim/CdmaSubscriptionSource.aidl @@ -16,6 +16,7 @@ package android.hardware.radio.sim; +/** @hide */ @VintfStability @Backing(type="int") @JavaDerive(toString=true) diff --git a/radio/aidl/android/hardware/radio/sim/IRadioSim.aidl b/radio/aidl/android/hardware/radio/sim/IRadioSim.aidl index 3823a718b59216a0ba6a3c437d9ee9c0fb9c1d40..7870a749b0e3da3c107e77b72f35f305c90decd7 100644 --- a/radio/aidl/android/hardware/radio/sim/IRadioSim.aidl +++ b/radio/aidl/android/hardware/radio/sim/IRadioSim.aidl @@ -37,6 +37,7 @@ import android.hardware.radio.sim.SimLockMultiSimPolicy; * duration of a method call. If clients provide colliding serials (including passing the same * serial to different methods), multiple responses (one for each method call) must still be served. * setResponseFunctions must work with IRadioSimResponse and IRadioSimIndication. + * @hide */ @VintfStability oneway interface IRadioSim { @@ -48,6 +49,8 @@ oneway interface IRadioSim { * @param serial Serial number of request. * * Response function is IRadioSimResponse.areUiccApplicationsEnabledResponse() + * + * This is available when android.hardware.telephony.subscription is defined. */ void areUiccApplicationsEnabled(in int serial); @@ -60,6 +63,8 @@ oneway interface IRadioSim { * @param aid AID value, See ETSI 102.221 8.1 and 101.220 4, empty string if no value. * * Response function is IRadioSimResponse.changeIccPin2ForAppResponse() + * + * This is available when android.hardware.telephony.subscription is defined. */ void changeIccPin2ForApp(in int serial, in String oldPin2, in String newPin2, in String aid); @@ -72,6 +77,8 @@ oneway interface IRadioSim { * @param aid AID value, See ETSI 102.221 8.1 and 101.220 4, empty string if no value. * * Response function is IRadioSimResponse.changeIccPinForAppResponse() + * + * This is available when android.hardware.telephony.subscription is defined. */ void changeIccPinForApp(in int serial, in String oldPin, in String newPin, in String aid); @@ -90,6 +97,8 @@ oneway interface IRadioSim { * @param enable true if to enable uiccApplications, false to disable. * * Response function is IRadioSimResponse.enableUiccApplicationsResponse() + * + * This is available when android.hardware.telephony.subscription is defined. */ void enableUiccApplications(in int serial, in boolean enable); @@ -99,6 +108,8 @@ oneway interface IRadioSim { * @param serial Serial number of request. * * Response function is IRadioSimResponse.getAllowedCarriersResponse() + * + * This is available when android.hardware.telephony.subscription is defined. */ void getAllowedCarriers(in int serial); @@ -110,6 +121,8 @@ oneway interface IRadioSim { * @param serial Serial number of request. * * Response function is IRadioSimResponse.getCdmaSubscriptionResponse() + * + * This is available when android.hardware.telephony.cdma is defined. */ void getCdmaSubscription(in int serial); @@ -119,6 +132,8 @@ oneway interface IRadioSim { * @param serial Serial number of request. * * Response function is IRadioSimResponse.getCdmaSubscriptionSourceResponse() + * + * This is available when android.hardware.telephony.cdma is defined. */ void getCdmaSubscriptionSource(in int serial); @@ -134,6 +149,8 @@ oneway interface IRadioSim { * This is only applicable in the case of Fixed Dialing Numbers (FDN) requests. * * Response function is IRadioSimResponse.getFacilityLockForAppResponse() + * + * This is available when android.hardware.telephony.subscription is defined. */ void getFacilityLockForApp(in int serial, in String facility, in String password, in int serviceClass, in String appId); @@ -144,6 +161,8 @@ oneway interface IRadioSim { * @param serial Serial number of request. * * Response function is IRadioSimResponse.getIccCardStatusResponse() + * + * This is available when android.hardware.telephony.subscription is defined. */ void getIccCardStatus(in int serial); @@ -154,6 +173,8 @@ oneway interface IRadioSim { * @param aid AID value, See ETSI 102.221 8.1 and 101.220 4, empty string if no value. * * Response function is IRadioSimResponse.getImsiForAppResponse() + * + * This is available when android.hardware.telephony.subscription is defined. */ void getImsiForApp(in int serial, in String aid); @@ -163,6 +184,8 @@ oneway interface IRadioSim { * @param serial Serial number of request. * * Response function is IRadioSimResponse.getSimPhonebookCapacityResponse() + * + * This is available when android.hardware.telephony.subscription is defined. */ void getSimPhonebookCapacity(in int serial); @@ -174,6 +197,8 @@ oneway interface IRadioSim { * @param serial Serial number of request. * * Response function is IRadioSimResponse.getSimPhonebookRecordsResponse() + * + * This is available when android.hardware.telephony.subscription is defined. */ void getSimPhonebookRecords(in int serial); @@ -186,6 +211,8 @@ oneway interface IRadioSim { * * Response function is IRadioSimResponse.iccCloseLogicalChannelResponse() * + * This is available when android.hardware.telephony.subscription is defined. + * * @deprecated use iccCloseLogicalChannelWithSessionInfo instead. */ void iccCloseLogicalChannel(in int serial, in int channelId); @@ -201,6 +228,8 @@ oneway interface IRadioSim { * @param iccIo IccIo * * Response function is IRadioSimResponse.iccIoForAppResponse() + * + * This is available when android.hardware.telephony.subscription is defined. */ void iccIoForApp(in int serial, in IccIo iccIo); @@ -219,6 +248,8 @@ oneway interface IRadioSim { * @param p2 P2 value, described in ISO 7816-4. Ignore if equal to RadioConst:P2_CONSTANT_NO_P2 * * Response function is IRadioSimResponse.iccOpenLogicalChannelResponse() + * + * This is available when android.hardware.telephony.subscription is defined. */ void iccOpenLogicalChannel(in int serial, in String aid, in int p2); @@ -232,6 +263,8 @@ oneway interface IRadioSim { * @param message SimApdu to be sent * * Response function is IRadioSimResponse.iccTransmitApduBasicChannelResponse() + * + * This is available when android.hardware.telephony.subscription is defined. */ void iccTransmitApduBasicChannel(in int serial, in SimApdu message); @@ -244,6 +277,8 @@ oneway interface IRadioSim { * @param message SimApdu to be sent * * Response function is IRadioSimResponse.iccTransmitApduLogicalChannelResponse() + * + * This is available when android.hardware.telephony.subscription is defined. */ void iccTransmitApduLogicalChannel(in int serial, in SimApdu message); @@ -253,6 +288,8 @@ oneway interface IRadioSim { * @param serial Serial number of request. * * Response function is IRadioSimResponse.reportStkServiceIsRunningResponse() + * + * This is available when android.hardware.telephony.subscription is defined. */ void reportStkServiceIsRunning(in int serial); @@ -266,6 +303,8 @@ oneway interface IRadioSim { * @param aid AID value, See ETSI 102.221 8.1 and 101.220 4, empty string if no value * * Response function is IRadioSimResponse.requestIccSimAuthenticationResponse() + * + * This is available when android.hardware.telephony.subscription is defined. */ void requestIccSimAuthentication( in int serial, in int authContext, in String authData, in String aid); @@ -274,6 +313,8 @@ oneway interface IRadioSim { * When response type received from a radio indication or radio response is * RadioIndicationType:UNSOLICITED_ACK_EXP or RadioResponseType:SOLICITED_ACK_EXP respectively, * acknowledge the receipt of those messages by sending responseAcknowledgement(). + * + * This is available when android.hardware.telephony.subscription is defined. */ void responseAcknowledgement(); @@ -285,6 +326,8 @@ oneway interface IRadioSim { * @param contents SAT/USAT command in hexadecimal format string starting with command tag * * Response function is IRadioSimResponse.sendEnvelopeResponse() + * + * This is available when android.hardware.telephony.subscription is defined. */ void sendEnvelope(in int serial, in String contents); @@ -300,6 +343,8 @@ oneway interface IRadioSim { * @param contents SAT/USAT command in hexadecimal format starting with command tag * * Response function is IRadioSimResponse.sendEnvelopeWithStatusResponse() + * + * This is available when android.hardware.telephony.subscription is defined. */ void sendEnvelopeWithStatus(in int serial, in String contents); @@ -311,6 +356,8 @@ oneway interface IRadioSim { * first byte of response data * * Response function is IRadioSimResponse.sendTerminalResponseResponseToSim() + * + * This is available when android.hardware.telephony.subscription is defined. */ void sendTerminalResponseToSim(in int serial, in String contents); @@ -330,6 +377,8 @@ oneway interface IRadioSim { * @param multiSimPolicy Policy to be used for devices with multiple SIMs. * * Response function is IRadioSimResponse.setAllowedCarriersResponse() + * + * This is available when android.hardware.telephony.subscription is defined. */ void setAllowedCarriers(in int serial, in CarrierRestrictions carriers, in SimLockMultiSimPolicy multiSimPolicy); @@ -343,6 +392,8 @@ oneway interface IRadioSim { * @param imsiEncryptionInfo ImsiEncryptionInfo * * Response function is IRadioSimResponse.setCarrierInfoForImsiEncryptionResponse() + * + * This is available when android.hardware.telephony.subscription is defined. */ void setCarrierInfoForImsiEncryption(in int serial, in ImsiEncryptionInfo imsiEncryptionInfo); @@ -353,6 +404,8 @@ oneway interface IRadioSim { * @param cdmaSub CdmaSubscriptionSource * * Response function is IRadioSimResponse.setCdmaSubscriptionSourceResponse() + * + * This is available when android.hardware.telephony.cdma is defined. */ void setCdmaSubscriptionSource(in int serial, in CdmaSubscriptionSource cdmaSub); @@ -369,6 +422,8 @@ oneway interface IRadioSim { * This is only applicable in the case of Fixed Dialing Numbers (FDN) requests. * * Response function is IRadioSimResponse.setFacilityLockForAppResponse() + * + * This is available when android.hardware.telephony.subscription is defined. */ void setFacilityLockForApp(in int serial, in String facility, in boolean lockState, in String password, in int serviceClass, in String appId); @@ -378,6 +433,8 @@ oneway interface IRadioSim { * * @param radioSimResponse Object containing response functions * @param radioSimIndication Object containing radio indications + * + * This is available when android.hardware.telephony.subscription is defined. */ void setResponseFunctions( in IRadioSimResponse radioSimResponse, in IRadioSimIndication radioSimIndication); @@ -408,6 +465,8 @@ oneway interface IRadioSim { * POWER_UP_PASS_THROUGH if powering up the SIM card in pass through mode * * Response function is IRadioSimResponse.setSimCardPowerResponse() + * + * This is available when android.hardware.telephony.subscription is defined. */ void setSimCardPower(in int serial, in CardPowerState powerUp); @@ -418,6 +477,8 @@ oneway interface IRadioSim { * @param uiccSub SelectUiccSub * * Response function is IRadioSimResponse.setUiccSubscriptionResponse() + * + * This is available when android.hardware.telephony.subscription is defined. */ void setUiccSubscription(in int serial, in SelectUiccSub uiccSub); @@ -430,6 +491,8 @@ oneway interface IRadioSim { * @param aid AID value, See ETSI 102.221 8.1 and 101.220 4, empty string if no value. * * Response function is IRadioSimResponse.supplyIccPin2ForAppResponse() + * + * This is available when android.hardware.telephony.subscription is defined. */ void supplyIccPin2ForApp(in int serial, in String pin2, in String aid); @@ -441,6 +504,8 @@ oneway interface IRadioSim { * @param aid AID value, See ETSI 102.221 8.1 and 101.220 4, empty string if no value. * * Response function is IRadioSimResponse.supplyIccPinForAppResponse() + * + * This is available when android.hardware.telephony.subscription is defined. */ void supplyIccPinForApp(in int serial, in String pin, in String aid); @@ -453,6 +518,8 @@ oneway interface IRadioSim { * @param aid AID value, See ETSI 102.221 8.1 and 101.220 4, empty string if no value. * * Response function is IRadioSimResponse.supplyIccPuk2ForAppResponse() + * + * This is available when android.hardware.telephony.subscription is defined. */ void supplyIccPuk2ForApp(in int serial, in String puk2, in String pin2, in String aid); @@ -465,6 +532,8 @@ oneway interface IRadioSim { * @param aid AID value, See ETSI 102.221 8.1 and 101.220 4, empty string if no value. * * Response function is IRadioSimResponse.supplyIccPukForAppResponse() + * + * This is available when android.hardware.telephony.subscription is defined. */ void supplyIccPukForApp(in int serial, in String puk, in String pin, in String aid); @@ -480,6 +549,8 @@ oneway interface IRadioSim { * @param controlKey the unlock code for removing persoType personalization from this device * * Response function is IRadioSimResponse.supplySimDepersonalizationResponse() + * + * This is available when android.hardware.telephony.subscription is defined. */ void supplySimDepersonalization( in int serial, in PersoSubstate persoType, in String controlKey); @@ -495,6 +566,8 @@ oneway interface IRadioSim { * @param recordInfo Details of the record to insert, delete or update. * * Response function is IRadioSimResponse.updateSimPhonebookRecordsResponse() + * + * This is available when android.hardware.telephony.subscription is defined. */ void updateSimPhonebookRecords(in int serial, in PhonebookRecordInfo recordInfo); @@ -510,6 +583,8 @@ oneway interface IRadioSim { * @param sessionInfo Details of the opened logical channel info like sessionId and isEs10. * * Response function is IRadioSimResponse.iccCloseLogicalChannelWithSessionInfoResponse() + * + * This is available when android.hardware.telephony.subscription is defined. */ void iccCloseLogicalChannelWithSessionInfo(in int serial, in SessionInfo sessionInfo); } diff --git a/radio/aidl/android/hardware/radio/sim/IRadioSimIndication.aidl b/radio/aidl/android/hardware/radio/sim/IRadioSimIndication.aidl index a13904099d617f6987f5d926170668491a65d254..fc6355d42559f98be515a78363a73d4208a9c7f5 100644 --- a/radio/aidl/android/hardware/radio/sim/IRadioSimIndication.aidl +++ b/radio/aidl/android/hardware/radio/sim/IRadioSimIndication.aidl @@ -24,6 +24,7 @@ import android.hardware.radio.sim.SimRefreshResult; /** * Interface declaring unsolicited radio indications for SIM APIs. + * @hide */ @VintfStability oneway interface IRadioSimIndication { diff --git a/radio/aidl/android/hardware/radio/sim/IRadioSimResponse.aidl b/radio/aidl/android/hardware/radio/sim/IRadioSimResponse.aidl index 90f172f802706706f5ac873fee098c91e7ac9559..91b57292be09d94fc2816c69a42a10039d5866a7 100644 --- a/radio/aidl/android/hardware/radio/sim/IRadioSimResponse.aidl +++ b/radio/aidl/android/hardware/radio/sim/IRadioSimResponse.aidl @@ -27,6 +27,7 @@ import android.hardware.radio.sim.SimLockMultiSimPolicy; /** * Interface declaring response functions to solicited radio requests for SIM APIs. + * @hide */ @VintfStability oneway interface IRadioSimResponse { @@ -44,6 +45,8 @@ oneway interface IRadioSimResponse { * @param enabled whether Uicc applications are enabled. * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.subscription is not + * defined * RadioError:NONE * RadioError:SIM_ABSENT * RadioError:RADIO_NOT_AVAILABLE @@ -56,6 +59,8 @@ oneway interface IRadioSimResponse { * @param remainingRetries Number of retries remaining, must be equal to -1 if unknown. * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.subscription is not + * defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE (radio resetting) * RadioError:PASSWORD_INCORRECT (old PIN2 is invalid) @@ -74,6 +79,8 @@ oneway interface IRadioSimResponse { * @param remainingRetries Number of retries remaining, must be equal to -1 if unknown. * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.subscription is not + * defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE (radio resetting) * RadioError:PASSWORD_INCORRECT @@ -90,6 +97,8 @@ oneway interface IRadioSimResponse { * @param info Response info struct containing response type, serial no. and error * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.subscription is not + * defined * RadioError:NONE * RadioError:SIM_ABSENT * RadioError:RADIO_NOT_AVAILABLE @@ -104,6 +113,8 @@ oneway interface IRadioSimResponse { * @param multiSimPolicy Policy used for devices with multiple SIM cards. * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.subscription is not + * defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE */ @@ -121,6 +132,7 @@ oneway interface IRadioSimResponse { * @param prl PRL version if CDMA subscription is available * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.cdma is not defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:SUBSCRIPTION_NOT_AVAILABLE @@ -142,6 +154,7 @@ oneway interface IRadioSimResponse { * @param source CDMA subscription source * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.cdma is not defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:SUBSCRIPTION_NOT_AVAILABLE @@ -160,6 +173,8 @@ oneway interface IRadioSimResponse { * specified barring facility is active. "0" means "disabled for all" * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.subscription is not + * defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:SS_MODIFIED_TO_DIAL @@ -181,6 +196,8 @@ oneway interface IRadioSimResponse { * @param cardStatus ICC card status as defined by CardStatus * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.subscription is not + * defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:INTERNAL_ERR @@ -193,6 +210,8 @@ oneway interface IRadioSimResponse { * @param imsi String containing the IMSI * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.subscription is not + * defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE (radio resetting) * RadioError:INTERNAL_ERR @@ -209,6 +228,8 @@ oneway interface IRadioSimResponse { * @param capacity Response capacity enum indicating response processing status * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.subscription is not + * defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:INVALID_ARGUMENTS @@ -222,6 +243,8 @@ oneway interface IRadioSimResponse { * @param info Response info struct containing response type, serial no. and error * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.subscription is not + * defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:INVALID_ARGUMENTS @@ -235,6 +258,8 @@ oneway interface IRadioSimResponse { * @param info Response info struct containing response type, serial no. and error * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.subscription is not + * defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:INTERNAL_ERR @@ -251,6 +276,8 @@ oneway interface IRadioSimResponse { * @param iccIo ICC IO operation response * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.subscription is not + * defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:SIM_PIN2 @@ -271,6 +298,8 @@ oneway interface IRadioSimResponse { * byte per integer * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.subscription is not + * defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:MISSING_RESOURCE @@ -291,6 +320,8 @@ oneway interface IRadioSimResponse { * @param result IccIoResult * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.subscription is not + * defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:INTERNAL_ERR @@ -305,6 +336,8 @@ oneway interface IRadioSimResponse { * @param result IccIoResult * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.subscription is not + * defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:INTERNAL_ERR @@ -318,6 +351,8 @@ oneway interface IRadioSimResponse { * @param info Response info struct containing response type, serial no. and error * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.subscription is not + * defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:INTERNAL_ERR @@ -332,6 +367,8 @@ oneway interface IRadioSimResponse { * @param result IccIoResult * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.subscription is not + * defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:INTERNAL_ERR @@ -350,6 +387,8 @@ oneway interface IRadioSimResponse { * byte of response * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.subscription is not + * defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:SIM_BUSY @@ -369,6 +408,8 @@ oneway interface IRadioSimResponse { * @param iccIo IccIoResult corresponding to ICC IO response * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.subscription is not + * defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:SIM_BUSY @@ -385,6 +426,8 @@ oneway interface IRadioSimResponse { * @param info Response info struct containing response type, serial no. and error * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.subscription is not + * defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:INVALID_ARGUMENTS @@ -402,6 +445,8 @@ oneway interface IRadioSimResponse { * @param info Response info struct containing response type, serial no. and error * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.subscription is not + * defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:INVALID_ARGUMENTS @@ -412,6 +457,8 @@ oneway interface IRadioSimResponse { * @param info Response info struct containing response type, serial no. and error * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.subscription is not + * defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:SIM_ABSENT @@ -424,6 +471,7 @@ oneway interface IRadioSimResponse { * @param info Response info struct containing response type, serial no. and error * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.cdma is not defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:SIM_ABSENT @@ -440,6 +488,8 @@ oneway interface IRadioSimResponse { * @param retry 0 is the number of retries remaining, or -1 if unknown * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.subscription is not + * defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:SS_MODIFIED_TO_DIAL @@ -462,6 +512,8 @@ oneway interface IRadioSimResponse { * @param info Response info struct containing response type, serial no. and error * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.subscription is not + * defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:INVALID_ARGUMENTS @@ -473,6 +525,8 @@ oneway interface IRadioSimResponse { * @param info Response info struct containing response type, serial no. and error * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.subscription is not + * defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:SUBSCRIPTION_NOT_SUPPORTED @@ -491,6 +545,8 @@ oneway interface IRadioSimResponse { * @param remainingRetries Number of retries remaining, must be equal to -1 if unknown. * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.subscription is not + * defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE (radio resetting) * RadioError:PASSWORD_INCORRECT @@ -509,6 +565,8 @@ oneway interface IRadioSimResponse { * @param remainingRetries Number of retries remaining, must be equal to -1 if unknown. * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.subscription is not + * defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE (radio resetting) * RadioError:PASSWORD_INCORRECT @@ -526,6 +584,8 @@ oneway interface IRadioSimResponse { * @param remainingRetries Number of retries remaining, must be equal to -1 if unknown. * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.subscription is not + * defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE (radio resetting) * RadioError:PASSWORD_INCORRECT (PUK is invalid) @@ -543,6 +603,8 @@ oneway interface IRadioSimResponse { * @param remainingRetries Number of retries remaining, must be equal to -1 if unknown. * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.subscription is not + * defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE (radio resetting) * RadioError:PASSWORD_INCORRECT (PUK is invalid) @@ -562,6 +624,8 @@ oneway interface IRadioSimResponse { * to -1 if number of retries is infinite. * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.subscription is not + * defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:PASSWORD_INCORRECT (code is invalid) @@ -582,6 +646,8 @@ oneway interface IRadioSimResponse { * the minimum value is 1 * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.subscription is not + * defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:INVALID_ARGUMENTS @@ -598,6 +664,8 @@ oneway interface IRadioSimResponse { * @param info Response info struct containing response type, serial no. and error * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.subscription is not + * defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:INTERNAL_ERR diff --git a/radio/aidl/android/hardware/radio/sim/IccIo.aidl b/radio/aidl/android/hardware/radio/sim/IccIo.aidl index f173c8e6c78af5d62b076e852acc5bfdc81134aa..0877b7a4e0270b1bb5c647c59922ef18f04bc562 100644 --- a/radio/aidl/android/hardware/radio/sim/IccIo.aidl +++ b/radio/aidl/android/hardware/radio/sim/IccIo.aidl @@ -16,6 +16,7 @@ package android.hardware.radio.sim; +/** @hide */ @VintfStability @JavaDerive(toString=true) parcelable IccIo { diff --git a/radio/aidl/android/hardware/radio/sim/IccIoResult.aidl b/radio/aidl/android/hardware/radio/sim/IccIoResult.aidl index efcbbda039e5ba3e4ace74f8bc24030089d30f1d..ac89698ba92370d8e747f1449dff9c4ef2b8faa2 100644 --- a/radio/aidl/android/hardware/radio/sim/IccIoResult.aidl +++ b/radio/aidl/android/hardware/radio/sim/IccIoResult.aidl @@ -16,6 +16,7 @@ package android.hardware.radio.sim; +/** @hide */ @VintfStability @JavaDerive(toString=true) parcelable IccIoResult { diff --git a/radio/aidl/android/hardware/radio/sim/ImsiEncryptionInfo.aidl b/radio/aidl/android/hardware/radio/sim/ImsiEncryptionInfo.aidl index ba1dda5c59676fe1edc30ccee4b691161bd80284..b31b081ae5b609c8575023f8764cb498563ebb66 100644 --- a/radio/aidl/android/hardware/radio/sim/ImsiEncryptionInfo.aidl +++ b/radio/aidl/android/hardware/radio/sim/ImsiEncryptionInfo.aidl @@ -18,6 +18,7 @@ package android.hardware.radio.sim; /** * Carrier specific Information sent by the carrier, which will be used to encrypt IMSI and IMPI. + * @hide */ @VintfStability @JavaDerive(toString=true) diff --git a/radio/aidl/android/hardware/radio/sim/PbReceivedStatus.aidl b/radio/aidl/android/hardware/radio/sim/PbReceivedStatus.aidl index b1385a4d88e41c9f49955cc701184f3c2c0123f4..f9414a80e725836e883f9766ca45fbf8e64ecc76 100644 --- a/radio/aidl/android/hardware/radio/sim/PbReceivedStatus.aidl +++ b/radio/aidl/android/hardware/radio/sim/PbReceivedStatus.aidl @@ -18,6 +18,7 @@ package android.hardware.radio.sim; /** * Enum representing the status of the received PB indication. + * @hide */ @VintfStability @Backing(type="byte") diff --git a/radio/aidl/android/hardware/radio/sim/PersoSubstate.aidl b/radio/aidl/android/hardware/radio/sim/PersoSubstate.aidl index f85c84bb6457e89288dd949286dee91a4145366b..4da86c51ba8be844676b98780eb1016fb80def97 100644 --- a/radio/aidl/android/hardware/radio/sim/PersoSubstate.aidl +++ b/radio/aidl/android/hardware/radio/sim/PersoSubstate.aidl @@ -19,6 +19,7 @@ package android.hardware.radio.sim; /** * Additional personalization categories in addition to those specified in 3GPP TS 22.022 and * 3GPP2 C.S0068-0. + * @hide */ @VintfStability @Backing(type="int") diff --git a/radio/aidl/android/hardware/radio/sim/PhonebookCapacity.aidl b/radio/aidl/android/hardware/radio/sim/PhonebookCapacity.aidl index 97c3dba2ffb31a9c1f237817a5eb1a7d4141ef41..2212fda9663141f5f936e4b47b485a583c906802 100644 --- a/radio/aidl/android/hardware/radio/sim/PhonebookCapacity.aidl +++ b/radio/aidl/android/hardware/radio/sim/PhonebookCapacity.aidl @@ -16,6 +16,7 @@ package android.hardware.radio.sim; +/** @hide */ @VintfStability @JavaDerive(toString=true) parcelable PhonebookCapacity { diff --git a/radio/aidl/android/hardware/radio/sim/PhonebookRecordInfo.aidl b/radio/aidl/android/hardware/radio/sim/PhonebookRecordInfo.aidl index c4db0e6608fe4c3f76c12039d76d9646d2d30489..1653c318773339a7001d42dda544418650084fd3 100644 --- a/radio/aidl/android/hardware/radio/sim/PhonebookRecordInfo.aidl +++ b/radio/aidl/android/hardware/radio/sim/PhonebookRecordInfo.aidl @@ -19,6 +19,7 @@ package android.hardware.radio.sim; /** * Phonebook-record-information specified by EF_ADN (Abbreviated dialing numbers) record of SIM * as per 3GPP spec 31.102 v15 Section-4.4.2.3. + * @hide */ @VintfStability @JavaDerive(toString=true) diff --git a/radio/aidl/android/hardware/radio/sim/PinState.aidl b/radio/aidl/android/hardware/radio/sim/PinState.aidl index 85048bbb77c49026b51f0f341ceb7b295edca43a..f5f310805657f15d7821c72809f519793041e585 100644 --- a/radio/aidl/android/hardware/radio/sim/PinState.aidl +++ b/radio/aidl/android/hardware/radio/sim/PinState.aidl @@ -16,6 +16,7 @@ package android.hardware.radio.sim; +/** @hide */ @VintfStability @Backing(type="int") @JavaDerive(toString=true) diff --git a/radio/aidl/android/hardware/radio/sim/Plmn.aidl b/radio/aidl/android/hardware/radio/sim/Plmn.aidl new file mode 100644 index 0000000000000000000000000000000000000000..fd82692d45f973dac10010c2af1edc22b9196d50 --- /dev/null +++ b/radio/aidl/android/hardware/radio/sim/Plmn.aidl @@ -0,0 +1,31 @@ +/* + * Copyright (C) 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.hardware.radio.sim; + +/** @hide */ +@VintfStability +@JavaDerive(toString=true) +parcelable Plmn { + /** + * MCC (Mobile Country Code) of the PLMN + */ + String mcc; + /** + * MNC (Mobile Network Code) of the PLMN + */ + String mnc; +} \ No newline at end of file diff --git a/radio/aidl/android/hardware/radio/sim/SelectUiccSub.aidl b/radio/aidl/android/hardware/radio/sim/SelectUiccSub.aidl index 553404bdf4fa02e927588e558ab0759e3d38ae50..70a219191adbd8fc9a05c4366185e9f4528e1dc7 100644 --- a/radio/aidl/android/hardware/radio/sim/SelectUiccSub.aidl +++ b/radio/aidl/android/hardware/radio/sim/SelectUiccSub.aidl @@ -16,6 +16,7 @@ package android.hardware.radio.sim; +/** @hide */ @VintfStability @JavaDerive(toString=true) parcelable SelectUiccSub { diff --git a/radio/aidl/android/hardware/radio/sim/SessionInfo.aidl b/radio/aidl/android/hardware/radio/sim/SessionInfo.aidl index 9e3e8ed04da7297286e9c61a7cee02c5d289603e..585118a89cc4bce649fe5a3b0a9ba4abd2df8e17 100644 --- a/radio/aidl/android/hardware/radio/sim/SessionInfo.aidl +++ b/radio/aidl/android/hardware/radio/sim/SessionInfo.aidl @@ -16,6 +16,7 @@ package android.hardware.radio.sim; +/** @hide */ @VintfStability @JavaDerive(toString=true) parcelable SessionInfo { diff --git a/radio/aidl/android/hardware/radio/sim/SimApdu.aidl b/radio/aidl/android/hardware/radio/sim/SimApdu.aidl index 9799f2bc7a2a004d97b0187d1a3d3ea5e471398c..d0e3c39608c652ae48ace9737ea98087bddd61f7 100644 --- a/radio/aidl/android/hardware/radio/sim/SimApdu.aidl +++ b/radio/aidl/android/hardware/radio/sim/SimApdu.aidl @@ -16,6 +16,7 @@ package android.hardware.radio.sim; +/** @hide */ @VintfStability @JavaDerive(toString=true) parcelable SimApdu { diff --git a/radio/aidl/android/hardware/radio/sim/SimLockMultiSimPolicy.aidl b/radio/aidl/android/hardware/radio/sim/SimLockMultiSimPolicy.aidl index 6490d5118db9961f9dead2d50de656dc8c55b6ff..89d85a9a761d673cd6cbed3ec1ee428cc156196c 100644 --- a/radio/aidl/android/hardware/radio/sim/SimLockMultiSimPolicy.aidl +++ b/radio/aidl/android/hardware/radio/sim/SimLockMultiSimPolicy.aidl @@ -16,18 +16,61 @@ package android.hardware.radio.sim; +/** @hide */ @VintfStability @Backing(type="int") @JavaDerive(toString=true) enum SimLockMultiSimPolicy { + /** * Indicates that configuration applies to each slot independently. */ NO_MULTISIM_POLICY, + /** * Indicates that any SIM card can be used as far as one valid card is present in the device. * For the modem, a SIM card is valid when its content (i.e. MCC, MNC, GID, SPN) matches the * carrier restriction configuration. */ ONE_VALID_SIM_MUST_BE_PRESENT, + + /** + * Indicates that the SIM lock policy applies uniformly to all sim slots. + */ + APPLY_TO_ALL_SLOTS, + + /** + * The SIM lock configuration applies exclusively to sim slot 1, leaving + * all other sim slots unlocked irrespective of the SIM card in slot 1 + */ + APPLY_TO_ONLY_SLOT_1, + + /** + * Valid sim cards must be present on sim slot1 in order + * to use other sim slots. + */ + VALID_SIM_MUST_PRESENT_ON_SLOT_1, + + /** + * Valid sim card must be present on slot1 and it must be in full service + * in order to use other sim slots. + */ + ACTIVE_SERVICE_ON_SLOT_1_TO_UNBLOCK_OTHER_SLOTS, + + /** + * Valid sim card be present on any slot and it must be in full service + * in order to use other sim slots. + */ + ACTIVE_SERVICE_ON_ANY_SLOT_TO_UNBLOCK_OTHER_SLOTS, + + /** + * Valid sim cards must be present on all slots. If any SIM cards become + * invalid then device would set other SIM cards as invalid as well. + */ + ALL_SIMS_MUST_BE_VALID, + + /** + * In case there is no match policy listed above. + */ + SLOT_POLICY_OTHER } diff --git a/radio/aidl/android/hardware/radio/sim/SimRefreshResult.aidl b/radio/aidl/android/hardware/radio/sim/SimRefreshResult.aidl index 69aff668c208d84e461b55159de2b501f7ec949c..943f1d2bc75967f39148ae2bba8df4c797b08c83 100644 --- a/radio/aidl/android/hardware/radio/sim/SimRefreshResult.aidl +++ b/radio/aidl/android/hardware/radio/sim/SimRefreshResult.aidl @@ -16,6 +16,7 @@ package android.hardware.radio.sim; +/** @hide */ @VintfStability @JavaDerive(toString=true) parcelable SimRefreshResult { diff --git a/radio/aidl/android/hardware/radio/voice/AudioQuality.aidl b/radio/aidl/android/hardware/radio/voice/AudioQuality.aidl index dc4717297a2ec419db51eb86f12a5063bb714fcd..334ae3da8ab058f556975a7c95418bbc121200a8 100644 --- a/radio/aidl/android/hardware/radio/voice/AudioQuality.aidl +++ b/radio/aidl/android/hardware/radio/voice/AudioQuality.aidl @@ -19,6 +19,7 @@ package android.hardware.radio.voice; /** * Audio codec which is used on GSM, UMTS, and CDMA. These values must be opaque to the Android * framework. Only for display. + * @hide */ @VintfStability @Backing(type="int") diff --git a/radio/aidl/android/hardware/radio/voice/Call.aidl b/radio/aidl/android/hardware/radio/voice/Call.aidl index b09d7a015df16f6e546701a9881f305e388873b5..ee0b025bb3986cb5b9bb564794e0328fcd812eb2 100644 --- a/radio/aidl/android/hardware/radio/voice/Call.aidl +++ b/radio/aidl/android/hardware/radio/voice/Call.aidl @@ -19,6 +19,7 @@ package android.hardware.radio.voice; import android.hardware.radio.voice.AudioQuality; import android.hardware.radio.voice.UusInfo; +/** @hide */ @VintfStability @JavaDerive(toString=true) parcelable Call { diff --git a/radio/aidl/android/hardware/radio/voice/CallForwardInfo.aidl b/radio/aidl/android/hardware/radio/voice/CallForwardInfo.aidl index c4143b9f9f496cfbed0f82aea92566461afe7ed3..9b4ecd9a8eb4f3771c7579db71540d1f4fbf5926 100644 --- a/radio/aidl/android/hardware/radio/voice/CallForwardInfo.aidl +++ b/radio/aidl/android/hardware/radio/voice/CallForwardInfo.aidl @@ -18,6 +18,7 @@ package android.hardware.radio.voice; /** * See also com.android.internal.telephony.gsm.CallForwardInfo + * @hide */ @VintfStability @JavaDerive(toString=true) diff --git a/radio/aidl/android/hardware/radio/voice/CdmaCallWaiting.aidl b/radio/aidl/android/hardware/radio/voice/CdmaCallWaiting.aidl index 4d447d7675f459a8f7f958e0cb5a940d2a24a552..d97b3193d344237cf75ad5ce606e5c04e8248187 100644 --- a/radio/aidl/android/hardware/radio/voice/CdmaCallWaiting.aidl +++ b/radio/aidl/android/hardware/radio/voice/CdmaCallWaiting.aidl @@ -18,6 +18,7 @@ package android.hardware.radio.voice; import android.hardware.radio.voice.CdmaSignalInfoRecord; +/** @hide */ @VintfStability @JavaDerive(toString=true) parcelable CdmaCallWaiting { diff --git a/radio/aidl/android/hardware/radio/voice/CdmaDisplayInfoRecord.aidl b/radio/aidl/android/hardware/radio/voice/CdmaDisplayInfoRecord.aidl index 522f7ae643087b01cfed61cdf25c154bd7d05fa4..7e5a68d72957b6d620b97a1c742bf3f602532e28 100644 --- a/radio/aidl/android/hardware/radio/voice/CdmaDisplayInfoRecord.aidl +++ b/radio/aidl/android/hardware/radio/voice/CdmaDisplayInfoRecord.aidl @@ -22,6 +22,7 @@ package android.hardware.radio.voice; * the form: display_tag, display_len, and display_len occurrences of the char field if the * display_tag is not 10000000 or 10000001. To save space, the records are stored consecutively in * a byte buffer. The display_tag, display_len and chari fields are all 1 byte. + * @hide */ @VintfStability @JavaDerive(toString=true) diff --git a/radio/aidl/android/hardware/radio/voice/CdmaInformationRecord.aidl b/radio/aidl/android/hardware/radio/voice/CdmaInformationRecord.aidl index 1a4f1b37e01a82131cb7ec28549fa2221be8c47c..f5c656b52643bb1f46754c1ed04daa62c6f38d4f 100644 --- a/radio/aidl/android/hardware/radio/voice/CdmaInformationRecord.aidl +++ b/radio/aidl/android/hardware/radio/voice/CdmaInformationRecord.aidl @@ -24,10 +24,11 @@ import android.hardware.radio.voice.CdmaSignalInfoRecord; import android.hardware.radio.voice.CdmaT53AudioControlInfoRecord; import android.hardware.radio.voice.CdmaT53ClirInfoRecord; -@VintfStability /** * Max length of CdmaInformationRecords[] is CDMA_MAX_NUMBER_OF_INFO_RECS + * @hide */ +@VintfStability @JavaDerive(toString=true) parcelable CdmaInformationRecord { const int CDMA_MAX_NUMBER_OF_INFO_RECS = 10; diff --git a/radio/aidl/android/hardware/radio/voice/CdmaLineControlInfoRecord.aidl b/radio/aidl/android/hardware/radio/voice/CdmaLineControlInfoRecord.aidl index 8bfc5f77dc29fae92ec98e0aa28f6a11cdab740f..15c22a08b24e1a3adcc20fb1948a59c925e50431 100644 --- a/radio/aidl/android/hardware/radio/voice/CdmaLineControlInfoRecord.aidl +++ b/radio/aidl/android/hardware/radio/voice/CdmaLineControlInfoRecord.aidl @@ -18,6 +18,7 @@ package android.hardware.radio.voice; /** * Line Control Information Record as defined in C.S0005 section 3.7.5.15 + * @hide */ @VintfStability @JavaDerive(toString=true) diff --git a/radio/aidl/android/hardware/radio/voice/CdmaNumberInfoRecord.aidl b/radio/aidl/android/hardware/radio/voice/CdmaNumberInfoRecord.aidl index 9084b257d593fa72598f6753c66718c1602823cc..b04e273711e08ad5b9d39c992b37c5c4202783cf 100644 --- a/radio/aidl/android/hardware/radio/voice/CdmaNumberInfoRecord.aidl +++ b/radio/aidl/android/hardware/radio/voice/CdmaNumberInfoRecord.aidl @@ -20,6 +20,7 @@ package android.hardware.radio.voice; * Called Party Number Info Rec as defined in C.S0005 section 3.7.5.2 * Calling Party Number Info Rec as defined in C.S0005 section 3.7.5.3 * Connected Number Info Rec as defined in C.S0005 section 3.7.5.4 + * @hide */ @VintfStability @JavaDerive(toString=true) diff --git a/radio/aidl/android/hardware/radio/voice/CdmaOtaProvisionStatus.aidl b/radio/aidl/android/hardware/radio/voice/CdmaOtaProvisionStatus.aidl index 81fb003b7eefe39666903c7039800688ac8d9593..b6444abab29e7034184b92a41da35dbbcde21168 100644 --- a/radio/aidl/android/hardware/radio/voice/CdmaOtaProvisionStatus.aidl +++ b/radio/aidl/android/hardware/radio/voice/CdmaOtaProvisionStatus.aidl @@ -16,6 +16,7 @@ package android.hardware.radio.voice; +/** @hide */ @VintfStability @Backing(type="int") @JavaDerive(toString=true) diff --git a/radio/aidl/android/hardware/radio/voice/CdmaRedirectingNumberInfoRecord.aidl b/radio/aidl/android/hardware/radio/voice/CdmaRedirectingNumberInfoRecord.aidl index 5c9e2f22d93baf7779fbddb25f74817cae3d9297..691712e32127866496efca41d991bd4f4afeab1b 100644 --- a/radio/aidl/android/hardware/radio/voice/CdmaRedirectingNumberInfoRecord.aidl +++ b/radio/aidl/android/hardware/radio/voice/CdmaRedirectingNumberInfoRecord.aidl @@ -18,6 +18,7 @@ package android.hardware.radio.voice; import android.hardware.radio.voice.CdmaNumberInfoRecord; +/** @hide */ @VintfStability @JavaDerive(toString=true) parcelable CdmaRedirectingNumberInfoRecord { diff --git a/radio/aidl/android/hardware/radio/voice/CdmaSignalInfoRecord.aidl b/radio/aidl/android/hardware/radio/voice/CdmaSignalInfoRecord.aidl index 3334475d4fd046a249c2106589240fbbea01ca6d..4302ba48a268d59efdbadd7214e949c003799ca8 100644 --- a/radio/aidl/android/hardware/radio/voice/CdmaSignalInfoRecord.aidl +++ b/radio/aidl/android/hardware/radio/voice/CdmaSignalInfoRecord.aidl @@ -18,6 +18,7 @@ package android.hardware.radio.voice; /** * CDMA Signal Information Record as defined in C.S0005 section 3.7.5.5 + * @hide */ @VintfStability @JavaDerive(toString=true) diff --git a/radio/aidl/android/hardware/radio/voice/CdmaT53AudioControlInfoRecord.aidl b/radio/aidl/android/hardware/radio/voice/CdmaT53AudioControlInfoRecord.aidl index 9795cf01ecfe613ae5b1473e53a8b9d75b29ec55..44ac2b4320e8fc92f71b94e12a9a9e93962c1bdf 100644 --- a/radio/aidl/android/hardware/radio/voice/CdmaT53AudioControlInfoRecord.aidl +++ b/radio/aidl/android/hardware/radio/voice/CdmaT53AudioControlInfoRecord.aidl @@ -18,6 +18,7 @@ package android.hardware.radio.voice; /** * T53 Audio Control Information Record + * @hide */ @VintfStability @JavaDerive(toString=true) diff --git a/radio/aidl/android/hardware/radio/voice/CdmaT53ClirInfoRecord.aidl b/radio/aidl/android/hardware/radio/voice/CdmaT53ClirInfoRecord.aidl index 5ccd251bd580d5b19ce3bf42d95a3a60b2dbbf2b..564d7614b4c81b1ae633e2eb5f568f60c9ae96eb 100644 --- a/radio/aidl/android/hardware/radio/voice/CdmaT53ClirInfoRecord.aidl +++ b/radio/aidl/android/hardware/radio/voice/CdmaT53ClirInfoRecord.aidl @@ -18,6 +18,7 @@ package android.hardware.radio.voice; /** * T53 CLIR Information Record + * @hide */ @VintfStability @JavaDerive(toString=true) diff --git a/radio/aidl/android/hardware/radio/voice/CfData.aidl b/radio/aidl/android/hardware/radio/voice/CfData.aidl index 8f4c22711a81ea9fafcb2113e23d7f4cc4d46181..84304f4a8c76261056f3eb70a96706aa4053f5a9 100644 --- a/radio/aidl/android/hardware/radio/voice/CfData.aidl +++ b/radio/aidl/android/hardware/radio/voice/CfData.aidl @@ -18,6 +18,7 @@ package android.hardware.radio.voice; import android.hardware.radio.voice.CallForwardInfo; +/** @hide */ @VintfStability @JavaDerive(toString=true) parcelable CfData { diff --git a/radio/aidl/android/hardware/radio/voice/ClipStatus.aidl b/radio/aidl/android/hardware/radio/voice/ClipStatus.aidl index 4021471734cc7fcbb422c12d17d7745d07dacd8d..0a2ea2cd5de4bac4bb510a41dacd1dd3bed2f442 100644 --- a/radio/aidl/android/hardware/radio/voice/ClipStatus.aidl +++ b/radio/aidl/android/hardware/radio/voice/ClipStatus.aidl @@ -16,6 +16,7 @@ package android.hardware.radio.voice; +/** @hide */ @VintfStability @Backing(type="int") @JavaDerive(toString=true) diff --git a/radio/aidl/android/hardware/radio/voice/Dial.aidl b/radio/aidl/android/hardware/radio/voice/Dial.aidl index ca028ad949e4147ba571a6c57e7740753de09797..a874181fac0392e3ef60b2d6cbe7304ebe79e232 100644 --- a/radio/aidl/android/hardware/radio/voice/Dial.aidl +++ b/radio/aidl/android/hardware/radio/voice/Dial.aidl @@ -18,6 +18,7 @@ package android.hardware.radio.voice; import android.hardware.radio.voice.UusInfo; +/** @hide */ @VintfStability @JavaDerive(toString=true) parcelable Dial { diff --git a/radio/aidl/android/hardware/radio/voice/EmergencyCallRouting.aidl b/radio/aidl/android/hardware/radio/voice/EmergencyCallRouting.aidl index d62334625662a3aaa5f826427f282212d58c63ff..9f8993d311b6c306dbc10320f7cfb830bf3de408 100644 --- a/radio/aidl/android/hardware/radio/voice/EmergencyCallRouting.aidl +++ b/radio/aidl/android/hardware/radio/voice/EmergencyCallRouting.aidl @@ -18,6 +18,7 @@ package android.hardware.radio.voice; /** * Indicates how the implementation should handle the emergency call if it is required by Android. + * @hide */ @VintfStability @Backing(type="int") diff --git a/radio/aidl/android/hardware/radio/voice/EmergencyNumber.aidl b/radio/aidl/android/hardware/radio/voice/EmergencyNumber.aidl index e380ce88747b6473b6e9addc3c6ccf94d165c0a4..30f29a92ea52e9cbe2701901c4a8b4ef951b0bf0 100644 --- a/radio/aidl/android/hardware/radio/voice/EmergencyNumber.aidl +++ b/radio/aidl/android/hardware/radio/voice/EmergencyNumber.aidl @@ -37,6 +37,7 @@ package android.hardware.radio.voice; * 3gpp 23.167, Section 6 - Functional description; * 3gpp 24.503, Section 5.1.6.8.1 - General; * RFC 5031 + * @hide */ @VintfStability @JavaDerive(toString=true) diff --git a/radio/aidl/android/hardware/radio/voice/EmergencyServiceCategory.aidl b/radio/aidl/android/hardware/radio/voice/EmergencyServiceCategory.aidl index a4ac7aa2f51694e4f5862aaac1c0ab6792ed735f..80f873acbdb36a4dc069795f9b1254ea888c8d82 100644 --- a/radio/aidl/android/hardware/radio/voice/EmergencyServiceCategory.aidl +++ b/radio/aidl/android/hardware/radio/voice/EmergencyServiceCategory.aidl @@ -31,6 +31,7 @@ package android.hardware.radio.voice; * services are associated with this emergency number. * * Reference: 3gpp 22.101, Section 10 - Emergency Calls + * @hide */ @VintfStability @Backing(type="int") diff --git a/radio/aidl/android/hardware/radio/voice/IRadioVoice.aidl b/radio/aidl/android/hardware/radio/voice/IRadioVoice.aidl index c05d2378af269e082cbf32342301047eb8131146..0c2b51d2aa48d8f85d712409691328ae395ff965 100644 --- a/radio/aidl/android/hardware/radio/voice/IRadioVoice.aidl +++ b/radio/aidl/android/hardware/radio/voice/IRadioVoice.aidl @@ -30,6 +30,7 @@ import android.hardware.radio.voice.TtyMode; * duration of a method call. If clients provide colliding serials (including passing the same * serial to different methods), multiple responses (one for each method call) must still be served. * setResponseFunctions must work with IRadioVoiceResponse and IRadioVoiceIndication. + * @hide */ @VintfStability oneway interface IRadioVoice { @@ -40,6 +41,8 @@ oneway interface IRadioVoice { * @param serial Serial number of request. * * Response function is IRadioVoiceResponse.acceptCallResponse() + * + * This is available when android.hardware.telephony.calling is defined. */ void acceptCall(in int serial); @@ -49,6 +52,8 @@ oneway interface IRadioVoice { * @param serial Serial number of request. * * Response function is IRadioVoiceResponse.cancelPendingUssdResponse() + * + * This is available when android.hardware.telephony.calling is defined. */ void cancelPendingUssd(in int serial); @@ -58,6 +63,8 @@ oneway interface IRadioVoice { * @param serial Serial number of request. * * Response function is IRadioVoiceResponse.conferenceResponse() + * + * This is available when android.hardware.telephony.calling is defined. */ void conference(in int serial); @@ -68,6 +75,8 @@ oneway interface IRadioVoice { * @param dialInfo Dial struct * * Response function is IRadioVoiceResponse.dialResponse() + * + * This is available when android.hardware.telephony.calling is defined. */ void dial(in int serial, in Dial dialInfo); @@ -124,6 +133,8 @@ oneway interface IRadioVoice { * @param isTesting Flag indicating if this request is for testing purpose. * * Response function is IRadioVoiceResponse.emergencyDialResponse() + * + * This is available when android.hardware.telephony.calling is defined. */ void emergencyDial(in int serial, in Dial dialInfo, in int categories, in String[] urns, in EmergencyCallRouting routing, in boolean hasKnownUserIntentEmergency, @@ -136,6 +147,8 @@ oneway interface IRadioVoice { * @param serial Serial number of request. * * Response function is IRadioVoiceResponse.exitEmergencyCallbackModeResponse() + * + * This is available when android.hardware.telephony.calling is defined. */ void exitEmergencyCallbackMode(in int serial); @@ -145,6 +158,8 @@ oneway interface IRadioVoice { * @param serial Serial number of request. * * Response function is IRadioVoiceResponse.explicitCallTransferResponse() + * + * This is available when android.hardware.telephony.calling is defined. */ void explicitCallTransfer(in int serial); @@ -155,6 +170,8 @@ oneway interface IRadioVoice { * @param callInfo CallForwardInfo * * Response function is IRadioVoiceResponse.getCallForwardStatusResponse() + * + * This is available when android.hardware.telephony.calling is defined. */ void getCallForwardStatus(in int serial, in CallForwardInfo callInfo); @@ -165,6 +182,8 @@ oneway interface IRadioVoice { * @param serviceClass Service class is the TS 27.007 service class to query * * Response function is IRadioVoiceResponse.getCallWaitingResponse() + * + * This is available when android.hardware.telephony.calling is defined. */ void getCallWaiting(in int serial, in int serviceClass); @@ -174,6 +193,8 @@ oneway interface IRadioVoice { * @param serial Serial number of request. * * Response function is IRadioVoiceResponse.getClipResponse() + * + * This is available when android.hardware.telephony.calling is defined. */ void getClip(in int serial); @@ -183,6 +204,8 @@ oneway interface IRadioVoice { * @param serial Serial number of request. * * Response function is IRadioVoiceResponse.getClirResponse() + * + * This is available when android.hardware.telephony.calling is defined. */ void getClir(in int serial); @@ -192,6 +215,8 @@ oneway interface IRadioVoice { * @param serial Serial number of request. * * Response function is IRadioVoiceResponse.getCurrentCallsResponse() + * + * This is available when android.hardware.telephony.calling is defined. */ void getCurrentCalls(in int serial); @@ -201,6 +226,8 @@ oneway interface IRadioVoice { * @param serial Serial number of request. * * Response function is IRadioVoiceResponse.getLastCallFailCauseResponse() + * + * This is available when android.hardware.telephony.calling is defined. */ void getLastCallFailCause(in int serial); @@ -210,6 +237,8 @@ oneway interface IRadioVoice { * @param serial Serial number of request. * * Response function is IRadioVoiceResponse.getMuteResponse() + * + * This is available when android.hardware.telephony.calling is defined. */ void getMute(in int serial); @@ -219,6 +248,8 @@ oneway interface IRadioVoice { * @param serial Serial number of request. * * Response function is IRadioVoiceResponse.getPreferredVoicePrivacyResponse() + * + * This is available when android.hardware.telephony.calling is defined. */ void getPreferredVoicePrivacy(in int serial); @@ -228,6 +259,8 @@ oneway interface IRadioVoice { * @param serial Serial number of request. * * Response function is IRadioVoiceResponse.getTtyModeResponse() + * + * This is available when android.hardware.telephony.calling is defined. */ void getTtyMode(in int serial); @@ -240,6 +273,8 @@ oneway interface IRadioVoice { * @param accept true = accept the call setup, false = reject the call setup * * Response function is IRadioVoiceResponse.handleStkCallSetupRequestFromSimResponse() + * + * This is available when android.hardware.telephony.calling is defined. */ void handleStkCallSetupRequestFromSim(in int serial, in boolean accept); @@ -251,6 +286,8 @@ oneway interface IRadioVoice { * @param gsmIndex Connection index (value of 'x' in CHLD above) * * Response function is IRadioVoiceResponse.hangupResponse() + * + * This is available when android.hardware.telephony.calling is defined. */ void hangup(in int serial, in int gsmIndex); @@ -261,6 +298,8 @@ oneway interface IRadioVoice { * @param serial Serial number of request. * * Response function is IRadioVoiceResponse.hangupForegroundResumeBackgroundResponse() + * + * This is available when android.hardware.telephony.calling is defined. */ void hangupForegroundResumeBackground(in int serial); @@ -271,6 +310,8 @@ oneway interface IRadioVoice { * @param serial Serial number of request. * * Response function is IRadioVoiceResponse.hangupWaitingOrBackgroundResponse() + * + * This is available when android.hardware.telephony.calling is defined. */ void hangupWaitingOrBackground(in int serial); @@ -280,6 +321,8 @@ oneway interface IRadioVoice { * @param serial Serial number of request. * * Response function is IRadioVoiceResponse.isVoNrEnabledResponse() + * + * This is available when android.hardware.telephony.ims is defined. */ void isVoNrEnabled(in int serial); @@ -289,6 +332,8 @@ oneway interface IRadioVoice { * @param serial Serial number of request. * * Response function is IRadioVoiceResponse.rejectCallResponse() + * + * This is available when android.hardware.telephony.calling is defined. */ void rejectCall(in int serial); @@ -296,6 +341,8 @@ oneway interface IRadioVoice { * When response type received from a radio indication or radio response is * RadioIndicationType:UNSOLICITED_ACK_EXP or RadioResponseType:SOLICITED_ACK_EXP respectively, * acknowledge the receipt of those messages by sending responseAcknowledgement(). + * + * This is available when android.hardware.telephony.calling is defined. */ void responseAcknowledgement(); @@ -308,6 +355,8 @@ oneway interface IRadioVoice { * @param off is the DTMF OFF length in milliseconds, or 0 to use default * * Response function is IRadioVoiceResponse.sendBurstDtmfResponse() + * + * This is available when android.hardware.telephony.calling is defined. */ void sendBurstDtmf(in int serial, in String dtmf, in int on, in int off); @@ -318,6 +367,8 @@ oneway interface IRadioVoice { * @param featureCode String associated with Flash command * * Response function is IRadioVoiceResponse.sendCdmaFeatureCodeResponse() + * + * This is available when android.hardware.telephony.cdma is defined. */ void sendCdmaFeatureCode(in int serial, in String featureCode); @@ -329,6 +380,8 @@ oneway interface IRadioVoice { * @param s string with single char having one of 12 values: 0-9, *, # * * Response function is IRadioVoiceResponse.sendDtmfResponse() + * + * This is available when android.hardware.telephony.calling is defined. */ void sendDtmf(in int serial, in String s); @@ -346,6 +399,8 @@ oneway interface IRadioVoice { * @param ussd string containing the USSD request in UTF-8 format * * Response function is IRadioVoiceResponse.sendUssdResponse() + * + * This is available when android.hardware.telephony.calling is defined. */ void sendUssd(in int serial, in String ussd); @@ -362,6 +417,8 @@ oneway interface IRadioVoice { * @param gsmIndex contains Connection index (value of 'x' in CHLD above) * * Response function is IRadioVoiceResponse.separateConnectionResponse() + * + * This is available when android.hardware.telephony.calling is defined. */ void separateConnection(in int serial, in int gsmIndex); @@ -372,6 +429,8 @@ oneway interface IRadioVoice { * @param callInfo CallForwardInfo * * Response function is IRadioVoiceResponse.setCallForwardResponse() + * + * This is available when android.hardware.telephony.calling is defined. */ void setCallForward(in int serial, in CallForwardInfo callInfo); @@ -383,6 +442,8 @@ oneway interface IRadioVoice { * @param serviceClass is the TS 27.007 service class bit vector of services to modify * * Response function is IRadioVoiceResponse.setCallWaitingResponse() + * + * This is available when android.hardware.telephony.calling is defined. */ void setCallWaiting(in int serial, in boolean enable, in int serviceClass); @@ -393,6 +454,8 @@ oneway interface IRadioVoice { * @param status "n" parameter from TS 27.007 7.7 * * Response function is IRadioVoiceResponse.setClirResponse() + * + * This is available when android.hardware.telephony.calling is defined. */ void setClir(in int serial, in int status); @@ -404,6 +467,8 @@ oneway interface IRadioVoice { * @param enable true for "enable mute" and false for "disable mute" * * Response function is IRadioVoiceResponse.setMuteResponse() + * + * This is available when android.hardware.telephony.calling is defined. */ void setMute(in int serial, in boolean enable); @@ -415,6 +480,8 @@ oneway interface IRadioVoice { * true for Enhanced Privacy Mode (Private Long Code Mask) * * Response function is IRadioVoiceResponse.setPreferredVoicePrivacyResponse() + * + * This is available when android.hardware.telephony.calling is defined. */ void setPreferredVoicePrivacy(in int serial, in boolean enable); @@ -423,6 +490,8 @@ oneway interface IRadioVoice { * * @param radioVoiceResponse Object containing response functions * @param radioVoiceIndication Object containing radio indications + * + * This is available when android.hardware.telephony.calling is defined. */ void setResponseFunctions(in IRadioVoiceResponse radioVoiceResponse, in IRadioVoiceIndication radioVoiceIndication); @@ -434,6 +503,8 @@ oneway interface IRadioVoice { * @param mode TtyMode * * Response function is IRadioVoiceResponse.setTtyModeResponse() + * + * This is available when android.hardware.telephony.calling is defined. */ void setTtyMode(in int serial, in TtyMode mode); @@ -444,6 +515,8 @@ oneway interface IRadioVoice { * @param enable true for "enable vonr" and false for "disable vonr" * * Response function is IRadioVoiceResponse.setVoNrEnabledResponse() + * + * This is available when android.hardware.telephony.ims is defined. */ void setVoNrEnabled(in int serial, in boolean enable); @@ -456,6 +529,8 @@ oneway interface IRadioVoice { * @param s string having a single character with one of 12 values: 0-9,*,# * * Response function is IRadioVoiceResponse.startDtmfResponse() + * + * This is available when android.hardware.telephony.calling is defined. */ void startDtmf(in int serial, in String s); @@ -465,6 +540,8 @@ oneway interface IRadioVoice { * @param serial Serial number of request. * * Response function is IRadioVoiceResponse.stopDtmfResponse() + * + * This is available when android.hardware.telephony.calling is defined. */ void stopDtmf(in int serial); @@ -482,6 +559,8 @@ oneway interface IRadioVoice { * @param serial Serial number of request. * * Response function is IRadioVoiceResponse.switchWaitingOrHoldingAndActiveResponse() + * + * This is available when android.hardware.telephony.calling is defined. */ void switchWaitingOrHoldingAndActive(in int serial); } diff --git a/radio/aidl/android/hardware/radio/voice/IRadioVoiceIndication.aidl b/radio/aidl/android/hardware/radio/voice/IRadioVoiceIndication.aidl index 437fef6c599fa1db3cd35ecbfb1b45ccc3a47e49..9de6364546270961f570292940ea28f64daa6d74 100644 --- a/radio/aidl/android/hardware/radio/voice/IRadioVoiceIndication.aidl +++ b/radio/aidl/android/hardware/radio/voice/IRadioVoiceIndication.aidl @@ -28,6 +28,7 @@ import android.hardware.radio.voice.UssdModeType; /** * Interface declaring unsolicited radio indications for voice APIs. + * @hide */ @VintfStability oneway interface IRadioVoiceIndication { diff --git a/radio/aidl/android/hardware/radio/voice/IRadioVoiceResponse.aidl b/radio/aidl/android/hardware/radio/voice/IRadioVoiceResponse.aidl index 39e3aced92230a6f6fa0608f4f08775d4eb3a816..a904eaab439aaba25de122e29c91effe6495f9ae 100644 --- a/radio/aidl/android/hardware/radio/voice/IRadioVoiceResponse.aidl +++ b/radio/aidl/android/hardware/radio/voice/IRadioVoiceResponse.aidl @@ -25,6 +25,7 @@ import android.hardware.radio.voice.TtyMode; /** * Interface declaring response functions to solicited radio requests for voice APIs. + * @hide */ @VintfStability oneway interface IRadioVoiceResponse { @@ -32,6 +33,7 @@ oneway interface IRadioVoiceResponse { * @param info Response info struct containing response type, serial no. and error * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.calling is not defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:INVALID_STATE @@ -60,6 +62,7 @@ oneway interface IRadioVoiceResponse { * @param info Response info struct containing response type, serial no. and error * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.calling is not defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:SIM_BUSY @@ -80,6 +83,7 @@ oneway interface IRadioVoiceResponse { * @param info Response info struct containing response type, serial no. and error * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.calling is not defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE (radio resetting) * RadioError:NO_MEMORY @@ -100,6 +104,7 @@ oneway interface IRadioVoiceResponse { * @param info Response info struct containing response type, serial no. and error * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.calling is not defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE (radio resetting) * RadioError:DIAL_MODIFIED_TO_USSD @@ -128,6 +133,7 @@ oneway interface IRadioVoiceResponse { * @param info Response info struct containing response type, serial no. and error * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.calling is not defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE (radio resetting) * RadioError:DIAL_MODIFIED_TO_USSD @@ -151,6 +157,7 @@ oneway interface IRadioVoiceResponse { * @param info Response info struct containing response type, serial no. and error * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.calling is not defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:OPERATION_NO_ALLOWED @@ -169,6 +176,7 @@ oneway interface IRadioVoiceResponse { * @param info Response info struct containing response type, serial no. and error * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.calling is not defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:INVALID_ARGUMENTS @@ -195,6 +203,7 @@ oneway interface IRadioVoiceResponse { * CallForwardInfo must be returned with the service class set to "data + voice = 3". * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.calling is not defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:SS_MODIFIED_TO_DIAL @@ -222,6 +231,7 @@ oneway interface IRadioVoiceResponse { * for data and voice and disabled for everything else. * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.calling is not defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:SS_MODIFIED_TO_DIAL @@ -244,6 +254,7 @@ oneway interface IRadioVoiceResponse { * @param status indicates CLIP status * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.calling is not defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:INVALID_ARGUMENTS @@ -263,6 +274,7 @@ oneway interface IRadioVoiceResponse { * @param m is "m" parameter from TS 27.007 7.7 * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.calling is not defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:SS_MODIFIED_TO_DIAL @@ -284,6 +296,7 @@ oneway interface IRadioVoiceResponse { * @param calls Current call list * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.calling is not defined * RadioError:NO_MEMORY * RadioError:INTERNAL_ERR * RadioError:SYSTEM_ERR @@ -326,6 +339,7 @@ oneway interface IRadioVoiceResponse { * for tone generation or error notification. * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.calling is not defined * RadioError:NONE * RadioError:NO_MEMORY * RadioError:RADIO_NOT_AVAILABLE @@ -345,6 +359,7 @@ oneway interface IRadioVoiceResponse { * @param enable true for "mute enabled" and false for "mute disabled" * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.calling is not defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:SS_MODIFIED_TO_DIAL @@ -366,6 +381,7 @@ oneway interface IRadioVoiceResponse { * true for Enhanced Privacy Mode (Private Long Code Mask) * * Valid errors: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.calling is not defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:INVALID_ARGUMENTS @@ -383,6 +399,7 @@ oneway interface IRadioVoiceResponse { * @param mode TtyMode * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.calling is not defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:INVALID_ARGUMENTS @@ -399,6 +416,7 @@ oneway interface IRadioVoiceResponse { * @param info Response info struct containing response type, serial no. and error * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.calling is not defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:NO_MEMORY @@ -416,6 +434,7 @@ oneway interface IRadioVoiceResponse { * @param info Response info struct containing response type, serial no. and error * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.calling is not defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE (radio resetting) * RadioError:INVALID_ARGUMENTS @@ -433,6 +452,7 @@ oneway interface IRadioVoiceResponse { * @param info Response info struct containing response type, serial no. and error * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.calling is not defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE (radio resetting) * RadioError:INVALID_STATE @@ -453,6 +473,7 @@ oneway interface IRadioVoiceResponse { * @param info Response info struct containing response type, serial no. and error * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.calling is not defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE (radio resetting) * RadioError:INVALID_STATE @@ -473,6 +494,7 @@ oneway interface IRadioVoiceResponse { * @param enable true for "vonr enabled" and false for "vonr disabled" * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.ims is not defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:MODEM_ERR @@ -485,6 +507,7 @@ oneway interface IRadioVoiceResponse { * @param info Response info struct containing response type, serial no. and error * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.calling is not defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE (radio resetting) * RadioError:INVALID_STATE @@ -506,6 +529,7 @@ oneway interface IRadioVoiceResponse { * @param info Response info struct containing response type, serial no. and error * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.calling is not defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:INVALID_ARGUMENTS @@ -526,6 +550,7 @@ oneway interface IRadioVoiceResponse { * @param info Response info struct containing response type, serial no. and error * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.cdma is not defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:INVALID_ARGUMENTS @@ -546,6 +571,7 @@ oneway interface IRadioVoiceResponse { * @param info Response info struct containing response type, serial no. and error * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.calling is not defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:INVALID_ARGUMENTS @@ -564,6 +590,7 @@ oneway interface IRadioVoiceResponse { * @param info Response info struct containing response type, serial no. and error * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.calling is not defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:FDN_CHECK_FAILURE @@ -589,6 +616,7 @@ oneway interface IRadioVoiceResponse { * @param info Response info struct containing response type, serial no. and error * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.calling is not defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:INVALID_ARGUMENTS @@ -609,6 +637,7 @@ oneway interface IRadioVoiceResponse { * @param info Response info struct containing response type, serial no. and error * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.calling is not defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:SS_MODIFIED_TO_DIAL @@ -631,6 +660,7 @@ oneway interface IRadioVoiceResponse { * @param info Response info struct containing response type, serial no. and error * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.calling is not defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:SS_MODIFIED_TO_DIAL @@ -653,6 +683,7 @@ oneway interface IRadioVoiceResponse { * @param info Response info struct containing response type, serial no. and error * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.calling is not defined * RadioError:NONE * RadioError:INVALID_ARGUMENTS * RadioError:RADIO_NOT_AVAILABLE @@ -671,6 +702,7 @@ oneway interface IRadioVoiceResponse { * @param info Response info struct containing response type, serial no. and error * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.calling is not defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:INVALID_ARGUMENTS @@ -687,6 +719,7 @@ oneway interface IRadioVoiceResponse { * @param info Response info struct containing response type, serial no. and error * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.calling is not defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:INVALID_ARGUMENTS @@ -704,6 +737,7 @@ oneway interface IRadioVoiceResponse { * @param info Response info struct containing response type, serial no. and error * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.calling is not defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:INVALID_ARGUMENTS @@ -720,6 +754,7 @@ oneway interface IRadioVoiceResponse { * @param info Response info struct containing response type, serial no. and error * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.calling is not defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:INVALID_ARGUMENTS @@ -733,6 +768,7 @@ oneway interface IRadioVoiceResponse { * @param info Response info struct containing response type, serial no. and error * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.calling is not defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:INVALID_ARGUMENTS @@ -752,6 +788,7 @@ oneway interface IRadioVoiceResponse { * @param info Response info struct containing response type, serial no. and error * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.calling is not defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:INVALID_ARGUMENTS @@ -771,6 +808,7 @@ oneway interface IRadioVoiceResponse { * @param info Response info struct containing response type, serial no. and error * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.calling is not defined * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE (radio resetting) * RadioError:INVALID_STATE diff --git a/radio/aidl/android/hardware/radio/voice/LastCallFailCause.aidl b/radio/aidl/android/hardware/radio/voice/LastCallFailCause.aidl index 5c8c81929c7c9017d3b730ce15fd857fcd63c040..9a381976d5ebd7a65d621571aff36e0567f75825 100644 --- a/radio/aidl/android/hardware/radio/voice/LastCallFailCause.aidl +++ b/radio/aidl/android/hardware/radio/voice/LastCallFailCause.aidl @@ -16,6 +16,7 @@ package android.hardware.radio.voice; +/** @hide */ @VintfStability @Backing(type="int") @JavaDerive(toString=true) diff --git a/radio/aidl/android/hardware/radio/voice/LastCallFailCauseInfo.aidl b/radio/aidl/android/hardware/radio/voice/LastCallFailCauseInfo.aidl index 078722af605ef9e1314924f9dba82ec8743442c3..4ed17d2ae93de6296bfa1df730cf1ec688246162 100644 --- a/radio/aidl/android/hardware/radio/voice/LastCallFailCauseInfo.aidl +++ b/radio/aidl/android/hardware/radio/voice/LastCallFailCauseInfo.aidl @@ -18,6 +18,7 @@ package android.hardware.radio.voice; import android.hardware.radio.voice.LastCallFailCause; +/** @hide */ @VintfStability @JavaDerive(toString=true) parcelable LastCallFailCauseInfo { diff --git a/radio/aidl/android/hardware/radio/voice/SrvccState.aidl b/radio/aidl/android/hardware/radio/voice/SrvccState.aidl index 08eb877ef7a2f99034fbb1383642e08fe71a9492..923518dc15124313713920a36eeec949ef6b0b9f 100644 --- a/radio/aidl/android/hardware/radio/voice/SrvccState.aidl +++ b/radio/aidl/android/hardware/radio/voice/SrvccState.aidl @@ -16,6 +16,7 @@ package android.hardware.radio.voice; +/** @hide */ @VintfStability @Backing(type="int") @JavaDerive(toString=true) diff --git a/radio/aidl/android/hardware/radio/voice/SsInfoData.aidl b/radio/aidl/android/hardware/radio/voice/SsInfoData.aidl index b944bf4f843a57e441afaccd29aea539ed87000e..c965a7dd6d65964db8f424f28c4efc215c43e505 100644 --- a/radio/aidl/android/hardware/radio/voice/SsInfoData.aidl +++ b/radio/aidl/android/hardware/radio/voice/SsInfoData.aidl @@ -16,6 +16,7 @@ package android.hardware.radio.voice; +/** @hide */ @VintfStability @JavaDerive(toString=true) parcelable SsInfoData { diff --git a/radio/aidl/android/hardware/radio/voice/StkCcUnsolSsResult.aidl b/radio/aidl/android/hardware/radio/voice/StkCcUnsolSsResult.aidl index 798227575ec89f0779f15c437cdafc795f0cd86a..9fe402427ca6668887cf2c2d2fb3d326768eea65 100644 --- a/radio/aidl/android/hardware/radio/voice/StkCcUnsolSsResult.aidl +++ b/radio/aidl/android/hardware/radio/voice/StkCcUnsolSsResult.aidl @@ -20,6 +20,7 @@ import android.hardware.radio.RadioError; import android.hardware.radio.voice.CfData; import android.hardware.radio.voice.SsInfoData; +/** @hide */ @VintfStability @JavaDerive(toString=true) parcelable StkCcUnsolSsResult { diff --git a/radio/aidl/android/hardware/radio/voice/TtyMode.aidl b/radio/aidl/android/hardware/radio/voice/TtyMode.aidl index e8dd7236aac57875d764c7b3f4b656d2dbb8bc99..b9203e1e5f9b48754cb5db115fb51fdc713b3ba9 100644 --- a/radio/aidl/android/hardware/radio/voice/TtyMode.aidl +++ b/radio/aidl/android/hardware/radio/voice/TtyMode.aidl @@ -16,6 +16,7 @@ package android.hardware.radio.voice; +/** @hide */ @VintfStability @Backing(type="int") @JavaDerive(toString=true) diff --git a/radio/aidl/android/hardware/radio/voice/UssdModeType.aidl b/radio/aidl/android/hardware/radio/voice/UssdModeType.aidl index cece4bd3edcd45f761360f2ee58caec2062f58c6..d43462efd90c2e3e5d892009c92b43c27d192601 100644 --- a/radio/aidl/android/hardware/radio/voice/UssdModeType.aidl +++ b/radio/aidl/android/hardware/radio/voice/UssdModeType.aidl @@ -16,6 +16,7 @@ package android.hardware.radio.voice; +/** @hide */ @VintfStability @Backing(type="int") @JavaDerive(toString=true) diff --git a/radio/aidl/android/hardware/radio/voice/UusInfo.aidl b/radio/aidl/android/hardware/radio/voice/UusInfo.aidl index 220a8fc7e6e2337db9a4da9ef0f9c8e6ad36ccdb..5d499ca2d6d7b85561d348dff646586f30edf9c1 100644 --- a/radio/aidl/android/hardware/radio/voice/UusInfo.aidl +++ b/radio/aidl/android/hardware/radio/voice/UusInfo.aidl @@ -18,6 +18,7 @@ package android.hardware.radio.voice; /** * User-to-User Signaling Information defined in 3GPP 23.087 v8.0 + * @hide */ @VintfStability @JavaDerive(toString=true) diff --git a/radio/aidl/compat/libradiocompat/Android.bp b/radio/aidl/compat/libradiocompat/Android.bp index 5cf1378821af6b9375d032e26ed797c2c44a3a7c..66970dbf98e459f861f4106153c2a1eaacc2a35a 100644 --- a/radio/aidl/compat/libradiocompat/Android.bp +++ b/radio/aidl/compat/libradiocompat/Android.bp @@ -31,20 +31,20 @@ cc_library { "-DANDROID_UTILS_REF_BASE_DISABLE_IMPLICIT_CONSTRUCTION", ], shared_libs: [ - "android.hardware.radio.config-V2-ndk", + "android.hardware.radio.config-V3-ndk", "android.hardware.radio.config@1.0", "android.hardware.radio.config@1.1", "android.hardware.radio.config@1.2", "android.hardware.radio.config@1.3", - "android.hardware.radio.data-V2-ndk", - "android.hardware.radio.ims-V1-ndk", - "android.hardware.radio.ims.media-V1-ndk", - "android.hardware.radio.messaging-V2-ndk", - "android.hardware.radio.modem-V2-ndk", - "android.hardware.radio.network-V2-ndk", + "android.hardware.radio.data-V3-ndk", + "android.hardware.radio.ims-V2-ndk", + "android.hardware.radio.ims.media-V2-ndk", + "android.hardware.radio.messaging-V3-ndk", + "android.hardware.radio.modem-V3-ndk", + "android.hardware.radio.network-V3-ndk", "android.hardware.radio.sap-V1-ndk", - "android.hardware.radio.sim-V2-ndk", - "android.hardware.radio.voice-V2-ndk", + "android.hardware.radio.sim-V3-ndk", + "android.hardware.radio.voice-V3-ndk", "android.hardware.radio@1.0", "android.hardware.radio@1.1", "android.hardware.radio@1.2", diff --git a/radio/aidl/compat/libradiocompat/ims/media/RadioImsMediaSession.cpp b/radio/aidl/compat/libradiocompat/ims/media/RadioImsMediaSession.cpp index ae86914e2748f9a94ce5773fe2b978a01037fa8e..d5093007cecea0eddde8c3f5442916d3c1136e3c 100644 --- a/radio/aidl/compat/libradiocompat/ims/media/RadioImsMediaSession.cpp +++ b/radio/aidl/compat/libradiocompat/ims/media/RadioImsMediaSession.cpp @@ -60,5 +60,12 @@ ScopedAStatus RadioImsMediaSession::setMediaQualityThreshold( LOG(ERROR) << " setMediaQualityThreshold is unsupported by HIDL HALs"; return ok(); } - +ScopedAStatus RadioImsMediaSession::requestRtpReceptionStats(int32_t /*in_intervalMs*/) { + LOG(ERROR) << " requestRtpReceptionStats is unsupported by HIDL HALs"; + return ok(); +} +ScopedAStatus RadioImsMediaSession::adjustDelay(int32_t /*in_delayMs*/) { + LOG(ERROR) << " adjustDelay is unsupported by HIDL HALs"; + return ok(); +} } // namespace android::hardware::radio::compat diff --git a/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioImsMediaSession.h b/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioImsMediaSession.h index 00f21fc0770c094d4880602c5d66c120f3f9b4ef..715fc772b24097f0167a6f5bf1321bc37cec4308 100644 --- a/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioImsMediaSession.h +++ b/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioImsMediaSession.h @@ -38,6 +38,8 @@ class RadioImsMediaSession : public RadioCompatBase, ::ndk::ScopedAStatus setMediaQualityThreshold( const ::aidl::android::hardware::radio::ims::media::MediaQualityThreshold& in_threshold) override; + ::ndk::ScopedAStatus requestRtpReceptionStats(int32_t in_intervalMs) override; + ::ndk::ScopedAStatus adjustDelay(int32_t in_delayMs) override; protected: public: diff --git a/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioIndication.h b/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioIndication.h index f0424564091c8b5dc3f9f40a6e3af7b82a29d5ee..e6f2516cf4d769c95ee66cbc0bebd64bb5997ebe 100644 --- a/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioIndication.h +++ b/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioIndication.h @@ -26,6 +26,7 @@ #include #include #include +#include namespace android::hardware::radio::compat { @@ -208,7 +209,8 @@ class RadioIndication : public V1_6::IRadioIndication { Return simPhonebookRecordsReceived( V1_0::RadioIndicationType type, V1_6::PbReceivedStatus status, const hidl_vec& records) override; - + Return onImeiMappingChanged(V1_0::RadioIndicationType type, + ::aidl::android::hardware::radio::modem::ImeiInfo config); public: RadioIndication(std::shared_ptr context); diff --git a/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioNetwork.h b/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioNetwork.h index d57c83de190aef7dfebcbc96a49cd864d46d9c1f..56724ae7335c6ecd771476a17bd26e0221f693e6 100644 --- a/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioNetwork.h +++ b/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioNetwork.h @@ -107,6 +107,12 @@ class RadioNetwork : public RadioCompatBase, ::ndk::ScopedAStatus setNullCipherAndIntegrityEnabled(int32_t serial, bool enabled) override; ::ndk::ScopedAStatus isNullCipherAndIntegrityEnabled(int32_t serial) override; + ::ndk::ScopedAStatus isCellularIdentifierTransparencyEnabled(int32_t serial) override; + ::ndk::ScopedAStatus setCellularIdentifierTransparencyEnabled(int32_t serial, + bool enabled) override; + + ::ndk::ScopedAStatus setSecurityAlgorithmsUpdatedEnabled(int32_t serial, bool enabled) override; + ::ndk::ScopedAStatus isSecurityAlgorithmsUpdatedEnabled(int32_t serial) override; protected: std::shared_ptr<::aidl::android::hardware::radio::network::IRadioNetworkResponse> respond(); diff --git a/radio/aidl/compat/libradiocompat/modem/RadioIndication-modem.cpp b/radio/aidl/compat/libradiocompat/modem/RadioIndication-modem.cpp index 851c93b921d7d4d468b125bd0ca6c92bf9f9d0d5..990ccffc67bc12656700963a0b7f7a64f5a621ae 100644 --- a/radio/aidl/compat/libradiocompat/modem/RadioIndication-modem.cpp +++ b/radio/aidl/compat/libradiocompat/modem/RadioIndication-modem.cpp @@ -68,4 +68,11 @@ Return RadioIndication::rilConnected(V1_0::RadioIndicationType type) { return {}; } +Return RadioIndication::onImeiMappingChanged(V1_0::RadioIndicationType type, + ::aidl::android::hardware::radio::modem::ImeiInfo imeiInfo) { + LOG_CALL << type; + modemCb()->onImeiMappingChanged(toAidl(type), imeiInfo); + return {}; +} + } // namespace android::hardware::radio::compat diff --git a/radio/aidl/compat/libradiocompat/network/RadioNetwork.cpp b/radio/aidl/compat/libradiocompat/network/RadioNetwork.cpp index a379eec10b3686bef5a6447e8930298ce2b3e182..1e4378961635e633826eb008853f23a8b90db069 100644 --- a/radio/aidl/compat/libradiocompat/network/RadioNetwork.cpp +++ b/radio/aidl/compat/libradiocompat/network/RadioNetwork.cpp @@ -372,4 +372,34 @@ ScopedAStatus RadioNetwork::setN1ModeEnabled(int32_t serial, bool /*enable*/) { respond()->setN1ModeEnabledResponse(notSupported(serial)); return ok(); } + +ScopedAStatus RadioNetwork::isCellularIdentifierTransparencyEnabled(int32_t serial) { + LOG_CALL << serial; + LOG(ERROR) << " isCellularIdentifierTransparencyEnabled is unsupported by HIDL HALs"; + respond()->isCellularIdentifierTransparencyEnabledResponse(notSupported(serial), false); + return ok(); +} + +ScopedAStatus RadioNetwork::setCellularIdentifierTransparencyEnabled(int32_t serial, + bool /*enabled*/) { + LOG_CALL << serial; + LOG(ERROR) << " setCellularIdentifierTransparencyEnabled is unsupported by HIDL HALs"; + respond()->setCellularIdentifierTransparencyEnabledResponse(notSupported(serial)); + return ok(); +} + +ScopedAStatus RadioNetwork::isSecurityAlgorithmsUpdatedEnabled(int32_t serial) { + LOG_CALL << serial; + LOG(ERROR) << " isSecurityAlgorithmsUpdatedEnabled is unsupported by HIDL HALs"; + respond()->isSecurityAlgorithmsUpdatedEnabledResponse(notSupported(serial), false); + return ok(); +} + +ScopedAStatus RadioNetwork::setSecurityAlgorithmsUpdatedEnabled(int32_t serial, bool /*enable*/) { + LOG_CALL << serial; + LOG(ERROR) << " setSecurityAlgorithmsUpdatedEnabled is unsupported by HIDL HALs"; + respond()->setSecurityAlgorithmsUpdatedEnabledResponse(notSupported(serial)); + return ok(); +} + } // namespace android::hardware::radio::compat diff --git a/radio/aidl/compat/service/Android.bp b/radio/aidl/compat/service/Android.bp index dff018285ac98b9e3aef1dfc30b8d01680b7114c..62c99febabdaa2283b15f855d5d56a3aba16dfd6 100644 --- a/radio/aidl/compat/service/Android.bp +++ b/radio/aidl/compat/service/Android.bp @@ -34,20 +34,20 @@ cc_binary { ], shared_libs: [ "android.hardware.radio-library.compat", - "android.hardware.radio.config-V2-ndk", + "android.hardware.radio.config-V3-ndk", "android.hardware.radio.config@1.0", "android.hardware.radio.config@1.1", "android.hardware.radio.config@1.2", "android.hardware.radio.config@1.3", - "android.hardware.radio.data-V2-ndk", - "android.hardware.radio.ims-V1-ndk", - "android.hardware.radio.ims.media-V1-ndk", - "android.hardware.radio.messaging-V2-ndk", - "android.hardware.radio.modem-V2-ndk", - "android.hardware.radio.network-V2-ndk", + "android.hardware.radio.data-V3-ndk", + "android.hardware.radio.ims-V2-ndk", + "android.hardware.radio.ims.media-V2-ndk", + "android.hardware.radio.messaging-V3-ndk", + "android.hardware.radio.modem-V3-ndk", + "android.hardware.radio.network-V3-ndk", "android.hardware.radio.sap-V1-ndk", - "android.hardware.radio.sim-V2-ndk", - "android.hardware.radio.voice-V2-ndk", + "android.hardware.radio.sim-V3-ndk", + "android.hardware.radio.voice-V3-ndk", "android.hardware.radio@1.0", "android.hardware.radio@1.1", "android.hardware.radio@1.2", diff --git a/radio/aidl/vts/Android.bp b/radio/aidl/vts/Android.bp index e79d3c027793264f2202755adab09fa8ecfe4270..d98568637090c0a6c9827aee3233a1192ac2b0e2 100644 --- a/radio/aidl/vts/Android.bp +++ b/radio/aidl/vts/Android.bp @@ -66,22 +66,27 @@ cc_test { "radio_voice_test.cpp", "VtsHalRadioTargetTest.cpp", ], + header_libs: [ + "jni_headers", + ], shared_libs: [ "libbinder_ndk", "libvintf", + "server_configurable_flags", ], static_libs: [ - "android.hardware.radio-V2-ndk", - "android.hardware.radio.config-V2-ndk", - "android.hardware.radio.data-V2-ndk", - "android.hardware.radio.ims-V1-ndk", - "android.hardware.radio.ims.media-V1-ndk", - "android.hardware.radio.messaging-V2-ndk", - "android.hardware.radio.modem-V2-ndk", - "android.hardware.radio.network-V2-ndk", + "android.hardware.radio-V3-ndk", + "android.hardware.radio.config-V3-ndk", + "android.hardware.radio.data-V3-ndk", + "android.hardware.radio.ims-V2-ndk", + "android.hardware.radio.ims.media-V2-ndk", + "android.hardware.radio.messaging-V3-ndk", + "android.hardware.radio.modem-V3-ndk", + "android.hardware.radio.network-V3-ndk", "android.hardware.radio.sap-V1-ndk", - "android.hardware.radio.sim-V2-ndk", - "android.hardware.radio.voice-V2-ndk", + "android.hardware.radio.sim-V3-ndk", + "android.hardware.radio.voice-V3-ndk", + "telephony_flags_c_lib", ], test_suites: [ "general-tests", diff --git a/radio/aidl/vts/radio_aidl_hal_utils.h b/radio/aidl/vts/radio_aidl_hal_utils.h index d8aa02431e527693708439c89650f618c8c05ff2..aea5cee2b1955a179f2413cf53f8957025390e21 100644 --- a/radio/aidl/vts/radio_aidl_hal_utils.h +++ b/radio/aidl/vts/radio_aidl_hal_utils.h @@ -24,6 +24,7 @@ #include #include #include +#include #include using namespace aidl::android::hardware::radio; @@ -31,6 +32,8 @@ using aidl::android::hardware::radio::config::SimSlotStatus; using aidl::android::hardware::radio::network::RegState; using aidl::android::hardware::radio::sim::CardStatus; +namespace telephony_flags = com::android::internal::telephony::flags; + extern CardStatus cardStatus; extern SimSlotStatus slotStatus; extern int serial; @@ -68,6 +71,18 @@ static constexpr const char* FEATURE_TELEPHONY_CDMA = "android.hardware.telephon static constexpr const char* FEATURE_TELEPHONY_IMS = "android.hardware.telephony.ims"; +static constexpr const char* FEATURE_TELEPHONY_CALLING = "android.hardware.telephony.calling"; + +static constexpr const char* FEATURE_TELEPHONY_DATA = "android.hardware.telephony.data"; + +static constexpr const char* FEATURE_TELEPHONY_MESSAGING = "android.hardware.telephony.messaging"; + +static constexpr const char* FEATURE_TELEPHONY_SUBSCRIPTION = + "android.hardware.telephony.subscription"; + +static constexpr const char* FEATURE_TELEPHONY_RADIO_ACCESS = + "android.hardware.telephony.radio.access"; + #define MODEM_EMERGENCY_CALL_ESTABLISH_TIME 3 #define MODEM_EMERGENCY_CALL_DISCONNECT_TIME 3 #define MODEM_SET_SIM_POWER_DELAY_IN_SECONDS 2 diff --git a/radio/aidl/vts/radio_config_test.cpp b/radio/aidl/vts/radio_config_test.cpp index aed3b05b4fbef7c14712ac65c1a4fb381a482680..d8c0142ccd7516395326c5bbde72c8f34beba0c8 100644 --- a/radio/aidl/vts/radio_config_test.cpp +++ b/radio/aidl/vts/radio_config_test.cpp @@ -54,6 +54,13 @@ void RadioConfigTest::updateSimSlotStatus() { * Test IRadioConfig.getHalDeviceCapabilities() for the response returned. */ TEST_P(RadioConfigTest, getHalDeviceCapabilities) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY)) { + GTEST_SKIP() << "Skipping getHalDeviceCapabilities " + "due to undefined FEATURE_TELEPHONY"; + } + } + serial = GetRandomSerialNumber(); ndk::ScopedAStatus res = radio_config->getHalDeviceCapabilities(serial); ASSERT_OK(res); @@ -66,6 +73,13 @@ TEST_P(RadioConfigTest, getHalDeviceCapabilities) { * Test IRadioConfig.getSimSlotsStatus() for the response returned. */ TEST_P(RadioConfigTest, getSimSlotsStatus) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_SUBSCRIPTION)) { + GTEST_SKIP() << "Skipping getSimSlotsStatus " + "due to undefined FEATURE_TELEPHONY_SUBSCRIPTION"; + } + } + serial = GetRandomSerialNumber(); ndk::ScopedAStatus res = radio_config->getSimSlotsStatus(serial); ASSERT_OK(res); @@ -78,6 +92,13 @@ TEST_P(RadioConfigTest, getSimSlotsStatus) { * Test IRadioConfig.getPhoneCapability() for the response returned. */ TEST_P(RadioConfigTest, getPhoneCapability) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY)) { + GTEST_SKIP() << "Skipping getPhoneCapability " + "due to undefined FEATURE_TELEPHONY"; + } + } + serial = GetRandomSerialNumber(); ndk::ScopedAStatus res = radio_config->getPhoneCapability(serial); ASSERT_OK(res); @@ -104,6 +125,13 @@ TEST_P(RadioConfigTest, getPhoneCapability) { * Test IRadioConfig.setPreferredDataModem() for the response returned. */ TEST_P(RadioConfigTest, setPreferredDataModem) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_DATA)) { + GTEST_SKIP() << "Skipping setPreferredDataModem " + "due to undefined FEATURE_TELEPHONY_DATA"; + } + } + serial = GetRandomSerialNumber(); ndk::ScopedAStatus res = radio_config->getPhoneCapability(serial); ASSERT_OK(res); @@ -146,6 +174,13 @@ TEST_P(RadioConfigTest, setPreferredDataModem) { * Test IRadioConfig.setPreferredDataModem() with invalid arguments. */ TEST_P(RadioConfigTest, setPreferredDataModem_invalidArgument) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_DATA)) { + GTEST_SKIP() << "Skipping setPreferredDataModem_invalidArgument " + "due to undefined FEATURE_TELEPHONY_DATA"; + } + } + serial = GetRandomSerialNumber(); uint8_t modemId = -1; ndk::ScopedAStatus res = radio_config->setPreferredDataModem(serial, modemId); @@ -166,6 +201,13 @@ TEST_P(RadioConfigTest, setPreferredDataModem_invalidArgument) { * Test IRadioConfig.setSimSlotsMapping() for the response returned. */ TEST_P(RadioConfigTest, setSimSlotsMapping) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_SUBSCRIPTION)) { + GTEST_SKIP() << "Skipping setSimSlotsMapping " + "due to undefined FEATURE_TELEPHONY_SUBSCRIPTION"; + } + } + // get slot status and set SIM slots mapping based on the result. updateSimSlotStatus(); if (radioRsp_config->rspInfo.error == RadioError::NONE) { @@ -227,6 +269,13 @@ TEST_P(RadioConfigTest, setSimSlotsMapping) { */ TEST_P(RadioConfigTest, checkPortInfoExistsAndPortActive) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_SUBSCRIPTION)) { + GTEST_SKIP() << "Skipping checkPortInfoExistsAndPortActive " + "due to undefined FEATURE_TELEPHONY_SUBSCRIPTION"; + } + } + serial = GetRandomSerialNumber(); ndk::ScopedAStatus res = radio_config->getSimSlotsStatus(serial); ASSERT_OK(res); diff --git a/radio/aidl/vts/radio_data_test.cpp b/radio/aidl/vts/radio_data_test.cpp index f31c254277b12b2c2a6082a52df7cfff151e0a89..2aa5508b01e88c28c99bb50d57d37cdfec27a1a5 100644 --- a/radio/aidl/vts/radio_data_test.cpp +++ b/radio/aidl/vts/radio_data_test.cpp @@ -68,6 +68,12 @@ ndk::ScopedAStatus RadioDataTest::getDataCallList() { * Test IRadioData.setupDataCall() for the response returned. */ TEST_P(RadioDataTest, setupDataCall) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_DATA)) { + GTEST_SKIP() << "setupDataCall : required FEATURE_TELEPHONY_DATA"; + } + } + serial = GetRandomSerialNumber(); AccessNetwork accessNetwork = AccessNetwork::EUTRAN; @@ -135,6 +141,13 @@ TEST_P(RadioDataTest, setupDataCall) { * Test IRadioData.setupDataCall() with osAppId for the response returned. */ TEST_P(RadioDataTest, setupDataCall_osAppId) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_DATA)) { + GTEST_SKIP() << "Skipping setupDataCall_osAppId " + "due to undefined FEATURE_TELEPHONY_DATA"; + } + } + serial = GetRandomSerialNumber(); AccessNetwork accessNetwork = AccessNetwork::EUTRAN; @@ -227,6 +240,13 @@ TEST_P(RadioDataTest, setupDataCall_osAppId) { * Test IRadioData.getSlicingConfig() for the response returned. */ TEST_P(RadioDataTest, getSlicingConfig) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_DATA)) { + GTEST_SKIP() << "Skipping getSlicingConfig " + "due to undefined FEATURE_TELEPHONY_DATA"; + } + } + serial = GetRandomSerialNumber(); radio_data->getSlicingConfig(serial); EXPECT_EQ(std::cv_status::no_timeout, wait()); @@ -242,6 +262,13 @@ TEST_P(RadioDataTest, getSlicingConfig) { * Test IRadioData.setDataThrottling() for the response returned. */ TEST_P(RadioDataTest, setDataThrottling) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_DATA)) { + GTEST_SKIP() << "Skipping setDataThrottling " + "due to undefined FEATURE_TELEPHONY_DATA"; + } + } + serial = GetRandomSerialNumber(); ndk::ScopedAStatus res = radio_data->setDataThrottling( @@ -320,6 +347,13 @@ TEST_P(RadioDataTest, setDataThrottling) { * Test IRadioData.setInitialAttachApn() for the response returned. */ TEST_P(RadioDataTest, setInitialAttachApn) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_DATA)) { + GTEST_SKIP() << "Skipping setInitialAttachApn " + "due to undefined FEATURE_TELEPHONY_DATA"; + } + } + serial = GetRandomSerialNumber(); // Create a dataProfileInfo @@ -363,6 +397,13 @@ TEST_P(RadioDataTest, setInitialAttachApn) { * Test IRadioData.setDataProfile() for the response returned. */ TEST_P(RadioDataTest, setDataProfile) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_DATA)) { + GTEST_SKIP() << "Skipping setDataProfile " + "due to undefined FEATURE_TELEPHONY_DATA"; + } + } + serial = GetRandomSerialNumber(); // Create a dataProfileInfo @@ -409,6 +450,13 @@ TEST_P(RadioDataTest, setDataProfile) { * Test IRadioData.deactivateDataCall() for the response returned. */ TEST_P(RadioDataTest, deactivateDataCall) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_DATA)) { + GTEST_SKIP() << "Skipping deactivateDataCall " + "due to undefined FEATURE_TELEPHONY_DATA"; + } + } + serial = GetRandomSerialNumber(); int cid = 1; DataRequestReason reason = DataRequestReason::NORMAL; @@ -440,6 +488,13 @@ TEST_P(RadioDataTest, deactivateDataCall) { * Test IRadioData.startKeepalive() for the response returned. */ TEST_P(RadioDataTest, startKeepalive) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_DATA)) { + GTEST_SKIP() << "Skipping startKeepalive " + "due to undefined FEATURE_TELEPHONY_DATA"; + } + } + std::vector requests = { { // Invalid IPv4 source address @@ -538,6 +593,13 @@ TEST_P(RadioDataTest, startKeepalive) { * Test IRadioData.stopKeepalive() for the response returned. */ TEST_P(RadioDataTest, stopKeepalive) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_DATA)) { + GTEST_SKIP() << "Skipping stopKeepalive " + "due to undefined FEATURE_TELEPHONY_DATA"; + } + } + serial = GetRandomSerialNumber(); radio_data->stopKeepalive(serial, 0xBAD); @@ -554,6 +616,13 @@ TEST_P(RadioDataTest, stopKeepalive) { * Test IRadioData.getDataCallList() for the response returned. */ TEST_P(RadioDataTest, getDataCallList) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_DATA)) { + GTEST_SKIP() << "Skipping getDataCallList " + "due to undefined FEATURE_TELEPHONY_DATA"; + } + } + serial = GetRandomSerialNumber(); radio_data->getDataCallList(serial); @@ -573,6 +642,13 @@ TEST_P(RadioDataTest, getDataCallList) { * Test IRadioData.setDataAllowed() for the response returned. */ TEST_P(RadioDataTest, setDataAllowed) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_DATA)) { + GTEST_SKIP() << "Skipping setDataAllowed " + "due to undefined FEATURE_TELEPHONY_DATA"; + } + } + serial = GetRandomSerialNumber(); bool allow = true; diff --git a/radio/aidl/vts/radio_imsmedia_session_listener.cpp b/radio/aidl/vts/radio_imsmedia_session_listener.cpp index 986cab24c9d7025da77a64558a6029d4cdcead1c..638a0e4bb58667a1ece40b6be60ed63c5fd3dff2 100644 --- a/radio/aidl/vts/radio_imsmedia_session_listener.cpp +++ b/radio/aidl/vts/radio_imsmedia_session_listener.cpp @@ -49,3 +49,7 @@ ndk::ScopedAStatus ImsMediaSessionListener::onCallQualityChanged( const CallQuality& /*in_callQuality*/) { return ndk::ScopedAStatus::ok(); } +ndk::ScopedAStatus ImsMediaSessionListener::notifyRtpReceptionStats( + const RtpReceptionStats& /*in_stats*/) { + return ndk::ScopedAStatus::ok(); +} diff --git a/radio/aidl/vts/radio_imsmedia_test.cpp b/radio/aidl/vts/radio_imsmedia_test.cpp index 425f6b4d6a7bb917f104dbbe76107f301194084c..e479e64fa065bfb6a6b7bcda50bbded15ce7bd45 100644 --- a/radio/aidl/vts/radio_imsmedia_test.cpp +++ b/radio/aidl/vts/radio_imsmedia_test.cpp @@ -260,6 +260,59 @@ ndk::ScopedAStatus RadioImsMediaTest::triggerOpenSession(int32_t sessionId) { return result; } +TEST_P(RadioImsMediaTest, testAvSyncOperation) { + int32_t sessionId = 1; + RtpConfig modifyRtpConfig; + int32_t receptionInterval = 1000; + int32_t delay = 200; + + modifyRtpConfig.direction = static_cast(MediaDirection::RTP_TX) | + static_cast(MediaDirection::RTP_RX) | + static_cast(MediaDirection::RTCP_TX) | + static_cast(MediaDirection::RTCP_RX); + modifyRtpConfig.remoteAddress.ipAddress = "122.22.22.33"; + modifyRtpConfig.remoteAddress.portNumber = 1234; + + if (!deviceSupportsFeature(FEATURE_TELEPHONY_IMS)) { + ALOGI("Skipping setListener because ims is not supported in device"); + return; + } else { + ALOGI("Running setListener because ims is supported in device"); + } + + ndk::ScopedAStatus res = radio_imsmedia->setListener(radio_imsmedialistener); + ASSERT_OK(res); + + serial = SERIAL_OPEN_SESSION; + res = triggerOpenSession(sessionId); + ASSERT_OK(res); + EXPECT_EQ(std::cv_status::no_timeout, wait()); + EXPECT_EQ(sessionId, radio_imsmedialistener->mSessionId); + ASSERT_NE(nullptr, radio_imsmedialistener->mSession); + + radio_imsmediasession = radio_imsmedialistener->mSession; + radio_imsmediasession->setListener(radio_imsmediasessionlistener); + ASSERT_OK(res); + + serial = SERIAL_MODIFY_SESSION; + res = radio_imsmediasession->modifySession(modifyRtpConfig); + ASSERT_OK(res); + EXPECT_EQ(std::cv_status::no_timeout, wait()); + EXPECT_EQ(modifyRtpConfig, radio_imsmediasessionlistener->mConfig); + verifyError(radio_imsmediasessionlistener->mError); + + res = radio_imsmediasession->requestRtpReceptionStats(receptionInterval); + ASSERT_OK(res); + + res = radio_imsmediasession->adjustDelay(delay); + ASSERT_OK(res); + + serial = SERIAL_CLOSE_SESSION; + res = radio_imsmedia->closeSession(sessionId); + ASSERT_OK(res); + EXPECT_EQ(std::cv_status::no_timeout, wait()); +} + void RadioImsMediaTest::verifyError(RtpError error) { switch (error) { case RtpError::NONE: diff --git a/radio/aidl/vts/radio_imsmedia_utils.h b/radio/aidl/vts/radio_imsmedia_utils.h index 87f1b00a63d29c9ac32e1629bcdecef716e11ebf..407ba9585c9f5172e81c85a876b9fc6859bd63ac 100644 --- a/radio/aidl/vts/radio_imsmedia_utils.h +++ b/radio/aidl/vts/radio_imsmedia_utils.h @@ -76,6 +76,7 @@ class ImsMediaSessionListener : public BnImsMediaSessionListener { virtual ndk::ScopedAStatus onDtmfReceived(char16_t in_dtmfDigit, int32_t in_durationMs) override; virtual ndk::ScopedAStatus onCallQualityChanged(const CallQuality& in_callQuality) override; + virtual ndk::ScopedAStatus notifyRtpReceptionStats(const RtpReceptionStats& in_stats) override; }; /* The main test class for Radio AIDL ImsMedia. */ diff --git a/radio/aidl/vts/radio_messaging_test.cpp b/radio/aidl/vts/radio_messaging_test.cpp index 4ab88d2d8a0a712608efc66d758adece6bd9a7f1..95e261790bd16fb1612730e1f6f19f66e5c928da 100644 --- a/radio/aidl/vts/radio_messaging_test.cpp +++ b/radio/aidl/vts/radio_messaging_test.cpp @@ -59,6 +59,13 @@ void RadioMessagingTest::SetUp() { * Test IRadioMessaging.sendSms() for the response returned. */ TEST_P(RadioMessagingTest, sendSms) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_MESSAGING)) { + GTEST_SKIP() << "Skipping sendSms " + "due to undefined FEATURE_TELEPHONY_MESSAGING"; + } + } + serial = GetRandomSerialNumber(); GsmSmsMessage msg; msg.smscPdu = ""; @@ -83,6 +90,13 @@ TEST_P(RadioMessagingTest, sendSms) { * Test IRadioMessaging.sendSmsExpectMore() for the response returned. */ TEST_P(RadioMessagingTest, sendSmsExpectMore) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_MESSAGING)) { + GTEST_SKIP() << "Skipping sendSmsExpectMore " + "due to undefined FEATURE_TELEPHONY_MESSAGING"; + } + } + serial = GetRandomSerialNumber(); GsmSmsMessage msg; msg.smscPdu = ""; @@ -106,6 +120,13 @@ TEST_P(RadioMessagingTest, sendSmsExpectMore) { * Test IRadioMessaging.sendCdmaSms() for the response returned. */ TEST_P(RadioMessagingTest, sendCdmaSms) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_CDMA)) { + GTEST_SKIP() << "Skipping sendCdmaSms " + "due to undefined FEATURE_TELEPHONY_CDMA"; + } + } + serial = GetRandomSerialNumber(); // Create a CdmaSmsAddress @@ -150,6 +171,13 @@ TEST_P(RadioMessagingTest, sendCdmaSms) { * Test IRadioMessaging.sendCdmaSmsExpectMore() for the response returned. */ TEST_P(RadioMessagingTest, sendCdmaSmsExpectMore) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_CDMA)) { + GTEST_SKIP() << "Skipping sendCdmaSmsExpectMore " + "due to undefined FEATURE_TELEPHONY_CDMA"; + } + } + serial = GetRandomSerialNumber(); // Create a CdmaSmsAddress @@ -194,6 +222,13 @@ TEST_P(RadioMessagingTest, sendCdmaSmsExpectMore) { * Test IRadioMessaging.setGsmBroadcastConfig() for the response returned. */ TEST_P(RadioMessagingTest, setGsmBroadcastConfig) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_MESSAGING)) { + GTEST_SKIP() << "Skipping setGsmBroadcastConfig " + "due to undefined FEATURE_TELEPHONY_MESSAGING"; + } + } + serial = GetRandomSerialNumber(); // Create GsmBroadcastSmsConfigInfo #1 @@ -257,6 +292,13 @@ TEST_P(RadioMessagingTest, setGsmBroadcastConfig) { * Test IRadioMessaging.getGsmBroadcastConfig() for the response returned. */ TEST_P(RadioMessagingTest, getGsmBroadcastConfig) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_MESSAGING)) { + GTEST_SKIP() << "Skipping getGsmBroadcastConfig " + "due to undefined FEATURE_TELEPHONY_MESSAGING"; + } + } + serial = GetRandomSerialNumber(); radio_messaging->getGsmBroadcastConfig(serial); @@ -277,6 +319,13 @@ TEST_P(RadioMessagingTest, getGsmBroadcastConfig) { * Test IRadioMessaging.setCdmaBroadcastConfig() for the response returned. */ TEST_P(RadioMessagingTest, setCdmaBroadcastConfig) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_CDMA)) { + GTEST_SKIP() << "Skipping setCdmaBroadcastConfig " + "due to undefined FEATURE_TELEPHONY_CDMA"; + } + } + serial = GetRandomSerialNumber(); CdmaBroadcastSmsConfigInfo cbSmsConfig; @@ -303,6 +352,13 @@ TEST_P(RadioMessagingTest, setCdmaBroadcastConfig) { * Test IRadioMessaging.getCdmaBroadcastConfig() for the response returned. */ TEST_P(RadioMessagingTest, getCdmaBroadcastConfig) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_CDMA)) { + GTEST_SKIP() << "Skipping getCdmaBroadcastConfig " + "due to undefined FEATURE_TELEPHONY_CDMA"; + } + } + serial = GetRandomSerialNumber(); radio_messaging->getCdmaBroadcastConfig(serial); @@ -321,6 +377,13 @@ TEST_P(RadioMessagingTest, getCdmaBroadcastConfig) { * Test IRadioMessaging.setCdmaBroadcastActivation() for the response returned. */ TEST_P(RadioMessagingTest, setCdmaBroadcastActivation) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_CDMA)) { + GTEST_SKIP() << "Skipping setCdmaBroadcastActivation " + "due to undefined FEATURE_TELEPHONY_CDMA"; + } + } + serial = GetRandomSerialNumber(); bool activate = false; @@ -341,6 +404,13 @@ TEST_P(RadioMessagingTest, setCdmaBroadcastActivation) { * Test IRadioMessaging.setGsmBroadcastActivation() for the response returned. */ TEST_P(RadioMessagingTest, setGsmBroadcastActivation) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_MESSAGING)) { + GTEST_SKIP() << "Skipping setGsmBroadcastActivation " + "due to undefined FEATURE_TELEPHONY_MESSAGING"; + } + } + serial = GetRandomSerialNumber(); bool activate = false; @@ -363,6 +433,13 @@ TEST_P(RadioMessagingTest, setGsmBroadcastActivation) { * Test IRadioMessaging.acknowledgeLastIncomingGsmSms() for the response returned. */ TEST_P(RadioMessagingTest, acknowledgeLastIncomingGsmSms) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_MESSAGING)) { + GTEST_SKIP() << "Skipping acknowledgeLastIncomingGsmSms " + "due to undefined FEATURE_TELEPHONY_MESSAGING"; + } + } + serial = GetRandomSerialNumber(); bool success = true; @@ -384,6 +461,13 @@ TEST_P(RadioMessagingTest, acknowledgeLastIncomingGsmSms) { * Test IRadioMessaging.acknowledgeIncomingGsmSmsWithPdu() for the response returned. */ TEST_P(RadioMessagingTest, acknowledgeIncomingGsmSmsWithPdu) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_MESSAGING)) { + GTEST_SKIP() << "Skipping acknowledgeIncomingGsmSmsWithPdu " + "due to undefined FEATURE_TELEPHONY_MESSAGING"; + } + } + serial = GetRandomSerialNumber(); bool success = true; std::string ackPdu = ""; @@ -405,6 +489,13 @@ TEST_P(RadioMessagingTest, acknowledgeIncomingGsmSmsWithPdu) { * Test IRadioMessaging.acknowledgeLastIncomingCdmaSms() for the response returned. */ TEST_P(RadioMessagingTest, acknowledgeLastIncomingCdmaSms) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_CDMA)) { + GTEST_SKIP() << "Skipping acknowledgeIncomingGsmSmsWithPdu " + "due to undefined FEATURE_TELEPHONY_CDMA"; + } + } + serial = GetRandomSerialNumber(); // Create a CdmaSmsAck @@ -429,6 +520,13 @@ TEST_P(RadioMessagingTest, acknowledgeLastIncomingCdmaSms) { * Test IRadioMessaging.sendImsSms() for the response returned. */ TEST_P(RadioMessagingTest, sendImsSms) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_IMS)) { + GTEST_SKIP() << "Skipping acknowledgeIncomingGsmSmsWithPdu " + "due to undefined FEATURE_TELEPHONY_IMS"; + } + } + serial = GetRandomSerialNumber(); // Create a CdmaSmsAddress @@ -479,6 +577,13 @@ TEST_P(RadioMessagingTest, sendImsSms) { * Test IRadioMessaging.getSmscAddress() for the response returned. */ TEST_P(RadioMessagingTest, getSmscAddress) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_MESSAGING)) { + GTEST_SKIP() << "Skipping getSmscAddress " + "due to undefined FEATURE_TELEPHONY_MESSAGING"; + } + } + serial = GetRandomSerialNumber(); radio_messaging->getSmscAddress(serial); @@ -499,6 +604,13 @@ TEST_P(RadioMessagingTest, getSmscAddress) { * Test IRadioMessaging.setSmscAddress() for the response returned. */ TEST_P(RadioMessagingTest, setSmscAddress) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_MESSAGING)) { + GTEST_SKIP() << "Skipping setSmscAddress " + "due to undefined FEATURE_TELEPHONY_MESSAGING"; + } + } + serial = GetRandomSerialNumber(); std::string address = std::string("smscAddress"); @@ -520,6 +632,13 @@ TEST_P(RadioMessagingTest, setSmscAddress) { * Test IRadioMessaging.writeSmsToSim() for the response returned. */ TEST_P(RadioMessagingTest, writeSmsToSim) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_MESSAGING)) { + GTEST_SKIP() << "Skipping writeSmsToSim " + "due to undefined FEATURE_TELEPHONY_MESSAGING"; + } + } + serial = GetRandomSerialNumber(); SmsWriteArgs smsWriteArgs; smsWriteArgs.status = SmsWriteArgs::STATUS_REC_UNREAD; @@ -546,6 +665,13 @@ TEST_P(RadioMessagingTest, writeSmsToSim) { * Test IRadioMessaging.deleteSmsOnSim() for the response returned. */ TEST_P(RadioMessagingTest, deleteSmsOnSim) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_MESSAGING)) { + GTEST_SKIP() << "Skipping deleteSmsOnSim " + "due to undefined FEATURE_TELEPHONY_MESSAGING"; + } + } + serial = GetRandomSerialNumber(); int index = 1; @@ -569,6 +695,13 @@ TEST_P(RadioMessagingTest, deleteSmsOnSim) { * Test IRadioMessaging.writeSmsToRuim() for the response returned. */ TEST_P(RadioMessagingTest, writeSmsToRuim) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_CDMA)) { + GTEST_SKIP() << "Skipping writeSmsToRuim " + "due to undefined FEATURE_TELEPHONY_CDMA"; + } + } + serial = GetRandomSerialNumber(); // Create a CdmaSmsAddress @@ -620,6 +753,13 @@ TEST_P(RadioMessagingTest, writeSmsToRuim) { * Test IRadioMessaging.deleteSmsOnRuim() for the response returned. */ TEST_P(RadioMessagingTest, deleteSmsOnRuim) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_CDMA)) { + GTEST_SKIP() << "Skipping deleteSmsOnRuim " + "due to undefined FEATURE_TELEPHONY_CDMA"; + } + } + serial = GetRandomSerialNumber(); int index = 1; @@ -671,6 +811,13 @@ TEST_P(RadioMessagingTest, deleteSmsOnRuim) { * Test IRadioMessaging.reportSmsMemoryStatus() for the response returned. */ TEST_P(RadioMessagingTest, reportSmsMemoryStatus) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_MESSAGING)) { + GTEST_SKIP() << "Skipping reportSmsMemoryStatus " + "due to undefined FEATURE_TELEPHONY_MESSAGING"; + } + } + serial = GetRandomSerialNumber(); bool available = true; diff --git a/radio/aidl/vts/radio_modem_indication.cpp b/radio/aidl/vts/radio_modem_indication.cpp index 0bfcd669c797dfbdced979277a8cf5a8e5a7ee31..9f63cb0270f69479204434ee0d1a3cbad4e554c1 100644 --- a/radio/aidl/vts/radio_modem_indication.cpp +++ b/radio/aidl/vts/radio_modem_indication.cpp @@ -41,3 +41,8 @@ ndk::ScopedAStatus RadioModemIndication::radioStateChanged(RadioIndicationType / ndk::ScopedAStatus RadioModemIndication::rilConnected(RadioIndicationType /*type*/) { return ndk::ScopedAStatus::ok(); } + +ndk::ScopedAStatus RadioModemIndication::onImeiMappingChanged(RadioIndicationType /*type*/, + const ::aidl::android::hardware::radio::modem::ImeiInfo& /*imeiInfo*/) { + return ndk::ScopedAStatus::ok(); +} diff --git a/radio/aidl/vts/radio_modem_test.cpp b/radio/aidl/vts/radio_modem_test.cpp index c48a46104a544c646244a3b760ef010a8cf4b85b..6a9996bb1dbe0a471fcce2873c70e42cea21ce81 100644 --- a/radio/aidl/vts/radio_modem_test.cpp +++ b/radio/aidl/vts/radio_modem_test.cpp @@ -59,6 +59,13 @@ void RadioModemTest::SetUp() { * Test IRadioModem.setRadioPower() for the response returned. */ TEST_P(RadioModemTest, setRadioPower_emergencyCall_cancelled) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_RADIO_ACCESS)) { + GTEST_SKIP() << "Skipping setRadioPower_emergencyCall_cancelled " + "due to undefined FEATURE_TELEPHONY_RADIO_ACCESS"; + } + } + // Set radio power to off. serial = GetRandomSerialNumber(); radio_modem->setRadioPower(serial, false, false, false); @@ -90,6 +97,13 @@ TEST_P(RadioModemTest, setRadioPower_emergencyCall_cancelled) { * Test IRadioModem.enableModem() for the response returned. */ TEST_P(RadioModemTest, enableModem) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY)) { + GTEST_SKIP() << "Skipping enableModem " + "due to undefined FEATURE_TELEPHONY"; + } + } + serial = GetRandomSerialNumber(); if (isSsSsEnabled()) { @@ -134,6 +148,13 @@ TEST_P(RadioModemTest, enableModem) { * Test IRadioModem.getModemStackStatus() for the response returned. */ TEST_P(RadioModemTest, getModemStackStatus) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY)) { + GTEST_SKIP() << "Skipping getModemStackStatus " + "due to undefined FEATURE_TELEPHONY"; + } + } + serial = GetRandomSerialNumber(); ndk::ScopedAStatus res = radio_modem->getModemStackStatus(serial); @@ -152,6 +173,13 @@ TEST_P(RadioModemTest, getModemStackStatus) { * Test IRadioModem.getBasebandVersion() for the response returned. */ TEST_P(RadioModemTest, getBasebandVersion) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY)) { + GTEST_SKIP() << "Skipping getBasebandVersion " + "due to undefined FEATURE_TELEPHONY"; + } + } + serial = GetRandomSerialNumber(); radio_modem->getBasebandVersion(serial); @@ -168,6 +196,13 @@ TEST_P(RadioModemTest, getBasebandVersion) { * Test IRadioModem.getDeviceIdentity() for the response returned. */ TEST_P(RadioModemTest, getDeviceIdentity) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY)) { + GTEST_SKIP() << "Skipping getDeviceIdentity " + "due to undefined FEATURE_TELEPHONY"; + } + } + serial = GetRandomSerialNumber(); radio_modem->getDeviceIdentity(serial); @@ -185,6 +220,13 @@ TEST_P(RadioModemTest, getDeviceIdentity) { * Test IRadioModem.getImei() for the response returned. */ TEST_P(RadioModemTest, getImei) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_GSM)) { + GTEST_SKIP() << "Skipping getImei " + "due to undefined FEATURE_TELEPHONY_GSM"; + } + } + int32_t aidl_version; ndk::ScopedAStatus aidl_status = radio_modem->getInterfaceVersion(&aidl_version); ASSERT_OK(aidl_status); @@ -246,6 +288,13 @@ TEST_P(RadioModemTest, nvWriteItem) { * Test IRadioModem.nvWriteCdmaPrl() for the response returned. */ TEST_P(RadioModemTest, nvWriteCdmaPrl) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_CDMA)) { + GTEST_SKIP() << "Skipping nvWriteCdmaPrl " + "due to undefined FEATURE_TELEPHONY_CDMA"; + } + } + serial = GetRandomSerialNumber(); std::vector prl = {1, 2, 3, 4, 5}; @@ -283,6 +332,13 @@ TEST_P(RadioModemTest, nvResetConfig) { * Test IRadioModem.getHardwareConfig() for the response returned. */ TEST_P(RadioModemTest, getHardwareConfig) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY)) { + GTEST_SKIP() << "Skipping getHardwareConfig " + "due to undefined FEATURE_TELEPHONY"; + } + } + serial = GetRandomSerialNumber(); radio_modem->getHardwareConfig(serial); @@ -302,6 +358,13 @@ TEST_P(RadioModemTest, getHardwareConfig) { * Test IRadioModem.requestShutdown() for the response returned. */ TEST_P(RadioModemTest, DISABLED_requestShutdown) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_RADIO_ACCESS)) { + GTEST_SKIP() << "Skipping DISABLED_requestShutdown " + "due to undefined FEATURE_TELEPHONY_RADIO_ACCESS"; + } + } + serial = GetRandomSerialNumber(); radio_modem->requestShutdown(serial); @@ -319,6 +382,13 @@ TEST_P(RadioModemTest, DISABLED_requestShutdown) { * Test IRadioModem.getRadioCapability() for the response returned. */ TEST_P(RadioModemTest, getRadioCapability) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_RADIO_ACCESS)) { + GTEST_SKIP() << "Skipping getRadioCapability " + "due to undefined FEATURE_TELEPHONY_RADIO_ACCESS"; + } + } + serial = GetRandomSerialNumber(); radio_modem->getRadioCapability(serial); @@ -335,6 +405,13 @@ TEST_P(RadioModemTest, getRadioCapability) { * Test IRadioModem.setRadioCapability() for the response returned. */ TEST_P(RadioModemTest, setRadioCapability) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_RADIO_ACCESS)) { + GTEST_SKIP() << "Skipping setRadioCapability " + "due to undefined FEATURE_TELEPHONY"; + } + } + serial = GetRandomSerialNumber(); RadioCapability rc; memset(&rc, 0, sizeof(rc)); @@ -356,6 +433,13 @@ TEST_P(RadioModemTest, setRadioCapability) { * Test IRadioModem.getModemActivityInfo() for the response returned. */ TEST_P(RadioModemTest, getModemActivityInfo) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_RADIO_ACCESS)) { + GTEST_SKIP() << "Skipping getModemActivityInfo " + "due to undefined FEATURE_TELEPHONY_RADIO_ACCESS"; + } + } + serial = GetRandomSerialNumber(); radio_modem->getModemActivityInfo(serial); @@ -373,6 +457,13 @@ TEST_P(RadioModemTest, getModemActivityInfo) { * Test IRadioModem.sendDeviceState() for the response returned. */ TEST_P(RadioModemTest, sendDeviceState) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY)) { + GTEST_SKIP() << "Skipping sendDeviceState " + "due to undefined FEATURE_TELEPHONY"; + } + } + serial = GetRandomSerialNumber(); radio_modem->sendDeviceState(serial, DeviceStateType::POWER_SAVE_MODE, true); diff --git a/radio/aidl/vts/radio_modem_utils.h b/radio/aidl/vts/radio_modem_utils.h index d47bdeb921b16ac8a0a814fcbbbedbb5ae965f92..aa99ea3a9b60ff1cc8d9aae4d5c79ad566362282 100644 --- a/radio/aidl/vts/radio_modem_utils.h +++ b/radio/aidl/vts/radio_modem_utils.h @@ -109,6 +109,9 @@ class RadioModemIndication : public BnRadioModemIndication { RadioState radioState) override; virtual ndk::ScopedAStatus rilConnected(RadioIndicationType type) override; + + virtual ndk::ScopedAStatus onImeiMappingChanged(RadioIndicationType type, + const ::aidl::android::hardware::radio::modem::ImeiInfo& imeiInfo) override; }; // The main test class for Radio AIDL Modem. diff --git a/radio/aidl/vts/radio_network_indication.cpp b/radio/aidl/vts/radio_network_indication.cpp index ae3bd4b01ae4f9199d44d19a23ae9596207c59a5..96147839fdae41effca0d094196ca59e92385181 100644 --- a/radio/aidl/vts/radio_network_indication.cpp +++ b/radio/aidl/vts/radio_network_indication.cpp @@ -97,3 +97,14 @@ ndk::ScopedAStatus RadioNetworkIndication::emergencyNetworkScanResult( RadioIndicationType /*type*/, const EmergencyRegResult& /*result*/) { return ndk::ScopedAStatus::ok(); } + +ndk::ScopedAStatus RadioNetworkIndication::cellularIdentifierDisclosed( + RadioIndicationType /*type*/, + const CellularIdentifierDisclosure& /*disclosures*/) { + return ndk::ScopedAStatus::ok(); +} + +ndk::ScopedAStatus RadioNetworkIndication::securityAlgorithmsUpdated( + RadioIndicationType /*type*/, const SecurityAlgorithmUpdate& /*securityAlgorithmUpdate*/) { + return ndk::ScopedAStatus::ok(); +} diff --git a/radio/aidl/vts/radio_network_response.cpp b/radio/aidl/vts/radio_network_response.cpp index 25d45a5577c48b12ccce99b5ac7e5ec9bf10b8c9..4d452d0c786eefcc593e3a2c9c618687c54e4b29 100644 --- a/radio/aidl/vts/radio_network_response.cpp +++ b/radio/aidl/vts/radio_network_response.cpp @@ -320,3 +320,33 @@ ndk::ScopedAStatus RadioNetworkResponse::setN1ModeEnabledResponse(const RadioRes parent_network.notify(info.serial); return ndk::ScopedAStatus::ok(); } + +ndk::ScopedAStatus RadioNetworkResponse::setCellularIdentifierTransparencyEnabledResponse( + const RadioResponseInfo& info) { + rspInfo = info; + parent_network.notify(info.serial); + return ndk::ScopedAStatus::ok(); +} + +ndk::ScopedAStatus RadioNetworkResponse::isCellularIdentifierTransparencyEnabledResponse( + const RadioResponseInfo& info, bool enabled) { + rspInfo = info; + this->isCellularIdentifierTransparencyEnabled = enabled; + parent_network.notify(info.serial); + return ndk::ScopedAStatus::ok(); +} + +ndk::ScopedAStatus RadioNetworkResponse::setSecurityAlgorithmsUpdatedEnabledResponse( + const RadioResponseInfo& info) { + rspInfo = info; + parent_network.notify(info.serial); + return ndk::ScopedAStatus::ok(); +} + +ndk::ScopedAStatus RadioNetworkResponse::isSecurityAlgorithmsUpdatedEnabledResponse( + const RadioResponseInfo& info, bool enabled) { + rspInfo = info; + this->isSecurityAlgorithmsUpdatedEnabled = enabled; + parent_network.notify(info.serial); + return ndk::ScopedAStatus::ok(); +} diff --git a/radio/aidl/vts/radio_network_test.cpp b/radio/aidl/vts/radio_network_test.cpp index 0cb8ba70b891800e512752283667bba8047e6f48..867be04e851e4f7448d5e0f671d56aad84ed0579 100644 --- a/radio/aidl/vts/radio_network_test.cpp +++ b/radio/aidl/vts/radio_network_test.cpp @@ -81,8 +81,20 @@ void RadioNetworkTest::stopNetworkScan() { * for the response returned. */ TEST_P(RadioNetworkTest, setGetAllowedNetworkTypesBitmap) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_RADIO_ACCESS)) { + GTEST_SKIP() << "Skipping setGetAllowedNetworkTypesBitmap " + "due to undefined FEATURE_TELEPHONY_RADIO_ACCESS"; + } + } + serial = GetRandomSerialNumber(); + // get aidl version + int32_t aidl_version; + ndk::ScopedAStatus aidl_status = radio_network->getInterfaceVersion(&aidl_version); + ASSERT_OK(aidl_status); + // save current value radio_network->getAllowedNetworkTypesBitmap(serial); EXPECT_EQ(std::cv_status::no_timeout, wait()); @@ -118,6 +130,11 @@ TEST_P(RadioNetworkTest, setGetAllowedNetworkTypesBitmap) { RadioError::INVALID_ARGUMENTS, RadioError::MODEM_ERR, RadioError::REQUEST_NOT_SUPPORTED, RadioError::NO_RESOURCES})); if (radioRsp_network->rspInfo.error == RadioError::NONE) { + if (aidl_version < 2) { + radioRsp_network->networkTypeBitmapResponse + &= ~static_cast(RadioAccessFamily::LTE_CA); + } + // verify we get the value we set EXPECT_EQ(radioRsp_network->networkTypeBitmapResponse, allowedNetworkTypesBitmap); } @@ -133,6 +150,13 @@ TEST_P(RadioNetworkTest, setGetAllowedNetworkTypesBitmap) { * Test IRadioNetwork.setNrDualConnectivityState() for the response returned. */ TEST_P(RadioNetworkTest, setNrDualConnectivityState) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_RADIO_ACCESS)) { + GTEST_SKIP() << "Skipping setNrDualConnectivityState " + "due to undefined FEATURE_TELEPHONY_RADIO_ACCESS"; + } + } + serial = GetRandomSerialNumber(); ndk::ScopedAStatus res = @@ -157,6 +181,13 @@ TEST_P(RadioNetworkTest, setNrDualConnectivityState) { * Test IRadioNetwork.isNrDualConnectivityEnabled() for the response returned. */ TEST_P(RadioNetworkTest, isNrDualConnectivityEnabled) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_RADIO_ACCESS)) { + GTEST_SKIP() << "Skipping isNrDualConnectivityEnabled " + "due to undefined FEATURE_TELEPHONY_RADIO_ACCESS"; + } + } + serial = GetRandomSerialNumber(); ndk::ScopedAStatus res = radio_network->isNrDualConnectivityEnabled(serial); @@ -195,6 +226,13 @@ void RadioNetworkTest::invokeAndExpectResponse( * Verify that the usage setting can be retrieved. */ TEST_P(RadioNetworkTest, getUsageSetting) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY)) { + GTEST_SKIP() << "Skipping getUsageSetting " + "due to undefined FEATURE_TELEPHONY"; + } + } + invokeAndExpectResponse([&](int serial) { return radio_network->getUsageSetting(serial); }, {RadioError::RADIO_NOT_AVAILABLE, RadioError::INVALID_STATE, RadioError::SIM_ABSENT, RadioError::INTERNAL_ERR, RadioError::NONE}); @@ -232,6 +270,13 @@ void RadioNetworkTest::testSetUsageSetting_InvalidValues(std::vector * -That the usage setting cannot be set to invalid values. */ TEST_P(RadioNetworkTest, setUsageSetting) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY)) { + GTEST_SKIP() << "Skipping setUsageSetting " + "due to undefined FEATURE_TELEPHONY"; + } + } + invokeAndExpectResponse([&](int serial) { return radio_network->getUsageSetting(serial); }, {RadioError::RADIO_NOT_AVAILABLE, RadioError::INVALID_STATE, RadioError::SIM_ABSENT, RadioError::INTERNAL_ERR, RadioError::NONE}); @@ -294,6 +339,13 @@ TEST_P(RadioNetworkTest, setUsageSetting) { * Test IRadioNetwork.setSignalStrengthReportingCriteria() with invalid hysteresisDb */ TEST_P(RadioNetworkTest, setSignalStrengthReportingCriteria_invalidHysteresisDb) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_RADIO_ACCESS)) { + GTEST_SKIP() << "Skipping setSignalStrengthReportingCriteria_invalidHysteresisDb " + "due to undefined FEATURE_TELEPHONY_RADIO_ACCESS"; + } + } + serial = GetRandomSerialNumber(); SignalThresholdInfo signalThresholdInfo; @@ -320,6 +372,13 @@ TEST_P(RadioNetworkTest, setSignalStrengthReportingCriteria_invalidHysteresisDb) * Test IRadioNetwork.setSignalStrengthReportingCriteria() with empty thresholds */ TEST_P(RadioNetworkTest, setSignalStrengthReportingCriteria_EmptyThresholds) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_RADIO_ACCESS)) { + GTEST_SKIP() << "Skipping setSignalStrengthReportingCriteria_EmptyThresholds " + "due to undefined FEATURE_TELEPHONY_RADIO_ACCESS"; + } + } + serial = GetRandomSerialNumber(); SignalThresholdInfo signalThresholdInfo; @@ -345,6 +404,13 @@ TEST_P(RadioNetworkTest, setSignalStrengthReportingCriteria_EmptyThresholds) { * Test IRadioNetwork.setSignalStrengthReportingCriteria() for GERAN */ TEST_P(RadioNetworkTest, setSignalStrengthReportingCriteria_Geran) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_RADIO_ACCESS)) { + GTEST_SKIP() << "Skipping setSignalStrengthReportingCriteria_Geran " + "due to undefined FEATURE_TELEPHONY_RADIO_ACCESS"; + } + } + serial = GetRandomSerialNumber(); SignalThresholdInfo signalThresholdInfo; @@ -372,6 +438,13 @@ TEST_P(RadioNetworkTest, setSignalStrengthReportingCriteria_Geran) { * Test IRadioNetwork.setSignalStrengthReportingCriteria() for UTRAN */ TEST_P(RadioNetworkTest, setSignalStrengthReportingCriteria_Utran_Rscp) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_RADIO_ACCESS)) { + GTEST_SKIP() << "Skipping setSignalStrengthReportingCriteria_Utran_Rscp " + "due to undefined FEATURE_TELEPHONY_RADIO_ACCESS"; + } + } + serial = GetRandomSerialNumber(); SignalThresholdInfo signalThresholdInfo; @@ -398,6 +471,13 @@ TEST_P(RadioNetworkTest, setSignalStrengthReportingCriteria_Utran_Rscp) { * Test IRadioNetwork.setSignalStrengthReportingCriteria() for UTRAN */ TEST_P(RadioNetworkTest, setSignalStrengthReportingCriteria_Utran_Ecno) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_RADIO_ACCESS)) { + GTEST_SKIP() << "Skipping setSignalStrengthReportingCriteria_Utran_Ecno " + "due to undefined FEATURE_TELEPHONY_RADIO_ACCESS"; + } + } + serial = GetRandomSerialNumber(); SignalThresholdInfo signalThresholdInfo; @@ -425,6 +505,13 @@ TEST_P(RadioNetworkTest, setSignalStrengthReportingCriteria_Utran_Ecno) { * Test IRadioNetwork.setSignalStrengthReportingCriteria() for EUTRAN */ TEST_P(RadioNetworkTest, setSignalStrengthReportingCriteria_Eutran_RSRP) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_RADIO_ACCESS)) { + GTEST_SKIP() << "Skipping setSignalStrengthReportingCriteria_Eutran_RSRP " + "due to undefined FEATURE_TELEPHONY_RADIO_ACCESS"; + } + } + serial = GetRandomSerialNumber(); SignalThresholdInfo signalThresholdInfo; @@ -451,6 +538,13 @@ TEST_P(RadioNetworkTest, setSignalStrengthReportingCriteria_Eutran_RSRP) { * Test IRadioNetwork.setSignalStrengthReportingCriteria() for EUTRAN */ TEST_P(RadioNetworkTest, setSignalStrengthReportingCriteria_Eutran_RSRQ) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_RADIO_ACCESS)) { + GTEST_SKIP() << "Skipping setSignalStrengthReportingCriteria_Eutran_RSRQ " + "due to undefined FEATURE_TELEPHONY_RADIO_ACCESS"; + } + } + serial = GetRandomSerialNumber(); SignalThresholdInfo signalThresholdInfo; @@ -477,6 +571,13 @@ TEST_P(RadioNetworkTest, setSignalStrengthReportingCriteria_Eutran_RSRQ) { * Test IRadioNetwork.setSignalStrengthReportingCriteria() for EUTRAN */ TEST_P(RadioNetworkTest, setSignalStrengthReportingCriteria_Eutran_RSSNR) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_RADIO_ACCESS)) { + GTEST_SKIP() << "Skipping setSignalStrengthReportingCriteria_Eutran_RSSNR " + "due to undefined FEATURE_TELEPHONY_RADIO_ACCESS"; + } + } + serial = GetRandomSerialNumber(); SignalThresholdInfo signalThresholdInfo; @@ -499,6 +600,13 @@ TEST_P(RadioNetworkTest, setSignalStrengthReportingCriteria_Eutran_RSSNR) { * Test IRadioNetwork.setSignalStrengthReportingCriteria() for CDMA2000 */ TEST_P(RadioNetworkTest, setSignalStrengthReportingCriteria_Cdma2000) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_RADIO_ACCESS)) { + GTEST_SKIP() << "Skipping setSignalStrengthReportingCriteria_Cdma2000 " + "due to undefined FEATURE_TELEPHONY_RADIO_ACCESS"; + } + } + serial = GetRandomSerialNumber(); SignalThresholdInfo signalThresholdInfo; @@ -525,6 +633,13 @@ TEST_P(RadioNetworkTest, setSignalStrengthReportingCriteria_Cdma2000) { * Test IRadioNetwork.setSignalStrengthReportingCriteria() for NGRAN_SSRSRP */ TEST_P(RadioNetworkTest, setSignalStrengthReportingCriteria_NGRAN_SSRSRP) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_RADIO_ACCESS)) { + GTEST_SKIP() << "Skipping setSignalStrengthReportingCriteria_NGRAN_SSRSRP " + "due to undefined FEATURE_TELEPHONY_RADIO_ACCESS"; + } + } + serial = GetRandomSerialNumber(); SignalThresholdInfo signalThresholdInfo; @@ -555,6 +670,13 @@ TEST_P(RadioNetworkTest, setSignalStrengthReportingCriteria_NGRAN_SSRSRP) { * Test IRadioNetwork.setSignalStrengthReportingCriteria() for NGRAN_SSRSRQ */ TEST_P(RadioNetworkTest, setSignalStrengthReportingCriteria_NGRAN_SSRSRQ) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_RADIO_ACCESS)) { + GTEST_SKIP() << "Skipping setSignalStrengthReportingCriteria_NGRAN_SSRSRQ " + "due to undefined FEATURE_TELEPHONY_RADIO_ACCESS"; + } + } + serial = GetRandomSerialNumber(); SignalThresholdInfo signalThresholdInfo; @@ -585,6 +707,13 @@ TEST_P(RadioNetworkTest, setSignalStrengthReportingCriteria_NGRAN_SSRSRQ) { * Test IRadioNetwork.setSignalStrengthReportingCriteria() for EUTRAN */ TEST_P(RadioNetworkTest, setSignalStrengthReportingCriteria_Disable_RSSNR) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_RADIO_ACCESS)) { + GTEST_SKIP() << "Skipping setSignalStrengthReportingCriteria_Disable_RSSNR " + "due to undefined FEATURE_TELEPHONY_RADIO_ACCESS"; + } + } + serial = GetRandomSerialNumber(); SignalThresholdInfo signalThresholdInfo; @@ -607,6 +736,13 @@ TEST_P(RadioNetworkTest, setSignalStrengthReportingCriteria_Disable_RSSNR) { * Test IRadioNetwork.setSignalStrengthReportingCriteria() for NGRAN_SSSINR */ TEST_P(RadioNetworkTest, setSignalStrengthReportingCriteria_NGRAN_SSSINR) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_RADIO_ACCESS)) { + GTEST_SKIP() << "Skipping setSignalStrengthReportingCriteria_NGRAN_SSSINR " + "due to undefined FEATURE_TELEPHONY_RADIO_ACCESS"; + } + } + serial = GetRandomSerialNumber(); SignalThresholdInfo signalThresholdInfo; @@ -637,6 +773,13 @@ TEST_P(RadioNetworkTest, setSignalStrengthReportingCriteria_NGRAN_SSSINR) { * Test IRadioNetwork.setSignalStrengthReportingCriteria() for multi-RANs per request */ TEST_P(RadioNetworkTest, setSignalStrengthReportingCriteria_multiRansPerRequest) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_RADIO_ACCESS)) { + GTEST_SKIP() << "Skipping setSignalStrengthReportingCriteria_multiRansPerRequest " + "due to undefined FEATURE_TELEPHONY_RADIO_ACCESS"; + } + } + SignalThresholdInfo signalThresholdInfoGeran; signalThresholdInfoGeran.signalMeasurement = SignalThresholdInfo::SIGNAL_MEASUREMENT_TYPE_RSSI; signalThresholdInfoGeran.hysteresisMs = 5000; @@ -720,6 +863,13 @@ TEST_P(RadioNetworkTest, setSignalStrengthReportingCriteria_multiRansPerRequest) * Test IRadioNetwork.setLinkCapacityReportingCriteria() invalid hysteresisDlKbps */ TEST_P(RadioNetworkTest, setLinkCapacityReportingCriteria_invalidHysteresisDlKbps) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_RADIO_ACCESS)) { + GTEST_SKIP() << "Skipping setLinkCapacityReportingCriteria_invalidHysteresisDlKbps " + "due to undefined FEATURE_TELEPHONY_RADIO_ACCESS"; + } + } + serial = GetRandomSerialNumber(); ndk::ScopedAStatus res = radio_network->setLinkCapacityReportingCriteria( @@ -740,6 +890,13 @@ TEST_P(RadioNetworkTest, setLinkCapacityReportingCriteria_invalidHysteresisDlKbp * Test IRadioNetwork.setLinkCapacityReportingCriteria() invalid hysteresisUlKbps */ TEST_P(RadioNetworkTest, setLinkCapacityReportingCriteria_invalidHysteresisUlKbps) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_RADIO_ACCESS)) { + GTEST_SKIP() << "Skipping setLinkCapacityReportingCriteria_invalidHysteresisUlKbps " + "due to undefined FEATURE_TELEPHONY_RADIO_ACCESS"; + } + } + serial = GetRandomSerialNumber(); ndk::ScopedAStatus res = radio_network->setLinkCapacityReportingCriteria( @@ -759,6 +916,13 @@ TEST_P(RadioNetworkTest, setLinkCapacityReportingCriteria_invalidHysteresisUlKbp * Test IRadioNetwork.setLinkCapacityReportingCriteria() empty params */ TEST_P(RadioNetworkTest, setLinkCapacityReportingCriteria_emptyParams) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_RADIO_ACCESS)) { + GTEST_SKIP() << "Skipping setLinkCapacityReportingCriteria_emptyParams " + "due to undefined FEATURE_TELEPHONY_RADIO_ACCESS"; + } + } + serial = GetRandomSerialNumber(); ndk::ScopedAStatus res = radio_network->setLinkCapacityReportingCriteria( @@ -777,6 +941,13 @@ TEST_P(RadioNetworkTest, setLinkCapacityReportingCriteria_emptyParams) { * Test IRadioNetwork.setLinkCapacityReportingCriteria() for GERAN */ TEST_P(RadioNetworkTest, setLinkCapacityReportingCriteria_Geran) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_RADIO_ACCESS)) { + GTEST_SKIP() << "Skipping setLinkCapacityReportingCriteria_Geran " + "due to undefined FEATURE_TELEPHONY_RADIO_ACCESS"; + } + } + serial = GetRandomSerialNumber(); ndk::ScopedAStatus res = radio_network->setLinkCapacityReportingCriteria( @@ -799,6 +970,13 @@ TEST_P(RadioNetworkTest, setLinkCapacityReportingCriteria_Geran) { * Test IRadioNetwork.setSystemSelectionChannels() for the response returned. */ TEST_P(RadioNetworkTest, setSystemSelectionChannels) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_RADIO_ACCESS)) { + GTEST_SKIP() << "Skipping setSystemSelectionChannels " + "due to undefined FEATURE_TELEPHONY_RADIO_ACCESS"; + } + } + serial = GetRandomSerialNumber(); ndk::ScopedAStatus res = radio_network->getSystemSelectionChannels(serial); EXPECT_EQ(std::cv_status::no_timeout, wait()); @@ -848,6 +1026,13 @@ TEST_P(RadioNetworkTest, setSystemSelectionChannels) { * Test IRadioNetwork.startNetworkScan() for the response returned. */ TEST_P(RadioNetworkTest, startNetworkScan) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_RADIO_ACCESS)) { + GTEST_SKIP() << "Skipping startNetworkScan " + "due to undefined FEATURE_TELEPHONY_RADIO_ACCESS"; + } + } + serial = GetRandomSerialNumber(); NetworkScanRequest request = {.type = NetworkScanRequest::SCAN_TYPE_ONE_SHOT, @@ -890,6 +1075,13 @@ TEST_P(RadioNetworkTest, startNetworkScan) { * Test IRadioNetwork.startNetworkScan() with invalid specifier. */ TEST_P(RadioNetworkTest, startNetworkScan_InvalidArgument) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_RADIO_ACCESS)) { + GTEST_SKIP() << "Skipping startNetworkScan_InvalidArgument " + "due to undefined FEATURE_TELEPHONY_RADIO_ACCESS"; + } + } + serial = GetRandomSerialNumber(); NetworkScanRequest request = {.type = NetworkScanRequest::SCAN_TYPE_ONE_SHOT, .interval = 60}; @@ -915,6 +1107,13 @@ TEST_P(RadioNetworkTest, startNetworkScan_InvalidArgument) { * Test IRadioNetwork.startNetworkScan() with invalid interval (lower boundary). */ TEST_P(RadioNetworkTest, startNetworkScan_InvalidInterval1) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_RADIO_ACCESS)) { + GTEST_SKIP() << "Skipping startNetworkScan_InvalidInterval1 " + "due to undefined FEATURE_TELEPHONY_RADIO_ACCESS"; + } + } + serial = GetRandomSerialNumber(); NetworkScanRequest request = {.type = NetworkScanRequest::SCAN_TYPE_PERIODIC, @@ -944,6 +1143,13 @@ TEST_P(RadioNetworkTest, startNetworkScan_InvalidInterval1) { * Test IRadioNetwork.startNetworkScan() with invalid interval (upper boundary). */ TEST_P(RadioNetworkTest, startNetworkScan_InvalidInterval2) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_RADIO_ACCESS)) { + GTEST_SKIP() << "Skipping startNetworkScan_InvalidInterval2 " + "due to undefined FEATURE_TELEPHONY_RADIO_ACCESS"; + } + } + serial = GetRandomSerialNumber(); NetworkScanRequest request = {.type = NetworkScanRequest::SCAN_TYPE_PERIODIC, @@ -973,6 +1179,13 @@ TEST_P(RadioNetworkTest, startNetworkScan_InvalidInterval2) { * Test IRadioNetwork.startNetworkScan() with invalid max search time (lower boundary). */ TEST_P(RadioNetworkTest, startNetworkScan_InvalidMaxSearchTime1) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_RADIO_ACCESS)) { + GTEST_SKIP() << "Skipping startNetworkScan_InvalidMaxSearchTime1 " + "due to undefined FEATURE_TELEPHONY_RADIO_ACCESS"; + } + } + serial = GetRandomSerialNumber(); NetworkScanRequest request = {.type = NetworkScanRequest::SCAN_TYPE_ONE_SHOT, @@ -1002,6 +1215,13 @@ TEST_P(RadioNetworkTest, startNetworkScan_InvalidMaxSearchTime1) { * Test IRadioNetwork.startNetworkScan() with invalid max search time (upper boundary). */ TEST_P(RadioNetworkTest, startNetworkScan_InvalidMaxSearchTime2) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_RADIO_ACCESS)) { + GTEST_SKIP() << "Skipping startNetworkScan_InvalidMaxSearchTime2 " + "due to undefined FEATURE_TELEPHONY_RADIO_ACCESS"; + } + } + serial = GetRandomSerialNumber(); NetworkScanRequest request = {.type = NetworkScanRequest::SCAN_TYPE_ONE_SHOT, @@ -1031,6 +1251,13 @@ TEST_P(RadioNetworkTest, startNetworkScan_InvalidMaxSearchTime2) { * Test IRadioNetwork.startNetworkScan() with invalid periodicity (lower boundary). */ TEST_P(RadioNetworkTest, startNetworkScan_InvalidPeriodicity1) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_RADIO_ACCESS)) { + GTEST_SKIP() << "Skipping startNetworkScan_InvalidPeriodicity1 " + "due to undefined FEATURE_TELEPHONY_RADIO_ACCESS"; + } + } + serial = GetRandomSerialNumber(); NetworkScanRequest request = {.type = NetworkScanRequest::SCAN_TYPE_ONE_SHOT, @@ -1060,6 +1287,13 @@ TEST_P(RadioNetworkTest, startNetworkScan_InvalidPeriodicity1) { * Test IRadioNetwork.startNetworkScan() with invalid periodicity (upper boundary). */ TEST_P(RadioNetworkTest, startNetworkScan_InvalidPeriodicity2) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_RADIO_ACCESS)) { + GTEST_SKIP() << "Skipping startNetworkScan_InvalidPeriodicity2 " + "due to undefined FEATURE_TELEPHONY_RADIO_ACCESS"; + } + } + serial = GetRandomSerialNumber(); NetworkScanRequest request = {.type = NetworkScanRequest::SCAN_TYPE_ONE_SHOT, @@ -1089,6 +1323,13 @@ TEST_P(RadioNetworkTest, startNetworkScan_InvalidPeriodicity2) { * Test IRadioNetwork.startNetworkScan() with valid periodicity */ TEST_P(RadioNetworkTest, startNetworkScan_GoodRequest1) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_RADIO_ACCESS)) { + GTEST_SKIP() << "Skipping startNetworkScan_GoodRequest1 " + "due to undefined FEATURE_TELEPHONY_RADIO_ACCESS"; + } + } + serial = GetRandomSerialNumber(); NetworkScanRequest request = {.type = NetworkScanRequest::SCAN_TYPE_ONE_SHOT, @@ -1123,6 +1364,13 @@ TEST_P(RadioNetworkTest, startNetworkScan_GoodRequest1) { * Test IRadioNetwork.startNetworkScan() with valid periodicity and plmns */ TEST_P(RadioNetworkTest, startNetworkScan_GoodRequest2) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_RADIO_ACCESS)) { + GTEST_SKIP() << "Skipping startNetworkScan_GoodRequest2 " + "due to undefined FEATURE_TELEPHONY_RADIO_ACCESS"; + } + } + serial = GetRandomSerialNumber(); NetworkScanRequest request = {.type = NetworkScanRequest::SCAN_TYPE_ONE_SHOT, @@ -1158,6 +1406,13 @@ TEST_P(RadioNetworkTest, startNetworkScan_GoodRequest2) { * Test IRadioNetwork.setNetworkSelectionModeManual() for the response returned. */ TEST_P(RadioNetworkTest, setNetworkSelectionModeManual) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_RADIO_ACCESS)) { + GTEST_SKIP() << "Skipping setNetworkSelectionModeManual " + "due to undefined FEATURE_TELEPHONY_RADIO_ACCESS"; + } + } + serial = GetRandomSerialNumber(); // can't camp on nonexistent MCCMNC, so we expect this to fail. @@ -1179,6 +1434,13 @@ TEST_P(RadioNetworkTest, setNetworkSelectionModeManual) { * Test IRadioNetwork.getBarringInfo() for the response returned. */ TEST_P(RadioNetworkTest, getBarringInfo) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_RADIO_ACCESS)) { + GTEST_SKIP() << "Skipping getBarringInfo " + "due to undefined FEATURE_TELEPHONY_RADIO_ACCESS"; + } + } + serial = GetRandomSerialNumber(); ndk::ScopedAStatus res = radio_network->getBarringInfo(serial); EXPECT_EQ(std::cv_status::no_timeout, wait()); @@ -1283,6 +1545,13 @@ TEST_P(RadioNetworkTest, getBarringInfo) { * Test IRadioNetwork.getSignalStrength() for the response returned. */ TEST_P(RadioNetworkTest, getSignalStrength) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_RADIO_ACCESS)) { + GTEST_SKIP() << "Skipping getSignalStrength " + "due to undefined FEATURE_TELEPHONY_RADIO_ACCESS"; + } + } + serial = GetRandomSerialNumber(); radio_network->getSignalStrength(serial); @@ -1302,6 +1571,13 @@ TEST_P(RadioNetworkTest, getSignalStrength) { * Test IRadioNetwork.getCellInfoList() for the response returned. */ TEST_P(RadioNetworkTest, getCellInfoList) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_RADIO_ACCESS)) { + GTEST_SKIP() << "Skipping getCellInfoList " + "due to undefined FEATURE_TELEPHONY_RADIO_ACCESS"; + } + } + serial = GetRandomSerialNumber(); ndk::ScopedAStatus res = radio_network->getCellInfoList(serial); @@ -1320,6 +1596,13 @@ TEST_P(RadioNetworkTest, getCellInfoList) { * Test IRadioNetwork.getVoiceRegistrationState() for the response returned. */ TEST_P(RadioNetworkTest, getVoiceRegistrationState) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_RADIO_ACCESS)) { + GTEST_SKIP() << "Skipping getVoiceRegistrationState " + "due to undefined FEATURE_TELEPHONY_RADIO_ACCESS"; + } + } + serial = GetRandomSerialNumber(); ndk::ScopedAStatus res = radio_network->getVoiceRegistrationState(serial); @@ -1338,6 +1621,13 @@ TEST_P(RadioNetworkTest, getVoiceRegistrationState) { * Test IRadioNetwork.getDataRegistrationState() for the response returned. */ TEST_P(RadioNetworkTest, getDataRegistrationState) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_RADIO_ACCESS)) { + GTEST_SKIP() << "Skipping getDataRegistrationState " + "due to undefined FEATURE_TELEPHONY_RADIO_ACCESS"; + } + } + serial = GetRandomSerialNumber(); ndk::ScopedAStatus res = radio_network->getDataRegistrationState(serial); @@ -1433,6 +1723,13 @@ TEST_P(RadioNetworkTest, getDataRegistrationState) { * Test IRadioNetwork.getAvailableBandModes() for the response returned. */ TEST_P(RadioNetworkTest, getAvailableBandModes) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_RADIO_ACCESS)) { + GTEST_SKIP() << "Skipping getAvailableBandModes " + "due to undefined FEATURE_TELEPHONY_RADIO_ACCESS"; + } + } + serial = GetRandomSerialNumber(); ndk::ScopedAStatus res = radio_network->getAvailableBandModes(serial); @@ -1462,6 +1759,13 @@ TEST_P(RadioNetworkTest, getAvailableBandModes) { * Test IRadioNetwork.setIndicationFilter() */ TEST_P(RadioNetworkTest, setIndicationFilter) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_RADIO_ACCESS)) { + GTEST_SKIP() << "Skipping setIndicationFilter " + "due to undefined FEATURE_TELEPHONY_RADIO_ACCESS"; + } + } + serial = GetRandomSerialNumber(); ndk::ScopedAStatus res = @@ -1480,6 +1784,13 @@ TEST_P(RadioNetworkTest, setIndicationFilter) { * Test IRadioNetwork.setBarringPassword() for the response returned. */ TEST_P(RadioNetworkTest, setBarringPassword) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_RADIO_ACCESS)) { + GTEST_SKIP() << "Skipping setBarringPassword " + "due to undefined FEATURE_TELEPHONY_RADIO_ACCESS"; + } + } + serial = GetRandomSerialNumber(); std::string facility = ""; std::string oldPassword = ""; @@ -1503,6 +1814,13 @@ TEST_P(RadioNetworkTest, setBarringPassword) { * Test IRadioNetwork.setSuppServiceNotifications() for the response returned. */ TEST_P(RadioNetworkTest, setSuppServiceNotifications) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_CALLING)) { + GTEST_SKIP() << "Skipping setSuppServiceNotifications " + "due to undefined FEATURE_TELEPHONY_CALLING"; + } + } + serial = GetRandomSerialNumber(); bool enable = false; @@ -1522,6 +1840,13 @@ TEST_P(RadioNetworkTest, setSuppServiceNotifications) { * Test IRadioNetwork.getImsRegistrationState() for the response returned. */ TEST_P(RadioNetworkTest, getImsRegistrationState) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_IMS)) { + GTEST_SKIP() << "Skipping getImsRegistrationState " + "due to undefined FEATURE_TELEPHONY_IMS"; + } + } + serial = GetRandomSerialNumber(); radio_network->getImsRegistrationState(serial); @@ -1542,6 +1867,13 @@ TEST_P(RadioNetworkTest, getImsRegistrationState) { * Test IRadioNetwork.getOperator() for the response returned. */ TEST_P(RadioNetworkTest, getOperator) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_RADIO_ACCESS)) { + GTEST_SKIP() << "Skipping getOperator " + "due to undefined FEATURE_TELEPHONY_RADIO_ACCESS"; + } + } + serial = GetRandomSerialNumber(); radio_network->getOperator(serial); @@ -1558,6 +1890,13 @@ TEST_P(RadioNetworkTest, getOperator) { * Test IRadioNetwork.getNetworkSelectionMode() for the response returned. */ TEST_P(RadioNetworkTest, getNetworkSelectionMode) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_RADIO_ACCESS)) { + GTEST_SKIP() << "Skipping getNetworkSelectionMode " + "due to undefined FEATURE_TELEPHONY_RADIO_ACCESS"; + } + } + serial = GetRandomSerialNumber(); radio_network->getNetworkSelectionMode(serial); @@ -1574,6 +1913,13 @@ TEST_P(RadioNetworkTest, getNetworkSelectionMode) { * Test IRadioNetwork.setNetworkSelectionModeAutomatic() for the response returned. */ TEST_P(RadioNetworkTest, setNetworkSelectionModeAutomatic) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_RADIO_ACCESS)) { + GTEST_SKIP() << "Skipping setNetworkSelectionModeAutomatic " + "due to undefined FEATURE_TELEPHONY_RADIO_ACCESS"; + } + } + serial = GetRandomSerialNumber(); radio_network->setNetworkSelectionModeAutomatic(serial); @@ -1593,6 +1939,13 @@ TEST_P(RadioNetworkTest, setNetworkSelectionModeAutomatic) { * Test IRadioNetwork.getAvailableNetworks() for the response returned. */ TEST_P(RadioNetworkTest, getAvailableNetworks) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_RADIO_ACCESS)) { + GTEST_SKIP() << "Skipping getAvailableNetworks " + "due to undefined FEATURE_TELEPHONY_RADIO_ACCESS"; + } + } + serial = GetRandomSerialNumber(); radio_network->getAvailableNetworks(serial); @@ -1614,6 +1967,13 @@ TEST_P(RadioNetworkTest, getAvailableNetworks) { * Test IRadioNetwork.setBandMode() for the response returned. */ TEST_P(RadioNetworkTest, setBandMode) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_RADIO_ACCESS)) { + GTEST_SKIP() << "Skipping setBandMode " + "due to undefined FEATURE_TELEPHONY_RADIO_ACCESS"; + } + } + serial = GetRandomSerialNumber(); radio_network->setBandMode(serial, RadioBandMode::BAND_MODE_USA); @@ -1631,6 +1991,13 @@ TEST_P(RadioNetworkTest, setBandMode) { * Test IRadioNetwork.setLocationUpdates() for the response returned. */ TEST_P(RadioNetworkTest, setLocationUpdates) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_RADIO_ACCESS)) { + GTEST_SKIP() << "Skipping setLocationUpdates " + "due to undefined FEATURE_TELEPHONY_RADIO_ACCESS"; + } + } + serial = GetRandomSerialNumber(); radio_network->setLocationUpdates(serial, true); @@ -1648,6 +2015,13 @@ TEST_P(RadioNetworkTest, setLocationUpdates) { * Test IRadioNetwork.setCdmaRoamingPreference() for the response returned. */ TEST_P(RadioNetworkTest, setCdmaRoamingPreference) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_CDMA)) { + GTEST_SKIP() << "Skipping setCdmaRoamingPreference " + "due to undefined FEATURE_TELEPHONY_CDMA"; + } + } + serial = GetRandomSerialNumber(); radio_network->setCdmaRoamingPreference(serial, CdmaRoamingType::HOME_NETWORK); @@ -1666,6 +2040,13 @@ TEST_P(RadioNetworkTest, setCdmaRoamingPreference) { * Test IRadioNetwork.getCdmaRoamingPreference() for the response returned. */ TEST_P(RadioNetworkTest, getCdmaRoamingPreference) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_CDMA)) { + GTEST_SKIP() << "Skipping getCdmaRoamingPreference " + "due to undefined FEATURE_TELEPHONY_CDMA"; + } + } + serial = GetRandomSerialNumber(); radio_network->getCdmaRoamingPreference(serial); @@ -1685,6 +2066,13 @@ TEST_P(RadioNetworkTest, getCdmaRoamingPreference) { * Test IRadioNetwork.getVoiceRadioTechnology() for the response returned. */ TEST_P(RadioNetworkTest, getVoiceRadioTechnology) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_RADIO_ACCESS)) { + GTEST_SKIP() << "Skipping getVoiceRadioTechnology " + "due to undefined FEATURE_TELEPHONY_RADIO_ACCESS"; + } + } + serial = GetRandomSerialNumber(); radio_network->getVoiceRadioTechnology(serial); @@ -1701,6 +2089,13 @@ TEST_P(RadioNetworkTest, getVoiceRadioTechnology) { * Test IRadioNetwork.setCellInfoListRate() for the response returned. */ TEST_P(RadioNetworkTest, setCellInfoListRate) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_RADIO_ACCESS)) { + GTEST_SKIP() << "Skipping setCellInfoListRate " + "due to undefined FEATURE_TELEPHONY_RADIO_ACCESS"; + } + } + serial = GetRandomSerialNumber(); radio_network->setCellInfoListRate(serial, 10); @@ -1718,6 +2113,13 @@ TEST_P(RadioNetworkTest, setCellInfoListRate) { * Test IRadioNetwork.supplyNetworkDepersonalization() for the response returned. */ TEST_P(RadioNetworkTest, supplyNetworkDepersonalization) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_RADIO_ACCESS)) { + GTEST_SKIP() << "Skipping supplyNetworkDepersonalization " + "due to undefined FEATURE_TELEPHONY_RADIO_ACCESS"; + } + } + serial = GetRandomSerialNumber(); radio_network->supplyNetworkDepersonalization(serial, std::string("test")); @@ -1738,6 +2140,13 @@ TEST_P(RadioNetworkTest, supplyNetworkDepersonalization) { * Test IRadioNetwork.setEmergencyMode() for the response returned. */ TEST_P(RadioNetworkTest, setEmergencyMode) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_RADIO_ACCESS)) { + GTEST_SKIP() << "Skipping setEmergencyMode " + "due to undefined FEATURE_TELEPHONY_RADIO_ACCESS"; + } + } + int32_t aidl_version; ndk::ScopedAStatus aidl_status = radio_network->getInterfaceVersion(&aidl_version); ASSERT_OK(aidl_status); @@ -1767,6 +2176,13 @@ TEST_P(RadioNetworkTest, setEmergencyMode) { * Test IRadioNetwork.triggerEmergencyNetworkScan() for the response returned. */ TEST_P(RadioNetworkTest, triggerEmergencyNetworkScan) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_RADIO_ACCESS)) { + GTEST_SKIP() << "Skipping triggerEmergencyNetworkScan " + "due to undefined FEATURE_TELEPHONY_RADIO_ACCESS"; + } + } + int32_t aidl_version; ndk::ScopedAStatus aidl_status = radio_network->getInterfaceVersion(&aidl_version); ASSERT_OK(aidl_status); @@ -1797,6 +2213,13 @@ TEST_P(RadioNetworkTest, triggerEmergencyNetworkScan) { * Test IRadioNetwork.cancelEmergencyNetworkScan() for the response returned. */ TEST_P(RadioNetworkTest, cancelEmergencyNetworkScan) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_RADIO_ACCESS)) { + GTEST_SKIP() << "Skipping cancelEmergencyNetworkScan " + "due to undefined FEATURE_TELEPHONY_RADIO_ACCESS"; + } + } + int32_t aidl_version; ndk::ScopedAStatus aidl_status = radio_network->getInterfaceVersion(&aidl_version); ASSERT_OK(aidl_status); @@ -1821,6 +2244,13 @@ TEST_P(RadioNetworkTest, cancelEmergencyNetworkScan) { * Test IRadioNetwork.exitEmergencyMode() for the response returned. */ TEST_P(RadioNetworkTest, exitEmergencyMode) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_RADIO_ACCESS)) { + GTEST_SKIP() << "Skipping exitEmergencyMode " + "due to undefined FEATURE_TELEPHONY_RADIO_ACCESS"; + } + } + int32_t aidl_version; ndk::ScopedAStatus aidl_status = radio_network->getInterfaceVersion(&aidl_version); ASSERT_OK(aidl_status); @@ -1845,6 +2275,13 @@ TEST_P(RadioNetworkTest, exitEmergencyMode) { * Test IRadioNetwork.setN1ModeEnabled() for the response returned. */ TEST_P(RadioNetworkTest, setN1ModeEnabled) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_RADIO_ACCESS)) { + GTEST_SKIP() << "Skipping setN1ModeEnabled " + "due to undefined FEATURE_TELEPHONY_RADIO_ACCESS"; + } + } + int32_t aidl_version; ndk::ScopedAStatus aidl_status = radio_network->getInterfaceVersion(&aidl_version); ASSERT_OK(aidl_status); @@ -1877,6 +2314,13 @@ TEST_P(RadioNetworkTest, setN1ModeEnabled) { * Test IRadioNetwork.isN1ModeEnabled() for the response returned. */ TEST_P(RadioNetworkTest, isN1ModeEnabled) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_RADIO_ACCESS)) { + GTEST_SKIP() << "Skipping isN1ModeEnabled " + "due to undefined FEATURE_TELEPHONY_RADIO_ACCESS"; + } + } + int32_t aidl_version; ndk::ScopedAStatus aidl_status = radio_network->getInterfaceVersion(&aidl_version); ASSERT_OK(aidl_status); @@ -1908,6 +2352,13 @@ TEST_P(RadioNetworkTest, isN1ModeEnabled) { * Test IRadioNetwork.setNullCipherAndIntegrityEnabled() for the response returned. */ TEST_P(RadioNetworkTest, setNullCipherAndIntegrityEnabled) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_RADIO_ACCESS)) { + GTEST_SKIP() << "Skipping setNullCipherAndIntegrityEnabled " + "due to undefined FEATURE_TELEPHONY_RADIO_ACCESS"; + } + } + int32_t aidl_version; ndk::ScopedAStatus aidl_status = radio_network->getInterfaceVersion(&aidl_version); ASSERT_OK(aidl_status); @@ -1924,15 +2375,29 @@ TEST_P(RadioNetworkTest, setNullCipherAndIntegrityEnabled) { EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_network->rspInfo.type); EXPECT_EQ(serial, radioRsp_network->rspInfo.serial); - ASSERT_TRUE(CheckAnyOfErrors(radioRsp_network->rspInfo.error, - {RadioError::NONE, RadioError::REQUEST_NOT_SUPPORTED, - RadioError::RADIO_NOT_AVAILABLE, RadioError::MODEM_ERR})); + if (aidl_version >= 3 && deviceSupportsFeature(FEATURE_TELEPHONY_RADIO_ACCESS)) { + ASSERT_TRUE(CheckAnyOfErrors( + radioRsp_network->rspInfo.error, + {RadioError::NONE, RadioError::RADIO_NOT_AVAILABLE, RadioError::MODEM_ERR})); + } else { + // For aidl_version 2, API is optional + ASSERT_TRUE(CheckAnyOfErrors(radioRsp_network->rspInfo.error, + {RadioError::NONE, RadioError::RADIO_NOT_AVAILABLE, + RadioError::MODEM_ERR, RadioError::REQUEST_NOT_SUPPORTED})); + } } /** * Test IRadioNetwork.isNullCipherAndIntegrityEnabled() for the response returned. */ TEST_P(RadioNetworkTest, isNullCipherAndIntegrityEnabled) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_RADIO_ACCESS)) { + GTEST_SKIP() << "Skipping isNullCipherAndIntegrityEnabled " + "due to undefined FEATURE_TELEPHONY_RADIO_ACCESS"; + } + } + int32_t aidl_version; ndk::ScopedAStatus aidl_status = radio_network->getInterfaceVersion(&aidl_version); ASSERT_OK(aidl_status); @@ -1951,7 +2416,168 @@ TEST_P(RadioNetworkTest, isNullCipherAndIntegrityEnabled) { EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_network->rspInfo.type); EXPECT_EQ(serial, radioRsp_network->rspInfo.serial); - ASSERT_TRUE(CheckAnyOfErrors(radioRsp_network->rspInfo.error, - {RadioError::NONE, RadioError::RADIO_NOT_AVAILABLE, - RadioError::MODEM_ERR, RadioError::REQUEST_NOT_SUPPORTED})); + if (aidl_version >= 3 && deviceSupportsFeature(FEATURE_TELEPHONY_RADIO_ACCESS)) { + ASSERT_TRUE(CheckAnyOfErrors( + radioRsp_network->rspInfo.error, + {RadioError::NONE, RadioError::RADIO_NOT_AVAILABLE, RadioError::MODEM_ERR})); + } else { + // For aidl_version 2, API is optional + ASSERT_TRUE(CheckAnyOfErrors(radioRsp_network->rspInfo.error, + {RadioError::NONE, RadioError::RADIO_NOT_AVAILABLE, + RadioError::MODEM_ERR, RadioError::REQUEST_NOT_SUPPORTED})); + } +} + +TEST_P(RadioNetworkTest, isCellularIdentifierTransparencyEnabled) { + int32_t aidl_version; + ndk::ScopedAStatus aidl_status = radio_network->getInterfaceVersion(&aidl_version); + ASSERT_OK(aidl_status); + if (aidl_version < 3) { + ALOGI("Skipped the test since" + " isCellularIdentifierTransparencyEnabled is not supported on version < 3."); + GTEST_SKIP(); + } + + serial = GetRandomSerialNumber(); + + ndk::ScopedAStatus res = radio_network->isCellularIdentifierTransparencyEnabled(serial); + ASSERT_OK(res); + + EXPECT_EQ(std::cv_status::no_timeout, wait()); + EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_network->rspInfo.type); + EXPECT_EQ(serial, radioRsp_network->rspInfo.serial); + + ASSERT_TRUE(CheckAnyOfErrors( + radioRsp_network->rspInfo.error, + {RadioError::NONE, RadioError::RADIO_NOT_AVAILABLE, RadioError::MODEM_ERR})); +} + +TEST_P(RadioNetworkTest, setCellularIdentifierTransparencyEnabled) { + int32_t aidl_version; + ndk::ScopedAStatus aidl_status = radio_network->getInterfaceVersion(&aidl_version); + ASSERT_OK(aidl_status); + if (aidl_version < 3) { + ALOGI("Skipped the test since" + " setCellularIdentifierTransparencyEnabled is not supported on version < 3."); + GTEST_SKIP(); + } + + // Get current value + serial = GetRandomSerialNumber(); + radio_network->isCellularIdentifierTransparencyEnabled(serial); + EXPECT_EQ(std::cv_status::no_timeout, wait()); + bool originalTransparencySetting = radioRsp_network->isCellularIdentifierTransparencyEnabled; + + // We want to test flipping the value, so we are going to set it to the opposite of what + // the existing setting is. The test for isCellularIdentifierTransparencyEnabled should check + // for the right default value. + bool valueToSet = !originalTransparencySetting; + serial = GetRandomSerialNumber(); + radio_network->setCellularIdentifierTransparencyEnabled(serial, valueToSet); + EXPECT_EQ(std::cv_status::no_timeout, wait()); + EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_network->rspInfo.type); + EXPECT_EQ(serial, radioRsp_network->rspInfo.serial); + + ASSERT_TRUE(CheckAnyOfErrors( + radioRsp_network->rspInfo.error, + {RadioError::NONE, RadioError::RADIO_NOT_AVAILABLE, RadioError::MODEM_ERR})); + + // Assert the value has changed + serial = GetRandomSerialNumber(); + ndk::ScopedAStatus res = radio_network->isCellularIdentifierTransparencyEnabled(serial); + + ASSERT_OK(res); + EXPECT_EQ(std::cv_status::no_timeout, wait()); + EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_network->rspInfo.type); + EXPECT_EQ(serial, radioRsp_network->rspInfo.serial); + ASSERT_TRUE(CheckAnyOfErrors( + radioRsp_network->rspInfo.error, + {RadioError::NONE, RadioError::RADIO_NOT_AVAILABLE, RadioError::MODEM_ERR})); + EXPECT_EQ(valueToSet, radioRsp_network->isCellularIdentifierTransparencyEnabled); + + // Reset original state + radio_network->setCellularIdentifierTransparencyEnabled(serial, originalTransparencySetting); + EXPECT_EQ(std::cv_status::no_timeout, wait()); + EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_network->rspInfo.type); + EXPECT_EQ(serial, radioRsp_network->rspInfo.serial); +} + +/* + * Test IRadioNetwork.setSecurityAlgorithmsUpdatedEnabled for the response returned. + */ +TEST_P(RadioNetworkTest, setSecurityAlgorithmsUpdatedEnabled) { + int32_t aidl_version; + ndk::ScopedAStatus aidl_status = radio_network->getInterfaceVersion(&aidl_version); + ASSERT_OK(aidl_status); + if (aidl_version < 3) { + ALOGI("Skipped the test since" + " setSecurityAlgorithmsUpdatedEnabled is not supported on version < 3"); + GTEST_SKIP(); + } + + // Get current value + serial = GetRandomSerialNumber(); + radio_network->isSecurityAlgorithmsUpdatedEnabled(serial); + EXPECT_EQ(std::cv_status::no_timeout, wait()); + bool originalSecuritySetting = radioRsp_network->isSecurityAlgorithmsUpdatedEnabled; + + // We want to test flipping the value, so we are going to set it to the opposite of what + // the existing setting is. The test for isSecurityAlgorithmsUpdatedEnabled should check + // for the right default value. + bool valueToSet = !originalSecuritySetting; + serial = GetRandomSerialNumber(); + radio_network->setSecurityAlgorithmsUpdatedEnabled(serial, valueToSet); + EXPECT_EQ(std::cv_status::no_timeout, wait()); + EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_network->rspInfo.type); + EXPECT_EQ(serial, radioRsp_network->rspInfo.serial); + + ASSERT_TRUE(CheckAnyOfErrors( + radioRsp_network->rspInfo.error, + {RadioError::NONE, RadioError::RADIO_NOT_AVAILABLE, RadioError::MODEM_ERR})); + + // Assert the value has changed + serial = GetRandomSerialNumber(); + ndk::ScopedAStatus res = radio_network->isSecurityAlgorithmsUpdatedEnabled(serial); + + ASSERT_OK(res); + EXPECT_EQ(std::cv_status::no_timeout, wait()); + EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_network->rspInfo.type); + EXPECT_EQ(serial, radioRsp_network->rspInfo.serial); + ASSERT_TRUE(CheckAnyOfErrors( + radioRsp_network->rspInfo.error, + {RadioError::NONE, RadioError::RADIO_NOT_AVAILABLE, RadioError::MODEM_ERR})); + EXPECT_EQ(valueToSet, radioRsp_network->isSecurityAlgorithmsUpdatedEnabled); + + // Reset original state + radio_network->setSecurityAlgorithmsUpdatedEnabled(serial, originalSecuritySetting); + EXPECT_EQ(std::cv_status::no_timeout, wait()); + EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_network->rspInfo.type); + EXPECT_EQ(serial, radioRsp_network->rspInfo.serial); +} + +/** + * Test IRadioNetwork.isSecurityAlgorithmsUpdatedEnabled for the response returned. + */ +TEST_P(RadioNetworkTest, isSecurityAlgorithmsUpdatedEnabled) { + int32_t aidl_version; + ndk::ScopedAStatus aidl_status = radio_network->getInterfaceVersion(&aidl_version); + ASSERT_OK(aidl_status); + if (aidl_version < 3) { + ALOGI("Skipped the test since" + " isSecurityAlgorithmsUpdatedEnabled is not supported on version < 3"); + GTEST_SKIP(); + } + + serial = GetRandomSerialNumber(); + + ndk::ScopedAStatus res = radio_network->isSecurityAlgorithmsUpdatedEnabled(serial); + ASSERT_OK(res); + + EXPECT_EQ(std::cv_status::no_timeout, wait()); + EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_network->rspInfo.type); + EXPECT_EQ(serial, radioRsp_network->rspInfo.serial); + + ASSERT_TRUE(CheckAnyOfErrors( + radioRsp_network->rspInfo.error, + {RadioError::NONE, RadioError::RADIO_NOT_AVAILABLE, RadioError::MODEM_ERR})); } diff --git a/radio/aidl/vts/radio_network_utils.h b/radio/aidl/vts/radio_network_utils.h index 8f8f6b070ff0bf93ecba60e5cc76eb4dcd05ce0d..470ee7374b2709fc4266e323ca7b41c4c5011dfa 100644 --- a/radio/aidl/vts/radio_network_utils.h +++ b/radio/aidl/vts/radio_network_utils.h @@ -46,6 +46,8 @@ class RadioNetworkResponse : public BnRadioNetworkResponse { std::vector barringInfoList; UsageSetting usageSetting; std::vector specifiers; + bool isCellularIdentifierTransparencyEnabled; + bool isSecurityAlgorithmsUpdatedEnabled; virtual ndk::ScopedAStatus acknowledgeRequest(int32_t serial) override; @@ -169,6 +171,18 @@ class RadioNetworkResponse : public BnRadioNetworkResponse { const RadioResponseInfo& info, bool isEnabled) override; virtual ndk::ScopedAStatus setN1ModeEnabledResponse(const RadioResponseInfo& info) override; + + virtual ndk::ScopedAStatus setCellularIdentifierTransparencyEnabledResponse( + const RadioResponseInfo& info) override; + + virtual ndk::ScopedAStatus isCellularIdentifierTransparencyEnabledResponse( + const RadioResponseInfo& info, bool /*enabled*/) override; + + virtual ndk::ScopedAStatus isSecurityAlgorithmsUpdatedEnabledResponse( + const RadioResponseInfo& info, bool isEnabled) override; + + virtual ndk::ScopedAStatus setSecurityAlgorithmsUpdatedEnabledResponse( + const RadioResponseInfo& info) override; }; /* Callback class for radio network indication */ @@ -226,6 +240,13 @@ class RadioNetworkIndication : public BnRadioNetworkIndication { virtual ndk::ScopedAStatus emergencyNetworkScanResult( RadioIndicationType type, const EmergencyRegResult& result) override; + + virtual ndk::ScopedAStatus cellularIdentifierDisclosed( + RadioIndicationType type, const CellularIdentifierDisclosure& disclosures) override; + + virtual ndk::ScopedAStatus securityAlgorithmsUpdated( + RadioIndicationType type, + const SecurityAlgorithmUpdate& securityAlgorithmUpdate) override; }; // The main test class for Radio AIDL Network. diff --git a/radio/aidl/vts/radio_sap_test.cpp b/radio/aidl/vts/radio_sap_test.cpp index 9a1c1455762fef19b0922a23f248c3edce7c3567..6d283e96517434341e6c0c4aa9763fe0b06fa9b0 100644 --- a/radio/aidl/vts/radio_sap_test.cpp +++ b/radio/aidl/vts/radio_sap_test.cpp @@ -85,6 +85,13 @@ std::cv_status SapTest::wait() { * Test ISap.connectReq() for the response returned. */ TEST_P(SapTest, connectReq) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_SUBSCRIPTION)) { + GTEST_SKIP() << "Skipping connectReq " + "due to undefined FEATURE_TELEPHONY_SUBSCRIPTION"; + } + } + serial = GetRandomSerialNumber(); int32_t maxMsgSize = 100; @@ -103,6 +110,13 @@ TEST_P(SapTest, connectReq) { * Test ISap.disconnectReq() for the response returned */ TEST_P(SapTest, disconnectReq) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_SUBSCRIPTION)) { + GTEST_SKIP() << "Skipping disconnectReq " + "due to undefined FEATURE_TELEPHONY_SUBSCRIPTION"; + } + } + serial = GetRandomSerialNumber(); ndk::ScopedAStatus res = sap->disconnectReq(serial); @@ -116,6 +130,13 @@ TEST_P(SapTest, disconnectReq) { * Test ISap.apduReq() for the response returned. */ TEST_P(SapTest, apduReq) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_SUBSCRIPTION)) { + GTEST_SKIP() << "Skipping apduReq " + "due to undefined FEATURE_TELEPHONY_SUBSCRIPTION"; + } + } + serial = GetRandomSerialNumber(); SapApduType sapApduType = SapApduType::APDU; std::vector command = {}; @@ -137,6 +158,13 @@ TEST_P(SapTest, apduReq) { * Test ISap.transferAtrReq() for the response returned. */ TEST_P(SapTest, transferAtrReq) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_SUBSCRIPTION)) { + GTEST_SKIP() << "Skipping transferAtrReq " + "due to undefined FEATURE_TELEPHONY_SUBSCRIPTION"; + } + } + serial = GetRandomSerialNumber(); ndk::ScopedAStatus res = sap->transferAtrReq(serial); @@ -155,6 +183,13 @@ TEST_P(SapTest, transferAtrReq) { * Test ISap.powerReq() for the response returned. */ TEST_P(SapTest, powerReq) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_SUBSCRIPTION)) { + GTEST_SKIP() << "Skipping powerReq " + "due to undefined FEATURE_TELEPHONY_SUBSCRIPTION"; + } + } + serial = GetRandomSerialNumber(); bool state = true; @@ -175,6 +210,13 @@ TEST_P(SapTest, powerReq) { * Test ISap.resetSimReq() for the response returned. */ TEST_P(SapTest, resetSimReq) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_SUBSCRIPTION)) { + GTEST_SKIP() << "Skipping resetSimReq " + "due to undefined FEATURE_TELEPHONY_SUBSCRIPTION"; + } + } + serial = GetRandomSerialNumber(); ndk::ScopedAStatus res = sap->resetSimReq(serial); @@ -194,6 +236,13 @@ TEST_P(SapTest, resetSimReq) { * Test ISap.transferCardReaderStatusReq() for the response returned. */ TEST_P(SapTest, transferCardReaderStatusReq) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_SUBSCRIPTION)) { + GTEST_SKIP() << "Skipping transferCardReaderStatusReq " + "due to undefined FEATURE_TELEPHONY_SUBSCRIPTION"; + } + } + serial = GetRandomSerialNumber(); ndk::ScopedAStatus res = sap->transferCardReaderStatusReq(serial); @@ -211,6 +260,13 @@ TEST_P(SapTest, transferCardReaderStatusReq) { * Test ISap.setTransferProtocolReq() for the response returned. */ TEST_P(SapTest, setTransferProtocolReq) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_SUBSCRIPTION)) { + GTEST_SKIP() << "Skipping setTransferProtocolReq " + "due to undefined FEATURE_TELEPHONY_SUBSCRIPTION"; + } + } + serial = GetRandomSerialNumber(); SapTransferProtocol sapTransferProtocol = SapTransferProtocol::T0; diff --git a/radio/aidl/vts/radio_sim_test.cpp b/radio/aidl/vts/radio_sim_test.cpp index d90658893bd0c49f7cfcd628f4c4f1d973806a01..06654c2982f766cf9d3453180ddda15371c89c1c 100644 --- a/radio/aidl/vts/radio_sim_test.cpp +++ b/radio/aidl/vts/radio_sim_test.cpp @@ -65,6 +65,13 @@ void RadioSimTest::updateSimCardStatus() { * Test IRadioSim.setSimCardPower() for the response returned. */ TEST_P(RadioSimTest, setSimCardPower) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_SUBSCRIPTION)) { + GTEST_SKIP() << "Skipping setSimCardPower " + "due to undefined FEATURE_TELEPHONY_SUBSCRIPTION"; + } + } + /* Test setSimCardPower power down */ serial = GetRandomSerialNumber(); radio_sim->setSimCardPower(serial, CardPowerState::POWER_DOWN); @@ -120,6 +127,13 @@ TEST_P(RadioSimTest, setSimCardPower) { * Test IRadioSim.setCarrierInfoForImsiEncryption() for the response returned. */ TEST_P(RadioSimTest, setCarrierInfoForImsiEncryption) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_SUBSCRIPTION)) { + GTEST_SKIP() << "Skipping setCarrierInfoForImsiEncryption " + "due to undefined FEATURE_TELEPHONY_SUBSCRIPTION"; + } + } + serial = GetRandomSerialNumber(); ImsiEncryptionInfo imsiInfo; imsiInfo.mcc = "310"; @@ -144,6 +158,13 @@ TEST_P(RadioSimTest, setCarrierInfoForImsiEncryption) { * Test IRadioSim.getSimPhonebookRecords() for the response returned. */ TEST_P(RadioSimTest, getSimPhonebookRecords) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_SUBSCRIPTION)) { + GTEST_SKIP() << "Skipping getSimPhonebookRecords " + "due to undefined FEATURE_TELEPHONY_SUBSCRIPTION"; + } + } + serial = GetRandomSerialNumber(); radio_sim->getSimPhonebookRecords(serial); EXPECT_EQ(std::cv_status::no_timeout, wait()); @@ -167,6 +188,13 @@ TEST_P(RadioSimTest, getSimPhonebookRecords) { * Test IRadioSim.getSimPhonebookCapacity for the response returned. */ TEST_P(RadioSimTest, getSimPhonebookCapacity) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_SUBSCRIPTION)) { + GTEST_SKIP() << "Skipping getSimPhonebookCapacity " + "due to undefined FEATURE_TELEPHONY_SUBSCRIPTION"; + } + } + serial = GetRandomSerialNumber(); radio_sim->getSimPhonebookCapacity(serial); EXPECT_EQ(std::cv_status::no_timeout, wait()); @@ -207,6 +235,13 @@ TEST_P(RadioSimTest, getSimPhonebookCapacity) { * Test IRadioSim.updateSimPhonebookRecords() for the response returned. */ TEST_P(RadioSimTest, updateSimPhonebookRecords) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_SUBSCRIPTION)) { + GTEST_SKIP() << "Skipping updateSimPhonebookRecords " + "due to undefined FEATURE_TELEPHONY_SUBSCRIPTION"; + } + } + serial = GetRandomSerialNumber(); radio_sim->getSimPhonebookCapacity(serial); EXPECT_EQ(std::cv_status::no_timeout, wait()); @@ -271,6 +306,13 @@ TEST_P(RadioSimTest, updateSimPhonebookRecords) { * For SIM ABSENT case. */ TEST_P(RadioSimTest, togglingUiccApplicationsSimAbsent) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_SUBSCRIPTION)) { + GTEST_SKIP() << "Skipping togglingUiccApplicationsSimAbsent " + "due to undefined FEATURE_TELEPHONY_SUBSCRIPTION"; + } + } + // This test case only test SIM ABSENT case. if (cardStatus.cardState != CardStatus::STATE_ABSENT) return; @@ -298,6 +340,13 @@ TEST_P(RadioSimTest, togglingUiccApplicationsSimAbsent) { * For SIM PRESENT case. */ TEST_P(RadioSimTest, togglingUiccApplicationsSimPresent) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_SUBSCRIPTION)) { + GTEST_SKIP() << "Skipping togglingUiccApplicationsSimPresent " + "due to undefined FEATURE_TELEPHONY_SUBSCRIPTION"; + } + } + // This test case only test SIM ABSENT case. if (cardStatus.cardState != CardStatus::STATE_PRESENT) return; if (cardStatus.applications.size() == 0) return; @@ -345,6 +394,13 @@ TEST_P(RadioSimTest, togglingUiccApplicationsSimPresent) { * Test IRadioSim.areUiccApplicationsEnabled() for the response returned. */ TEST_P(RadioSimTest, areUiccApplicationsEnabled) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_SUBSCRIPTION)) { + GTEST_SKIP() << "Skipping areUiccApplicationsEnabled " + "due to undefined FEATURE_TELEPHONY_SUBSCRIPTION"; + } + } + // Disable Uicc applications. serial = GetRandomSerialNumber(); radio_sim->areUiccApplicationsEnabled(serial); @@ -365,6 +421,13 @@ TEST_P(RadioSimTest, areUiccApplicationsEnabled) { * Test IRadioSim.getAllowedCarriers() for the response returned. */ TEST_P(RadioSimTest, getAllowedCarriers) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_SUBSCRIPTION)) { + GTEST_SKIP() << "Skipping getAllowedCarriers " + "due to undefined FEATURE_TELEPHONY_SUBSCRIPTION"; + } + } + serial = GetRandomSerialNumber(); radio_sim->getAllowedCarriers(serial); @@ -380,6 +443,13 @@ TEST_P(RadioSimTest, getAllowedCarriers) { * Test IRadioSim.setAllowedCarriers() for the response returned. */ TEST_P(RadioSimTest, setAllowedCarriers) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_SUBSCRIPTION)) { + GTEST_SKIP() << "Skipping setAllowedCarriers " + "due to undefined FEATURE_TELEPHONY_SUBSCRIPTION"; + } + } + serial = GetRandomSerialNumber(); CarrierRestrictions carrierRestrictions; memset(&carrierRestrictions, 0, sizeof(carrierRestrictions)); @@ -479,6 +549,13 @@ TEST_P(RadioSimTest, setAllowedCarriers) { * Test IRadioSim.getIccCardStatus() for the response returned. */ TEST_P(RadioSimTest, getIccCardStatus) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_SUBSCRIPTION)) { + GTEST_SKIP() << "Skipping getIccCardStatus " + "due to undefined FEATURE_TELEPHONY_SUBSCRIPTION"; + } + } + EXPECT_LE(cardStatus.applications.size(), RadioConst::CARD_MAX_APPS); EXPECT_LT(cardStatus.gsmUmtsSubscriptionAppIndex, RadioConst::CARD_MAX_APPS); EXPECT_LT(cardStatus.cdmaSubscriptionAppIndex, RadioConst::CARD_MAX_APPS); @@ -489,6 +566,13 @@ TEST_P(RadioSimTest, getIccCardStatus) { * Test IRadioSim.supplyIccPinForApp() for the response returned */ TEST_P(RadioSimTest, supplyIccPinForApp) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_SUBSCRIPTION)) { + GTEST_SKIP() << "Skipping supplyIccPinForApp " + "due to undefined FEATURE_TELEPHONY_SUBSCRIPTION"; + } + } + serial = GetRandomSerialNumber(); // Pass wrong password and check PASSWORD_INCORRECT returned for 3GPP and @@ -514,6 +598,13 @@ TEST_P(RadioSimTest, supplyIccPinForApp) { * Test IRadioSim.supplyIccPukForApp() for the response returned. */ TEST_P(RadioSimTest, supplyIccPukForApp) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_SUBSCRIPTION)) { + GTEST_SKIP() << "Skipping supplyIccPukForApp " + "due to undefined FEATURE_TELEPHONY_SUBSCRIPTION"; + } + } + serial = GetRandomSerialNumber(); // Pass wrong password and check PASSWORD_INCORRECT returned for 3GPP and @@ -539,6 +630,13 @@ TEST_P(RadioSimTest, supplyIccPukForApp) { * Test IRadioSim.supplyIccPin2ForApp() for the response returned. */ TEST_P(RadioSimTest, supplyIccPin2ForApp) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_SUBSCRIPTION)) { + GTEST_SKIP() << "Skipping supplyIccPin2ForApp " + "due to undefined FEATURE_TELEPHONY_SUBSCRIPTION"; + } + } + serial = GetRandomSerialNumber(); // Pass wrong password and check PASSWORD_INCORRECT returned for 3GPP and @@ -565,6 +663,13 @@ TEST_P(RadioSimTest, supplyIccPin2ForApp) { * Test IRadioSim.supplyIccPuk2ForApp() for the response returned. */ TEST_P(RadioSimTest, supplyIccPuk2ForApp) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_SUBSCRIPTION)) { + GTEST_SKIP() << "Skipping supplyIccPuk2ForApp " + "due to undefined FEATURE_TELEPHONY_SUBSCRIPTION"; + } + } + serial = GetRandomSerialNumber(); // Pass wrong password and check PASSWORD_INCORRECT returned for 3GPP and @@ -590,6 +695,13 @@ TEST_P(RadioSimTest, supplyIccPuk2ForApp) { * Test IRadioSim.changeIccPinForApp() for the response returned. */ TEST_P(RadioSimTest, changeIccPinForApp) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_SUBSCRIPTION)) { + GTEST_SKIP() << "Skipping changeIccPinForApp " + "due to undefined FEATURE_TELEPHONY_SUBSCRIPTION"; + } + } + serial = GetRandomSerialNumber(); // Pass wrong password and check PASSWORD_INCORRECT returned for 3GPP and @@ -615,6 +727,13 @@ TEST_P(RadioSimTest, changeIccPinForApp) { * Test IRadioSim.changeIccPin2ForApp() for the response returned. */ TEST_P(RadioSimTest, changeIccPin2ForApp) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_SUBSCRIPTION)) { + GTEST_SKIP() << "Skipping changeIccPin2ForApp " + "due to undefined FEATURE_TELEPHONY_SUBSCRIPTION"; + } + } + serial = GetRandomSerialNumber(); // Pass wrong password and check PASSWORD_INCORRECT returned for 3GPP and @@ -641,6 +760,13 @@ TEST_P(RadioSimTest, changeIccPin2ForApp) { * Test IRadioSim.getImsiForApp() for the response returned. */ TEST_P(RadioSimTest, getImsiForApp) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_SUBSCRIPTION)) { + GTEST_SKIP() << "Skipping getImsiForApp " + "due to undefined FEATURE_TELEPHONY_SUBSCRIPTION"; + } + } + serial = GetRandomSerialNumber(); // Check success returned while getting imsi for 3GPP and 3GPP2 apps only @@ -670,6 +796,13 @@ TEST_P(RadioSimTest, getImsiForApp) { * Test IRadioSim.iccIoForApp() for the response returned. */ TEST_P(RadioSimTest, iccIoForApp) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_SUBSCRIPTION)) { + GTEST_SKIP() << "Skipping iccIoForApp " + "due to undefined FEATURE_TELEPHONY_SUBSCRIPTION"; + } + } + serial = GetRandomSerialNumber(); for (int i = 0; i < (int)cardStatus.applications.size(); i++) { @@ -695,6 +828,13 @@ TEST_P(RadioSimTest, iccIoForApp) { * Test IRadioSim.iccTransmitApduBasicChannel() for the response returned. */ TEST_P(RadioSimTest, iccTransmitApduBasicChannel) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_SUBSCRIPTION)) { + GTEST_SKIP() << "Skipping iccTransmitApduBasicChannel " + "due to undefined FEATURE_TELEPHONY_SUBSCRIPTION"; + } + } + serial = GetRandomSerialNumber(); SimApdu msg; memset(&msg, 0, sizeof(msg)); @@ -710,6 +850,13 @@ TEST_P(RadioSimTest, iccTransmitApduBasicChannel) { * Test IRadioSim.iccOpenLogicalChannel() for the response returned. */ TEST_P(RadioSimTest, iccOpenLogicalChannel) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_SUBSCRIPTION)) { + GTEST_SKIP() << "Skipping iccOpenLogicalChannel " + "due to undefined FEATURE_TELEPHONY_SUBSCRIPTION"; + } + } + serial = GetRandomSerialNumber(); int p2 = 0x04; // Specified in ISO 7816-4 clause 7.1.1 0x04 means that FCP template is requested. @@ -725,6 +872,13 @@ TEST_P(RadioSimTest, iccOpenLogicalChannel) { * Test IRadioSim.iccCloseLogicalChannel() for the response returned. */ TEST_P(RadioSimTest, iccCloseLogicalChannel) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_SUBSCRIPTION)) { + GTEST_SKIP() << "Skipping iccCloseLogicalChannel " + "due to undefined FEATURE_TELEPHONY_SUBSCRIPTION"; + } + } + serial = GetRandomSerialNumber(); // Try closing invalid channel and check INVALID_ARGUMENTS returned as error radio_sim->iccCloseLogicalChannel(serial, 0); @@ -739,6 +893,13 @@ TEST_P(RadioSimTest, iccCloseLogicalChannel) { * Test IRadioSim.iccCloseLogicalChannelWithSessionInfo() for the response returned. */ TEST_P(RadioSimTest, iccCloseLogicalChannelWithSessionInfo) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_SUBSCRIPTION)) { + GTEST_SKIP() << "Skipping iccCloseLogicalChannelWithSessionInfo " + "due to undefined FEATURE_TELEPHONY_SUBSCRIPTION"; + } + } + int32_t aidl_version; ndk::ScopedAStatus aidl_status = radio_sim->getInterfaceVersion(&aidl_version); ASSERT_OK(aidl_status); @@ -766,6 +927,13 @@ TEST_P(RadioSimTest, iccCloseLogicalChannelWithSessionInfo) { * Test IRadioSim.iccTransmitApduLogicalChannel() for the response returned. */ TEST_P(RadioSimTest, iccTransmitApduLogicalChannel) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_SUBSCRIPTION)) { + GTEST_SKIP() << "Skipping iccTransmitApduLogicalChannel " + "due to undefined FEATURE_TELEPHONY_SUBSCRIPTION"; + } + } + serial = GetRandomSerialNumber(); SimApdu msg; memset(&msg, 0, sizeof(msg)); @@ -781,6 +949,13 @@ TEST_P(RadioSimTest, iccTransmitApduLogicalChannel) { * Test IRadioSim.requestIccSimAuthentication() for the response returned. */ TEST_P(RadioSimTest, requestIccSimAuthentication) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_SUBSCRIPTION)) { + GTEST_SKIP() << "Skipping requestIccSimAuthentication " + "due to undefined FEATURE_TELEPHONY_SUBSCRIPTION"; + } + } + serial = GetRandomSerialNumber(); // Pass wrong challenge string and check RadioError::INVALID_ARGUMENTS @@ -801,6 +976,13 @@ TEST_P(RadioSimTest, requestIccSimAuthentication) { * Test IRadioSim.getFacilityLockForApp() for the response returned. */ TEST_P(RadioSimTest, getFacilityLockForApp) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_SUBSCRIPTION)) { + GTEST_SKIP() << "Skipping getFacilityLockForApp " + "due to undefined FEATURE_TELEPHONY_SUBSCRIPTION"; + } + } + serial = GetRandomSerialNumber(); std::string facility = ""; std::string password = ""; @@ -824,6 +1006,13 @@ TEST_P(RadioSimTest, getFacilityLockForApp) { * Test IRadioSim.setFacilityLockForApp() for the response returned. */ TEST_P(RadioSimTest, setFacilityLockForApp) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_SUBSCRIPTION)) { + GTEST_SKIP() << "Skipping setFacilityLockForApp " + "due to undefined FEATURE_TELEPHONY_SUBSCRIPTION"; + } + } + serial = GetRandomSerialNumber(); std::string facility = ""; bool lockState = false; @@ -848,6 +1037,13 @@ TEST_P(RadioSimTest, setFacilityLockForApp) { * Test IRadioSim.getCdmaSubscription() for the response returned. */ TEST_P(RadioSimTest, getCdmaSubscription) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_CDMA)) { + GTEST_SKIP() << "Skipping getCdmaSubscription " + "due to undefined FEATURE_TELEPHONY_CDMA"; + } + } + serial = GetRandomSerialNumber(); radio_sim->getCdmaSubscription(serial); @@ -866,6 +1062,13 @@ TEST_P(RadioSimTest, getCdmaSubscription) { * Test IRadioSim.getCdmaSubscriptionSource() for the response returned. */ TEST_P(RadioSimTest, getCdmaSubscriptionSource) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_CDMA)) { + GTEST_SKIP() << "Skipping getCdmaSubscriptionSource " + "due to undefined FEATURE_TELEPHONY_CDMA"; + } + } + serial = GetRandomSerialNumber(); radio_sim->getCdmaSubscriptionSource(serial); @@ -884,6 +1087,13 @@ TEST_P(RadioSimTest, getCdmaSubscriptionSource) { * Test IRadioSim.setCdmaSubscriptionSource() for the response returned. */ TEST_P(RadioSimTest, setCdmaSubscriptionSource) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_CDMA)) { + GTEST_SKIP() << "Skipping setCdmaSubscriptionSource " + "due to undefined FEATURE_TELEPHONY_CDMA"; + } + } + serial = GetRandomSerialNumber(); radio_sim->setCdmaSubscriptionSource(serial, CdmaSubscriptionSource::RUIM_SIM); @@ -903,6 +1113,13 @@ TEST_P(RadioSimTest, setCdmaSubscriptionSource) { * Test IRadioSim.setUiccSubscription() for the response returned. */ TEST_P(RadioSimTest, setUiccSubscription) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_SUBSCRIPTION)) { + GTEST_SKIP() << "Skipping setUiccSubscription " + "due to undefined FEATURE_TELEPHONY_SUBSCRIPTION"; + } + } + serial = GetRandomSerialNumber(); SelectUiccSub item; memset(&item, 0, sizeof(item)); @@ -925,6 +1142,13 @@ TEST_P(RadioSimTest, setUiccSubscription) { * Test IRadioSim.sendEnvelope() for the response returned. */ TEST_P(RadioSimTest, sendEnvelope) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_SUBSCRIPTION)) { + GTEST_SKIP() << "Skipping sendEnvelope " + "due to undefined FEATURE_TELEPHONY_SUBSCRIPTION"; + } + } + serial = GetRandomSerialNumber(); // Test with sending empty string @@ -948,6 +1172,13 @@ TEST_P(RadioSimTest, sendEnvelope) { * Test IRadioSim.sendTerminalResponseToSim() for the response returned. */ TEST_P(RadioSimTest, sendTerminalResponseToSim) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_SUBSCRIPTION)) { + GTEST_SKIP() << "Skipping sendTerminalResponseToSim " + "due to undefined FEATURE_TELEPHONY_SUBSCRIPTION"; + } + } + serial = GetRandomSerialNumber(); // Test with sending empty string @@ -971,6 +1202,13 @@ TEST_P(RadioSimTest, sendTerminalResponseToSim) { * Test IRadioSim.reportStkServiceIsRunning() for the response returned. */ TEST_P(RadioSimTest, reportStkServiceIsRunning) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_SUBSCRIPTION)) { + GTEST_SKIP() << "Skipping reportStkServiceIsRunning " + "due to undefined FEATURE_TELEPHONY_SUBSCRIPTION"; + } + } + serial = GetRandomSerialNumber(); radio_sim->reportStkServiceIsRunning(serial); @@ -990,6 +1228,13 @@ TEST_P(RadioSimTest, reportStkServiceIsRunning) { * string. */ TEST_P(RadioSimTest, sendEnvelopeWithStatus) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_SUBSCRIPTION)) { + GTEST_SKIP() << "Skipping sendEnvelopeWithStatus " + "due to undefined FEATURE_TELEPHONY_SUBSCRIPTION"; + } + } + serial = GetRandomSerialNumber(); // Test with sending empty string diff --git a/radio/aidl/vts/radio_voice_test.cpp b/radio/aidl/vts/radio_voice_test.cpp index 397c417efa589ebe1625ddb1aaa69b60aaf6ce87..6c68fd580a86eacfd26006d6b642c3b6f589f060 100644 --- a/radio/aidl/vts/radio_voice_test.cpp +++ b/radio/aidl/vts/radio_voice_test.cpp @@ -93,15 +93,22 @@ ndk::ScopedAStatus RadioVoiceTest::clearPotentialEstablishedCalls() { * Test IRadioVoice.emergencyDial() for the response returned. */ TEST_P(RadioVoiceTest, emergencyDial) { - if (!deviceSupportsFeature(FEATURE_VOICE_CALL)) { - ALOGI("Skipping emergencyDial because voice call is not supported in device"); - return; - } else if (!deviceSupportsFeature(FEATURE_TELEPHONY_GSM) && - !deviceSupportsFeature(FEATURE_TELEPHONY_CDMA)) { - ALOGI("Skipping emergencyDial because gsm/cdma radio is not supported in device"); - return; + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_CALLING)) { + GTEST_SKIP() << "Skipping emergencyDial " + "due to undefined FEATURE_TELEPHONY_CALLING"; + } } else { - ALOGI("Running emergencyDial because voice call is supported in device"); + if (!deviceSupportsFeature(FEATURE_VOICE_CALL)) { + ALOGI("Skipping emergencyDial because voice call is not supported in device"); + return; + } else if (!deviceSupportsFeature(FEATURE_TELEPHONY_GSM) && + !deviceSupportsFeature(FEATURE_TELEPHONY_CDMA)) { + ALOGI("Skipping emergencyDial because gsm/cdma radio is not supported in device"); + return; + } else { + ALOGI("Running emergencyDial because voice call is supported in device"); + } } serial = GetRandomSerialNumber(); @@ -147,15 +154,22 @@ TEST_P(RadioVoiceTest, emergencyDial) { * Test IRadioVoice.emergencyDial() with specified service and its response returned. */ TEST_P(RadioVoiceTest, emergencyDial_withServices) { - if (!deviceSupportsFeature(FEATURE_VOICE_CALL)) { - ALOGI("Skipping emergencyDial because voice call is not supported in device"); - return; - } else if (!deviceSupportsFeature(FEATURE_TELEPHONY_GSM) && - !deviceSupportsFeature(FEATURE_TELEPHONY_CDMA)) { - ALOGI("Skipping emergencyDial because gsm/cdma radio is not supported in device"); - return; + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_CALLING)) { + GTEST_SKIP() << "Skipping emergencyDial_withServices " + "due to undefined FEATURE_TELEPHONY_CALLING"; + } } else { - ALOGI("Running emergencyDial because voice call is supported in device"); + if (!deviceSupportsFeature(FEATURE_VOICE_CALL)) { + ALOGI("Skipping emergencyDial because voice call is not supported in device"); + return; + } else if (!deviceSupportsFeature(FEATURE_TELEPHONY_GSM) && + !deviceSupportsFeature(FEATURE_TELEPHONY_CDMA)) { + ALOGI("Skipping emergencyDial because gsm/cdma radio is not supported in device"); + return; + } else { + ALOGI("Running emergencyDial because voice call is supported in device"); + } } serial = GetRandomSerialNumber(); @@ -201,15 +215,22 @@ TEST_P(RadioVoiceTest, emergencyDial_withServices) { * Test IRadioVoice.emergencyDial() with known emergency call routing and its response returned. */ TEST_P(RadioVoiceTest, emergencyDial_withEmergencyRouting) { - if (!deviceSupportsFeature(FEATURE_VOICE_CALL)) { - ALOGI("Skipping emergencyDial because voice call is not supported in device"); - return; - } else if (!deviceSupportsFeature(FEATURE_TELEPHONY_GSM) && - !deviceSupportsFeature(FEATURE_TELEPHONY_CDMA)) { - ALOGI("Skipping emergencyDial because gsm/cdma radio is not supported in device"); - return; + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_CALLING)) { + GTEST_SKIP() << "Skipping emergencyDial_withEmergencyRouting " + "due to undefined FEATURE_TELEPHONY_CALLING"; + } } else { - ALOGI("Running emergencyDial because voice call is supported in device"); + if (!deviceSupportsFeature(FEATURE_VOICE_CALL)) { + ALOGI("Skipping emergencyDial because voice call is not supported in device"); + return; + } else if (!deviceSupportsFeature(FEATURE_TELEPHONY_GSM) && + !deviceSupportsFeature(FEATURE_TELEPHONY_CDMA)) { + ALOGI("Skipping emergencyDial because gsm/cdma radio is not supported in device"); + return; + } else { + ALOGI("Running emergencyDial because voice call is supported in device"); + } } serial = GetRandomSerialNumber(); @@ -256,6 +277,13 @@ TEST_P(RadioVoiceTest, emergencyDial_withEmergencyRouting) { * Test IRadioVoice.getCurrentCalls() for the response returned. */ TEST_P(RadioVoiceTest, getCurrentCalls) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_CALLING)) { + GTEST_SKIP() << "Skipping getCurrentCalls " + "due to undefined FEATURE_TELEPHONY_CALLING"; + } + } + serial = GetRandomSerialNumber(); radio_voice->getCurrentCalls(serial); EXPECT_EQ(std::cv_status::no_timeout, wait()); @@ -268,6 +296,13 @@ TEST_P(RadioVoiceTest, getCurrentCalls) { * Test IRadioVoice.getClir() for the response returned. */ TEST_P(RadioVoiceTest, getClir) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_CALLING)) { + GTEST_SKIP() << "Skipping getClir " + "due to undefined FEATURE_TELEPHONY_CALLING"; + } + } + serial = GetRandomSerialNumber(); radio_voice->getClir(serial); @@ -286,6 +321,13 @@ TEST_P(RadioVoiceTest, getClir) { * Test IRadioVoice.setClir() for the response returned. */ TEST_P(RadioVoiceTest, setClir) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_CALLING)) { + GTEST_SKIP() << "Skipping setClir " + "due to undefined FEATURE_TELEPHONY_CALLING"; + } + } + serial = GetRandomSerialNumber(); int32_t status = 1; @@ -304,6 +346,13 @@ TEST_P(RadioVoiceTest, setClir) { * Test IRadioVoice.getClip() for the response returned. */ TEST_P(RadioVoiceTest, getClip) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_CALLING)) { + GTEST_SKIP() << "Skipping getClip " + "due to undefined FEATURE_TELEPHONY_CALLING"; + } + } + serial = GetRandomSerialNumber(); radio_voice->getClip(serial); @@ -322,6 +371,13 @@ TEST_P(RadioVoiceTest, getClip) { * Test IRadioVoice.getTtyMode() for the response returned. */ TEST_P(RadioVoiceTest, getTtyMode) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_CALLING)) { + GTEST_SKIP() << "Skipping getTtyMode " + "due to undefined FEATURE_TELEPHONY_CALLING"; + } + } + serial = GetRandomSerialNumber(); radio_voice->getTtyMode(serial); @@ -338,6 +394,13 @@ TEST_P(RadioVoiceTest, getTtyMode) { * Test IRadioVoice.setTtyMode() for the response returned. */ TEST_P(RadioVoiceTest, setTtyMode) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_CALLING)) { + GTEST_SKIP() << "Skipping setTtyMode " + "due to undefined FEATURE_TELEPHONY_CALLING"; + } + } + serial = GetRandomSerialNumber(); radio_voice->setTtyMode(serial, TtyMode::OFF); @@ -354,6 +417,13 @@ TEST_P(RadioVoiceTest, setTtyMode) { * Test IRadioVoice.setPreferredVoicePrivacy() for the response returned. */ TEST_P(RadioVoiceTest, setPreferredVoicePrivacy) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_CALLING)) { + GTEST_SKIP() << "Skipping setPreferredVoicePrivacy " + "due to undefined FEATURE_TELEPHONY_CALLING"; + } + } + serial = GetRandomSerialNumber(); radio_voice->setPreferredVoicePrivacy(serial, true); @@ -371,6 +441,13 @@ TEST_P(RadioVoiceTest, setPreferredVoicePrivacy) { * Test IRadioVoice.getPreferredVoicePrivacy() for the response returned. */ TEST_P(RadioVoiceTest, getPreferredVoicePrivacy) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_CALLING)) { + GTEST_SKIP() << "Skipping getPreferredVoicePrivacy " + "due to undefined FEATURE_TELEPHONY_CALLING"; + } + } + serial = GetRandomSerialNumber(); radio_voice->getPreferredVoicePrivacy(serial); @@ -388,6 +465,13 @@ TEST_P(RadioVoiceTest, getPreferredVoicePrivacy) { * Test IRadioVoice.exitEmergencyCallbackMode() for the response returned. */ TEST_P(RadioVoiceTest, exitEmergencyCallbackMode) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_CALLING)) { + GTEST_SKIP() << "Skipping exitEmergencyCallbackMode " + "due to undefined FEATURE_TELEPHONY_CALLING"; + } + } + serial = GetRandomSerialNumber(); radio_voice->exitEmergencyCallbackMode(serial); @@ -406,6 +490,13 @@ TEST_P(RadioVoiceTest, exitEmergencyCallbackMode) { * Test IRadioVoice.handleStkCallSetupRequestFromSim() for the response returned. */ TEST_P(RadioVoiceTest, handleStkCallSetupRequestFromSim) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_CALLING)) { + GTEST_SKIP() << "Skipping handleStkCallSetupRequestFromSim " + "due to undefined FEATURE_TELEPHONY_CALLING"; + } + } + serial = GetRandomSerialNumber(); bool accept = false; @@ -427,6 +518,13 @@ TEST_P(RadioVoiceTest, handleStkCallSetupRequestFromSim) { * Test IRadioVoice.dial() for the response returned. */ TEST_P(RadioVoiceTest, dial) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_CALLING)) { + GTEST_SKIP() << "Skipping dial " + "due to undefined FEATURE_TELEPHONY_CALLING"; + } + } + serial = GetRandomSerialNumber(); Dial dialInfo; @@ -454,6 +552,13 @@ TEST_P(RadioVoiceTest, dial) { * Test IRadioVoice.hangup() for the response returned. */ TEST_P(RadioVoiceTest, hangup) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_CALLING)) { + GTEST_SKIP() << "Skipping hangup " + "due to undefined FEATURE_TELEPHONY_CALLING"; + } + } + serial = GetRandomSerialNumber(); radio_voice->hangup(serial, 1); @@ -473,6 +578,13 @@ TEST_P(RadioVoiceTest, hangup) { * Test IRadioVoice.hangupWaitingOrBackground() for the response returned. */ TEST_P(RadioVoiceTest, hangupWaitingOrBackground) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_CALLING)) { + GTEST_SKIP() << "Skipping hangupWaitingOrBackground " + "due to undefined FEATURE_TELEPHONY_CALLING"; + } + } + serial = GetRandomSerialNumber(); radio_voice->hangupWaitingOrBackground(serial); @@ -491,6 +603,13 @@ TEST_P(RadioVoiceTest, hangupWaitingOrBackground) { * Test IRadioVoice.hangupForegroundResumeBackground() for the response returned. */ TEST_P(RadioVoiceTest, hangupForegroundResumeBackground) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_CALLING)) { + GTEST_SKIP() << "Skipping hangupForegroundResumeBackground " + "due to undefined FEATURE_TELEPHONY_CALLING"; + } + } + serial = GetRandomSerialNumber(); radio_voice->hangupForegroundResumeBackground(serial); @@ -509,6 +628,13 @@ TEST_P(RadioVoiceTest, hangupForegroundResumeBackground) { * Test IRadioVoice.switchWaitingOrHoldingAndActive() for the response returned. */ TEST_P(RadioVoiceTest, switchWaitingOrHoldingAndActive) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_CALLING)) { + GTEST_SKIP() << "Skipping switchWaitingOrHoldingAndActive " + "due to undefined FEATURE_TELEPHONY_CALLING"; + } + } + serial = GetRandomSerialNumber(); radio_voice->switchWaitingOrHoldingAndActive(serial); @@ -527,6 +653,13 @@ TEST_P(RadioVoiceTest, switchWaitingOrHoldingAndActive) { * Test IRadioVoice.conference() for the response returned. */ TEST_P(RadioVoiceTest, conference) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_CALLING)) { + GTEST_SKIP() << "Skipping conference " + "due to undefined FEATURE_TELEPHONY_CALLING"; + } + } + serial = GetRandomSerialNumber(); radio_voice->conference(serial); @@ -545,6 +678,13 @@ TEST_P(RadioVoiceTest, conference) { * Test IRadioVoice.rejectCall() for the response returned. */ TEST_P(RadioVoiceTest, rejectCall) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_CALLING)) { + GTEST_SKIP() << "Skipping rejectCall " + "due to undefined FEATURE_TELEPHONY_CALLING"; + } + } + serial = GetRandomSerialNumber(); radio_voice->rejectCall(serial); @@ -563,6 +703,13 @@ TEST_P(RadioVoiceTest, rejectCall) { * Test IRadioVoice.getLastCallFailCause() for the response returned. */ TEST_P(RadioVoiceTest, getLastCallFailCause) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_CALLING)) { + GTEST_SKIP() << "Skipping getLastCallFailCause " + "due to undefined FEATURE_TELEPHONY_CALLING"; + } + } + serial = GetRandomSerialNumber(); radio_voice->getLastCallFailCause(serial); @@ -580,6 +727,13 @@ TEST_P(RadioVoiceTest, getLastCallFailCause) { * Test IRadioVoice.getCallForwardStatus() for the response returned. */ TEST_P(RadioVoiceTest, getCallForwardStatus) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_CALLING)) { + GTEST_SKIP() << "Skipping getCallForwardStatus " + "due to undefined FEATURE_TELEPHONY_CALLING"; + } + } + serial = GetRandomSerialNumber(); CallForwardInfo callInfo; memset(&callInfo, 0, sizeof(callInfo)); @@ -602,6 +756,13 @@ TEST_P(RadioVoiceTest, getCallForwardStatus) { * Test IRadioVoice.setCallForward() for the response returned. */ TEST_P(RadioVoiceTest, setCallForward) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_CALLING)) { + GTEST_SKIP() << "Skipping setCallForward " + "due to undefined FEATURE_TELEPHONY_CALLING"; + } + } + serial = GetRandomSerialNumber(); CallForwardInfo callInfo; memset(&callInfo, 0, sizeof(callInfo)); @@ -624,6 +785,13 @@ TEST_P(RadioVoiceTest, setCallForward) { * Test IRadioVoice.getCallWaiting() for the response returned. */ TEST_P(RadioVoiceTest, getCallWaiting) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_CALLING)) { + GTEST_SKIP() << "Skipping getCallWaiting " + "due to undefined FEATURE_TELEPHONY_CALLING"; + } + } + serial = GetRandomSerialNumber(); radio_voice->getCallWaiting(serial, 1); @@ -643,6 +811,13 @@ TEST_P(RadioVoiceTest, getCallWaiting) { * Test IRadioVoice.setCallWaiting() for the response returned. */ TEST_P(RadioVoiceTest, setCallWaiting) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_CALLING)) { + GTEST_SKIP() << "Skipping setCallWaiting " + "due to undefined FEATURE_TELEPHONY_CALLING"; + } + } + serial = GetRandomSerialNumber(); radio_voice->setCallWaiting(serial, true, 1); @@ -662,6 +837,13 @@ TEST_P(RadioVoiceTest, setCallWaiting) { * Test IRadioVoice.acceptCall() for the response returned. */ TEST_P(RadioVoiceTest, acceptCall) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_CALLING)) { + GTEST_SKIP() << "Skipping acceptCall " + "due to undefined FEATURE_TELEPHONY_CALLING"; + } + } + serial = GetRandomSerialNumber(); radio_voice->acceptCall(serial); @@ -680,6 +862,13 @@ TEST_P(RadioVoiceTest, acceptCall) { * Test IRadioVoice.separateConnection() for the response returned. */ TEST_P(RadioVoiceTest, separateConnection) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_CALLING)) { + GTEST_SKIP() << "Skipping separateConnection " + "due to undefined FEATURE_TELEPHONY_CALLING"; + } + } + serial = GetRandomSerialNumber(); radio_voice->separateConnection(serial, 1); @@ -699,6 +888,13 @@ TEST_P(RadioVoiceTest, separateConnection) { * Test IRadioVoice.explicitCallTransfer() for the response returned. */ TEST_P(RadioVoiceTest, explicitCallTransfer) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_CALLING)) { + GTEST_SKIP() << "Skipping explicitCallTransfer " + "due to undefined FEATURE_TELEPHONY_CALLING"; + } + } + serial = GetRandomSerialNumber(); radio_voice->explicitCallTransfer(serial); @@ -717,6 +913,13 @@ TEST_P(RadioVoiceTest, explicitCallTransfer) { * Test IRadioVoice.sendCdmaFeatureCode() for the response returned. */ TEST_P(RadioVoiceTest, sendCdmaFeatureCode) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_CDMA)) { + GTEST_SKIP() << "Skipping sendCdmaFeatureCode " + "due to undefined FEATURE_TELEPHONY_CDMA"; + } + } + serial = GetRandomSerialNumber(); radio_voice->sendCdmaFeatureCode(serial, std::string()); @@ -737,6 +940,13 @@ TEST_P(RadioVoiceTest, sendCdmaFeatureCode) { * Test IRadioVoice.sendDtmf() for the response returned. */ TEST_P(RadioVoiceTest, sendDtmf) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_CALLING)) { + GTEST_SKIP() << "Skipping sendDtmf " + "due to undefined FEATURE_TELEPHONY_CALLING"; + } + } + serial = GetRandomSerialNumber(); radio_voice->sendDtmf(serial, "1"); @@ -757,6 +967,13 @@ TEST_P(RadioVoiceTest, sendDtmf) { * Test IRadioVoice.startDtmf() for the response returned. */ TEST_P(RadioVoiceTest, startDtmf) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_CALLING)) { + GTEST_SKIP() << "Skipping startDtmf " + "due to undefined FEATURE_TELEPHONY_CALLING"; + } + } + serial = GetRandomSerialNumber(); radio_voice->startDtmf(serial, "1"); @@ -777,6 +994,13 @@ TEST_P(RadioVoiceTest, startDtmf) { * Test IRadioVoice.stopDtmf() for the response returned. */ TEST_P(RadioVoiceTest, stopDtmf) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_CALLING)) { + GTEST_SKIP() << "Skipping stopDtmf " + "due to undefined FEATURE_TELEPHONY_CALLING"; + } + } + serial = GetRandomSerialNumber(); radio_voice->stopDtmf(serial); @@ -796,6 +1020,13 @@ TEST_P(RadioVoiceTest, stopDtmf) { * Test IRadioVoice.setMute() for the response returned. */ TEST_P(RadioVoiceTest, setMute) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_CALLING)) { + GTEST_SKIP() << "Skipping setMute " + "due to undefined FEATURE_TELEPHONY_CALLING"; + } + } + serial = GetRandomSerialNumber(); radio_voice->setMute(serial, true); @@ -814,6 +1045,13 @@ TEST_P(RadioVoiceTest, setMute) { * Test IRadioVoice.getMute() for the response returned. */ TEST_P(RadioVoiceTest, getMute) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_CALLING)) { + GTEST_SKIP() << "Skipping getMute " + "due to undefined FEATURE_TELEPHONY_CALLING"; + } + } + serial = GetRandomSerialNumber(); radio_voice->getMute(serial); @@ -830,6 +1068,13 @@ TEST_P(RadioVoiceTest, getMute) { * Test IRadioVoice.sendBurstDtmf() for the response returned. */ TEST_P(RadioVoiceTest, sendBurstDtmf) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_CALLING)) { + GTEST_SKIP() << "Skipping sendBurstDtmf " + "due to undefined FEATURE_TELEPHONY_CALLING"; + } + } + serial = GetRandomSerialNumber(); radio_voice->sendBurstDtmf(serial, "1", 0, 0); @@ -849,6 +1094,13 @@ TEST_P(RadioVoiceTest, sendBurstDtmf) { * Test IRadioVoice.sendUssd() for the response returned. */ TEST_P(RadioVoiceTest, sendUssd) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_CALLING)) { + GTEST_SKIP() << "Skipping sendUssd " + "due to undefined FEATURE_TELEPHONY_CALLING"; + } + } + serial = GetRandomSerialNumber(); radio_voice->sendUssd(serial, std::string("test")); EXPECT_EQ(std::cv_status::no_timeout, wait()); @@ -867,6 +1119,13 @@ TEST_P(RadioVoiceTest, sendUssd) { * Test IRadioVoice.cancelPendingUssd() for the response returned. */ TEST_P(RadioVoiceTest, cancelPendingUssd) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_CALLING)) { + GTEST_SKIP() << "Skipping cancelPendingUssd " + "due to undefined FEATURE_TELEPHONY_CALLING"; + } + } + serial = GetRandomSerialNumber(); radio_voice->cancelPendingUssd(serial); @@ -886,6 +1145,13 @@ TEST_P(RadioVoiceTest, cancelPendingUssd) { * Test IRadioVoice.isVoNrEnabled() for the response returned. */ TEST_P(RadioVoiceTest, isVoNrEnabled) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_IMS)) { + GTEST_SKIP() << "Skipping isVoNrEnabled " + "due to undefined FEATURE_TELEPHONY_IMS"; + } + } + serial = GetRandomSerialNumber(); radio_voice->isVoNrEnabled(serial); @@ -901,6 +1167,13 @@ TEST_P(RadioVoiceTest, isVoNrEnabled) { * Test IRadioVoice.setVoNrEnabled() for the response returned. */ TEST_P(RadioVoiceTest, setVoNrEnabled) { + if (telephony_flags::enforce_telephony_feature_mapping()) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_IMS)) { + GTEST_SKIP() << "Skipping setVoNrEnabled " + "due to undefined FEATURE_TELEPHONY_IMS"; + } + } + serial = GetRandomSerialNumber(); radio_voice->setVoNrEnabled(serial, true); diff --git a/sensors/2.1/vts/functional/AndroidTest.xml b/sensors/2.1/vts/functional/AndroidTest.xml index 2ef8dc63f0eac2f4886678b39d4f3ed8c7981d98..2d21c7f31a61c1d9c4bcf5e0a4ff0fab43bf0096 100644 --- a/sensors/2.1/vts/functional/AndroidTest.xml +++ b/sensors/2.1/vts/functional/AndroidTest.xml @@ -22,13 +22,13 @@ diff --git a/sensors/2.1/vts/functional/TEST_MAPPING b/sensors/2.1/vts/functional/TEST_MAPPING new file mode 100644 index 0000000000000000000000000000000000000000..0129f3996b73654b1a4c8281d5c02a62b7f81b4d --- /dev/null +++ b/sensors/2.1/vts/functional/TEST_MAPPING @@ -0,0 +1,12 @@ +{ + "presubmit": [ + { + "name": "VtsHalSensorsV2_1TargetTest" + } + ], + "kernel-presubmit": [ + { + "name": "VtsHalSensorsV2_1TargetTest" + } + ] +} diff --git a/sensors/aidl/TEST_MAPPING b/sensors/aidl/TEST_MAPPING new file mode 100644 index 0000000000000000000000000000000000000000..6de4549f9c84772afc874685b835a251c7ed8b58 --- /dev/null +++ b/sensors/aidl/TEST_MAPPING @@ -0,0 +1,12 @@ +{ + "presubmit": [ + { + "name": "VtsAidlHalSensorsTargetTest" + } + ], + "kernel-presubmit": [ + { + "name": "VtsAidlHalSensorsTargetTest" + } + ] +} diff --git a/sensors/aidl/vts/AndroidTest.xml b/sensors/aidl/vts/AndroidTest.xml index 99caf2842208a1b6ea7a956299679a988409fa01..2d3382e5a58798d858fab99d8d2f2988c0a9af7c 100644 --- a/sensors/aidl/vts/AndroidTest.xml +++ b/sensors/aidl/vts/AndroidTest.xml @@ -22,13 +22,13 @@ diff --git a/sensors/aidl/vts/SensorsAidlTestSharedMemory.h b/sensors/aidl/vts/SensorsAidlTestSharedMemory.h index 4b5916a0d713ea77662a16d0db1cad534a068a55..200f26f8f93f90286cd44b1d189fbdba7b8ad611 100644 --- a/sensors/aidl/vts/SensorsAidlTestSharedMemory.h +++ b/sensors/aidl/vts/SensorsAidlTestSharedMemory.h @@ -17,7 +17,11 @@ #ifndef ANDROID_SENSORS_AIDL_TEST_SHARED_MEMORY_H #define ANDROID_SENSORS_AIDL_TEST_SHARED_MEMORY_H -#include "sensors-vts-utils/GrallocWrapper.h" +#include +#include +#include +#include +#include #include #include @@ -28,6 +32,8 @@ #include +using ::aidl::android::hardware::graphics::common::BufferUsage; +using ::aidl::android::hardware::graphics::common::PixelFormat; using ::aidl::android::hardware::sensors::BnSensors; using ::aidl::android::hardware::sensors::Event; using ::aidl::android::hardware::sensors::ISensors; @@ -53,12 +59,22 @@ class SensorsAidlTestSharedMemory { } ISensors::SharedMemInfo getSharedMemInfo() const { - ISensors::SharedMemInfo mem = { - .type = mType, - .format = ISensors::SharedMemInfo::SharedMemFormat::SENSORS_EVENT, - .size = static_cast(mSize), - .memoryHandle = android::dupToAidl(mNativeHandle)}; - return mem; + if (mType == ISensors::SharedMemInfo::SharedMemType::GRALLOC) { + ISensors::SharedMemInfo mem = { + .type = mType, + .format = ISensors::SharedMemInfo::SharedMemFormat::SENSORS_EVENT, + .size = static_cast(mSize), + .memoryHandle = android::dupToAidl(mBufferHandle)}; + return mem; + + } else { + ISensors::SharedMemInfo mem = { + .type = mType, + .format = ISensors::SharedMemInfo::SharedMemFormat::SENSORS_EVENT, + .size = static_cast(mSize), + .memoryHandle = android::dupToAidl(mNativeHandle)}; + return mem; + } } char* getBuffer() const { return mBuffer; } size_t getSize() const { return mSize; } @@ -141,17 +157,26 @@ class SensorsAidlTestSharedMemory { } case ISensors::SharedMemInfo::SharedMemType::GRALLOC: { if (mSize != 0) { - mGrallocWrapper->freeBuffer(mNativeHandle); - mNativeHandle = nullptr; + android::status_t status = + android::GraphicBufferAllocator::get().free(mBufferHandle); + if (status != android::OK) { + ALOGE("SensorsAidlTestSharedMemory Gralloc failed to free buffer. Status: " + "%s", + android::statusToString(status).c_str()); + } + mBufferHandle = nullptr; + mBuffer = nullptr; mSize = 0; } break; } default: { - if (mNativeHandle != nullptr || mSize != 0 || mBuffer != nullptr) { + if (mNativeHandle != nullptr || mSize != 0 || mBuffer != nullptr || + mBufferHandle != nullptr) { ALOGE("SensorsAidlTestSharedMemory %p not properly destructed: " - "type %d, native handle %p, size %zu, buffer %p", - this, static_cast(mType), mNativeHandle, mSize, mBuffer); + "type %d, native handle %p, size %zu, buffer %p, buffer handle %p", + this, static_cast(mType), mNativeHandle, mSize, mBuffer, + mBufferHandle); } break; } @@ -185,14 +210,33 @@ class SensorsAidlTestSharedMemory { break; } case ISensors::SharedMemInfo::SharedMemType::GRALLOC: { - mGrallocWrapper = std::make_unique<::android::GrallocWrapper>(); - if (!mGrallocWrapper->isInitialized()) { + static constexpr uint64_t kBufferUsage = + static_cast(BufferUsage::SENSOR_DIRECT_DATA) | + static_cast(BufferUsage::CPU_READ_OFTEN) | + static_cast(BufferUsage::CPU_WRITE_RARELY); + + uint32_t stride = 0; + buffer_handle_t bufferHandle; + android::status_t status = android::GraphicBufferAllocator::get().allocate( + size, 1, static_cast(PixelFormat::BLOB), 1, kBufferUsage, + &bufferHandle, &stride, "SensorVts"); + if (status != android::OK) { + ALOGE("SensorsAidlTestSharedMemory failed to allocate memory. Status: %s", + android::statusToString(status).c_str()); break; } - - std::pair buf = mGrallocWrapper->allocate(size); - handle = buf.first; - buffer = static_cast(buf.second); + // Per the HAL, all-zeros Rect means the entire buffer + android::Rect rect = {0, 0, 0, 0}; + void* ret; + status = android::GraphicBufferMapper::get().lock(bufferHandle, kBufferUsage, rect, + &ret); + if (status != android::OK) { + ALOGE("SensorsAidlTestSharedMemory failed to import buffer: Status: %s", + android::statusToString(status).c_str()); + } else { + buffer = static_cast(ret); + mBufferHandle = bufferHandle; + } break; } default: @@ -208,9 +252,9 @@ class SensorsAidlTestSharedMemory { ISensors::SharedMemInfo::SharedMemType mType; native_handle_t* mNativeHandle; + buffer_handle_t mBufferHandle; size_t mSize; char* mBuffer; - std::unique_ptr<::android::GrallocWrapper> mGrallocWrapper; DISALLOW_COPY_AND_ASSIGN(SensorsAidlTestSharedMemory); }; diff --git a/sensors/aidl/vts/VtsAidlHalSensorsTargetTest.cpp b/sensors/aidl/vts/VtsAidlHalSensorsTargetTest.cpp index be11b876909f13697928655f05c585d196df4744..0b15d1280c018b0eadf9b5ec584f012d027b46e5 100644 --- a/sensors/aidl/vts/VtsAidlHalSensorsTargetTest.cpp +++ b/sensors/aidl/vts/VtsAidlHalSensorsTargetTest.cpp @@ -931,9 +931,15 @@ TEST_P(SensorsAidlTest, NoStaleEvents) { continue; } + // Skip sensors with no events + const std::vector events = callback.getEvents(sensor.sensorHandle); + if (events.empty()) { + continue; + } + // Ensure that the first event received is not stale by ensuring that its timestamp is // sufficiently different from the previous event - const Event newEvent = callback.getEvents(sensor.sensorHandle).front(); + const Event newEvent = events.front(); std::chrono::milliseconds delta = duration_cast(std::chrono::nanoseconds( newEvent.timestamp - lastEventTimestampMap[sensor.sensorHandle])); diff --git a/sensors/common/vts/2_X/VtsHalSensorsV2_XTargetTest.h b/sensors/common/vts/2_X/VtsHalSensorsV2_XTargetTest.h index aa6e8814a2d59591bde922141104bc138f5851a1..becc93ce3e7228ac919568d337eb90a4ea1c96e7 100644 --- a/sensors/common/vts/2_X/VtsHalSensorsV2_XTargetTest.h +++ b/sensors/common/vts/2_X/VtsHalSensorsV2_XTargetTest.h @@ -52,8 +52,6 @@ using ::android::hardware::sensors::V1_0::SharedMemType; using ::android::hardware::sensors::V1_0::Vec3; using ::android::hardware::sensors::V2_1::implementation::convertToOldSensorInfos; using std::chrono::duration_cast; -using std::chrono::microseconds; -using std::chrono::milliseconds; using std::chrono::nanoseconds; using EventV1_0 = ::android::hardware::sensors::V1_0::Event; @@ -91,7 +89,7 @@ class EventCallback : public IEventCallback { } void waitForFlushEvents(const std::vector& sensorsToWaitFor, - int32_t numCallsToFlush, milliseconds timeout) { + int32_t numCallsToFlush, std::chrono::milliseconds timeout) { std::unique_lock lock(mFlushMutex); mFlushCV.wait_for(lock, timeout, [&] { return flushesReceived(sensorsToWaitFor, numCallsToFlush); }); @@ -102,7 +100,8 @@ class EventCallback : public IEventCallback { return mEventMap[sensorHandle]; } - void waitForEvents(const std::vector& sensorsToWaitFor, milliseconds timeout) { + void waitForEvents(const std::vector& sensorsToWaitFor, + std::chrono::milliseconds timeout) { std::unique_lock lock(mEventMutex); mEventCV.wait_for(lock, timeout, [&] { return eventsReceived(sensorsToWaitFor); }); } @@ -472,7 +471,7 @@ TEST_P(SensorsHidlTest, InjectSensorEventData) { } // Wait for events to be written back to the Event FMQ - callback.waitForEvents(sensors, milliseconds(1000) /* timeout */); + callback.waitForEvents(sensors, std::chrono::milliseconds(1000) /* timeout */); getEnvironment()->unregisterCallback(); for (const auto& s : sensors) { @@ -623,7 +622,7 @@ void SensorsHidlTest::runFlushTest(const std::vector& sensors, b } // Wait up to one second for the flush events - callback.waitForFlushEvents(sensors, flushCalls, milliseconds(1000) /* timeout */); + callback.waitForFlushEvents(sensors, flushCalls, std::chrono::milliseconds(1000) /* timeout */); // Deactivate all sensors after waiting for flush events so pending flush events are not // abandoned by the HAL. @@ -748,8 +747,8 @@ TEST_P(SensorsHidlTest, Activate) { } TEST_P(SensorsHidlTest, NoStaleEvents) { - constexpr milliseconds kFiveHundredMs(500); - constexpr milliseconds kOneSecond(1000); + constexpr std::chrono::milliseconds kFiveHundredMs(500); + constexpr std::chrono::milliseconds kOneSecond(1000); // Register the callback to receive sensor events EventCallback callback; @@ -757,10 +756,11 @@ TEST_P(SensorsHidlTest, NoStaleEvents) { // This test is not valid for one-shot, on-change or special-report-mode sensors const std::vector sensors = getNonOneShotAndNonOnChangeAndNonSpecialSensors(); - milliseconds maxMinDelay(0); + std::chrono::milliseconds maxMinDelay(0); for (const SensorInfoType& sensor : sensors) { - milliseconds minDelay = duration_cast(microseconds(sensor.minDelay)); - maxMinDelay = milliseconds(std::max(maxMinDelay.count(), minDelay.count())); + std::chrono::milliseconds minDelay = duration_cast( + std::chrono::microseconds(sensor.minDelay)); + maxMinDelay = std::chrono::milliseconds(std::max(maxMinDelay.count(), minDelay.count())); } // Activate the sensors so that they start generating events @@ -787,7 +787,7 @@ TEST_P(SensorsHidlTest, NoStaleEvents) { } // Allow some time to pass, reset the callback, then reactivate the sensors - usleep(duration_cast(kOneSecond + (5 * maxMinDelay)).count()); + usleep(duration_cast(kOneSecond + (5 * maxMinDelay)).count()); callback.reset(); activateAllSensors(true); callback.waitForEvents(sensors, kFiveHundredMs + (5 * maxMinDelay)); @@ -806,12 +806,19 @@ TEST_P(SensorsHidlTest, NoStaleEvents) { continue; } + // Skip sensors with no events + const std::vector events = callback.getEvents(sensor.sensorHandle); + if (events.empty()) { + continue; + } + // Ensure that the first event received is not stale by ensuring that its timestamp is // sufficiently different from the previous event - const EventType newEvent = callback.getEvents(sensor.sensorHandle).front(); - milliseconds delta = duration_cast( + const EventType newEvent = events.front(); + std::chrono::milliseconds delta = duration_cast( nanoseconds(newEvent.timestamp - lastEventTimestampMap[sensor.sensorHandle])); - milliseconds sensorMinDelay = duration_cast(microseconds(sensor.minDelay)); + std::chrono::milliseconds sensorMinDelay = duration_cast( + std::chrono::microseconds(sensor.minDelay)); ASSERT_GE(delta, kFiveHundredMs + (3 * sensorMinDelay)); } } diff --git a/sensors/common/vts/utils/Android.bp b/sensors/common/vts/utils/Android.bp index b35280a5411c83988f17f771535ca20103c8e82f..ab3984ca74eb964056c59584cca34560741d85fc 100644 --- a/sensors/common/vts/utils/Android.bp +++ b/sensors/common/vts/utils/Android.bp @@ -35,6 +35,7 @@ cc_defaults { "libbinder_ndk", "libutils", "libvndksupport", + "libui", ], static_libs: [ "libaidlcommonsupport", @@ -50,9 +51,6 @@ cc_library_static { "android.hardware.graphics.common-ndk_shared", ], cflags: ["-DLOG_TAG=\"sensors_hidl_hal_test\""], - srcs: [ - "GrallocWrapper.cpp", - ], export_include_dirs: [ "include", ], @@ -64,6 +62,7 @@ cc_library_static { "libbinder_ndk", "libutils", "libvndksupport", + "libui", ], static_libs: [ "android.hardware.sensors@1.0", @@ -71,13 +70,4 @@ cc_library_static { "android.hardware.sensors@2.1", "libaidlcommonsupport", ], - whole_static_libs: [ - "android.hardware.graphics.allocator@2.0", - "android.hardware.graphics.allocator@3.0", - "android.hardware.graphics.allocator@4.0", - "android.hardware.graphics.mapper@2.0", - "android.hardware.graphics.mapper@2.1", - "android.hardware.graphics.mapper@3.0", - "android.hardware.graphics.mapper@4.0", - ], } diff --git a/sensors/common/vts/utils/GrallocWrapper.cpp b/sensors/common/vts/utils/GrallocWrapper.cpp deleted file mode 100644 index a15e7fee8c0f29a2edd9a39d2725801416cf8525..0000000000000000000000000000000000000000 --- a/sensors/common/vts/utils/GrallocWrapper.cpp +++ /dev/null @@ -1,355 +0,0 @@ -/* - * Copyright (C) 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "GrallocWrapper.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include -#include -#include - -using IAllocatorAidl = ::aidl::android::hardware::graphics::allocator::IAllocator; -using IAllocator2 = ::android::hardware::graphics::allocator::V2_0::IAllocator; -using IAllocator3 = ::android::hardware::graphics::allocator::V3_0::IAllocator; -using IAllocator4 = ::android::hardware::graphics::allocator::V4_0::IAllocator; -using IMapper2 = ::android::hardware::graphics::mapper::V2_0::IMapper; -using IMapper2_1 = ::android::hardware::graphics::mapper::V2_1::IMapper; -using IMapper3 = ::android::hardware::graphics::mapper::V3_0::IMapper; -using IMapper4 = ::android::hardware::graphics::mapper::V4_0::IMapper; - -using Error2 = ::android::hardware::graphics::mapper::V2_0::Error; -using Error3 = ::android::hardware::graphics::mapper::V3_0::Error; -using Error4 = ::android::hardware::graphics::mapper::V4_0::Error; - -using ::aidl::android::hardware::common::NativeHandle; -using ::aidl::android::hardware::graphics::allocator::AllocationResult; - -using ::android::hardware::graphics::common::V1_0::BufferUsage; -using ::android::hardware::graphics::common::V1_0::PixelFormat; - -using ::android::hardware::hidl_handle; -using ::android::hardware::hidl_string; -using ::android::hardware::hidl_vec; - -namespace android { - -// Since we use the same APIs across allocator/mapper HALs but they have major -// version differences (meaning they are not related through inheritance), we -// create a common interface abstraction for the IAllocator + IMapper combination -// (major versions need to match in the current HALs, e.g. IAllocator 3.0 needs to -// be paired with IMapper 3.0, so these are tied together) -class IGrallocHalWrapper { - public: - virtual ~IGrallocHalWrapper() = default; - - // IAllocator - virtual native_handle_t* allocate(uint32_t size) = 0; - virtual void freeBuffer(native_handle_t* bufferHandle) = 0; - - // IMapper - virtual void* lock(native_handle_t* bufferHandle) = 0; - virtual void unlock(native_handle_t* bufferHandle) = 0; -}; - -namespace { - -bool failed(Error2 error) { - return (error != Error2::NONE); -} -bool failed(Error3 error) { - return (error != Error3::NONE); -} -bool failed(Error4 error) { - return (error != Error4::NONE); -} - -template -struct FirstArg; - -// Template specialization for pointer to a non-static member function, which exposes -// the type of the first argument given to said function -template -struct FirstArg { - using type = Arg1; -}; - -// Alias to FirstArg which also removes any reference type and const associated -template -using BaseTypeOfFirstArg = typename std::remove_const< - typename std::remove_reference::type>::type>::type; - -// Since all the type and function names are the same for the things we use across the major HAL -// versions, we use template magic to avoid repeating ourselves. -template typename AllocatorWrapperT = sp> -class GrallocHalWrapper : public IGrallocHalWrapper { - public: - GrallocHalWrapper(const AllocatorWrapperT& allocator, const sp& mapper) - : mAllocator(allocator), mMapper(mapper) { - if (mapper->isRemote()) { - ALOGE("Mapper is in passthrough mode"); - } - } - - virtual native_handle_t* allocate(uint32_t size) override; - virtual void freeBuffer(native_handle_t* bufferHandle) override; - - virtual void* lock(native_handle_t* bufferHandle) override; - virtual void unlock(native_handle_t* bufferHandle) override; - - private: - static constexpr uint64_t kBufferUsage = - static_cast(BufferUsage::SENSOR_DIRECT_DATA | BufferUsage::CPU_READ_OFTEN | - BufferUsage::CPU_WRITE_RARELY); - AllocatorWrapperT mAllocator; - sp mMapper; - - // v2.0 and v3.0 use vec for BufferDescriptor, but v4.0 uses vec, so use - // some template magic to deduce the right type based off of the first argument to allocate(), - // which is always the version-specific BufferDescriptor type - typedef BaseTypeOfFirstArg BufferDescriptorT; - - BufferDescriptorT getDescriptor(uint32_t size); - native_handle_t* importBuffer(const hidl_handle& rawHandle); -}; - -template <> -native_handle_t* GrallocHalWrapper::allocate( - uint32_t size) { - constexpr uint32_t kBufferCount = 1; - BufferDescriptorT descriptor = getDescriptor(size); - native_handle_t* bufferHandle = nullptr; - - AllocationResult result; - auto status = mAllocator->allocate(descriptor, kBufferCount, &result); - if (!status.isOk()) { - status_t error = status.getExceptionCode(); - ALOGE("Failed to allocate buffer: %" PRId32, static_cast(error)); - } else if (result.buffers.size() != kBufferCount) { - ALOGE("Invalid buffer array size (got %zu, expected %" PRIu32 ")", result.buffers.size(), - kBufferCount); - } else { - // Convert from AIDL NativeHandle to native_handle_t to hidl_handle - hidl_handle hidlHandle; - hidlHandle.setTo(dupFromAidl(result.buffers[0]), /*shouldOwn*/ true); - bufferHandle = importBuffer(hidlHandle); - } - - return bufferHandle; -} - -template typename AllocatorWrapperT> -native_handle_t* GrallocHalWrapper::allocate( - uint32_t size) { - constexpr uint32_t kBufferCount = 1; - BufferDescriptorT descriptor = getDescriptor(size); - native_handle_t* bufferHandle = nullptr; - - auto callback = [&](auto error, uint32_t /*stride*/, const hidl_vec& buffers) { - if (failed(error)) { - ALOGE("Failed to allocate buffer: %" PRId32, static_cast(error)); - } else if (buffers.size() != kBufferCount) { - ALOGE("Invalid buffer array size (got %zu, expected %" PRIu32 ")", buffers.size(), - kBufferCount); - } else { - bufferHandle = importBuffer(buffers[0]); - } - }; - - mAllocator->allocate(descriptor, kBufferCount, callback); - return bufferHandle; -} - -template typename AllocatorWrapperT> -void GrallocHalWrapper::freeBuffer( - native_handle_t* bufferHandle) { - auto error = mMapper->freeBuffer(bufferHandle); - if (!error.isOk() || failed(error)) { - ALOGE("Failed to free buffer %p", bufferHandle); - } -} - -template typename AllocatorWrapperT> -typename GrallocHalWrapper::BufferDescriptorT -GrallocHalWrapper::getDescriptor(uint32_t size) { - typename MapperT::BufferDescriptorInfo descriptorInfo = { - .width = size, - .height = 1, - .layerCount = 1, - .format = static_cast(PixelFormat::BLOB), - .usage = kBufferUsage, - }; - - BufferDescriptorT descriptor; - auto callback = [&](auto error, const BufferDescriptorT& tmpDescriptor) { - if (failed(error)) { - ALOGE("Failed to create descriptor: %" PRId32, static_cast(error)); - } else { - descriptor = tmpDescriptor; - } - }; - - mMapper->createDescriptor(descriptorInfo, callback); - return descriptor; -} - -template typename AllocatorWrapperT> -native_handle_t* GrallocHalWrapper::importBuffer( - const hidl_handle& rawHandle) { - native_handle_t* bufferHandle = nullptr; - - mMapper->importBuffer(rawHandle, [&](auto error, void* tmpBuffer) { - if (failed(error)) { - ALOGE("Failed to import buffer %p: %" PRId32, rawHandle.getNativeHandle(), - static_cast(error)); - } else { - bufferHandle = static_cast(tmpBuffer); - } - }); - - return bufferHandle; -} - -template typename AllocatorWrapperT> -void* GrallocHalWrapper::lock( - native_handle_t* bufferHandle) { - // Per the HAL, all-zeros Rect means the entire buffer - typename MapperT::Rect accessRegion = {}; - hidl_handle acquireFenceHandle; // No fence needed, already safe to lock - - void* data = nullptr; - mMapper->lock(bufferHandle, kBufferUsage, accessRegion, acquireFenceHandle, - [&](auto error, void* tmpData, ...) { // V3/4 pass extra args we don't use - if (failed(error)) { - ALOGE("Failed to lock buffer %p: %" PRId32, bufferHandle, - static_cast(error)); - } else { - data = tmpData; - } - }); - - return data; -} - -template typename AllocatorWrapperT> -void GrallocHalWrapper::unlock( - native_handle_t* bufferHandle) { - mMapper->unlock(bufferHandle, [&](auto error, const hidl_handle& /*releaseFence*/) { - if (failed(error)) { - ALOGE("Failed to unlock buffer %p: %" PRId32, bufferHandle, - static_cast(error)); - } - }); -} - -} // anonymous namespace - -GrallocWrapper::GrallocWrapper() { - sp allocator4 = IAllocator4::getService(); - sp mapper4 = IMapper4::getService(); - - const auto kAllocatorSvc = std::string(IAllocatorAidl::descriptor) + "/default"; - std::shared_ptr allocatorAidl; - if (AServiceManager_isDeclared(kAllocatorSvc.c_str())) { - allocatorAidl = IAllocatorAidl::fromBinder( - ndk::SpAIBinder(AServiceManager_checkService(kAllocatorSvc.c_str()))); - } - - // As of T, AIDL Allocator is supported only with HIDL Mapper4 - // (ref: VtsHalGraphicsAllocatorAidl_TargetTest.cpp) - if (allocatorAidl != nullptr && mapper4 != nullptr) { - ALOGD("Using AIDL IAllocator + HIDL IMapper v4.0"); - mGrallocHal = std::unique_ptr( - new GrallocHalWrapper(allocatorAidl, - mapper4)); - } else if (allocator4 != nullptr && mapper4 != nullptr) { - ALOGD("AIDL IAllocator not found, using HIDL IAllocator/IMapper v4.0"); - mGrallocHal = std::unique_ptr( - new GrallocHalWrapper(allocator4, mapper4)); - } else { - ALOGD("Graphics HALs 4.0 not found (allocator %d mapper %d), falling back to 3.0", - (allocator4 != nullptr), (mapper4 != nullptr)); - - sp allocator3 = IAllocator3::getService(); - sp mapper3 = IMapper3::getService(); - - if (allocator3 != nullptr && mapper3 != nullptr) { - mGrallocHal = std::unique_ptr( - new GrallocHalWrapper(allocator3, mapper3)); - } else { - ALOGD("Graphics HALs 3.0 not found (allocator %d mapper %d), falling back to 2.x", - (allocator3 != nullptr), (mapper3 != nullptr)); - - sp allocator2 = IAllocator2::getService(); - sp mapper2 = IMapper2_1::getService(); - if (mapper2 == nullptr) { - mapper2 = IMapper2::getService(); - } - - if (allocator2 != nullptr && mapper2 != nullptr) { - mGrallocHal = std::unique_ptr( - new GrallocHalWrapper(allocator2, mapper2)); - } else { - ALOGE("Couldn't open graphics HALs (2.x allocator %d mapper %d)", - (allocator2 != nullptr), (mapper2 != nullptr)); - } - } - } -} - -GrallocWrapper::~GrallocWrapper() { - for (auto bufferHandle : mAllocatedBuffers) { - mGrallocHal->unlock(bufferHandle); - mGrallocHal->freeBuffer(bufferHandle); - } - mAllocatedBuffers.clear(); -} - -std::pair GrallocWrapper::allocate(uint32_t size) { - native_handle_t* bufferHandle = mGrallocHal->allocate(size); - void* buffer = nullptr; - if (bufferHandle) { - buffer = mGrallocHal->lock(bufferHandle); - if (buffer) { - mAllocatedBuffers.insert(bufferHandle); - } else { - mGrallocHal->freeBuffer(bufferHandle); - bufferHandle = nullptr; - } - } - return std::make_pair<>(bufferHandle, buffer); -} - -void GrallocWrapper::freeBuffer(native_handle_t* bufferHandle) { - if (mAllocatedBuffers.erase(bufferHandle)) { - mGrallocHal->unlock(bufferHandle); - mGrallocHal->freeBuffer(bufferHandle); - } -} - -} // namespace android diff --git a/sensors/common/vts/utils/include/sensors-vts-utils/GrallocWrapper.h b/sensors/common/vts/utils/include/sensors-vts-utils/GrallocWrapper.h deleted file mode 100644 index ebbcb2c06fab353aba4beb8e0b14cb4b4698d5df..0000000000000000000000000000000000000000 --- a/sensors/common/vts/utils/include/sensors-vts-utils/GrallocWrapper.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (C) 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include - -#include -#include -#include -#include - -namespace android { - -class IGrallocHalWrapper; - -// Reference: hardware/interfaces/graphics/mapper/2.0/vts/functional/ -class GrallocWrapper { - public: - GrallocWrapper(); - ~GrallocWrapper(); - - // After constructing this object, this function must be called to check the result. If it - // returns false, other methods are not safe to call. - bool isInitialized() const { return (mGrallocHal != nullptr); }; - - // Allocates a gralloc buffer suitable for direct channel sensors usage with the given size. - // The buffer should be freed using freeBuffer when it's not needed anymore; otherwise it'll - // be freed when this object is destroyed. - // Returns a handle to the buffer, and a CPU-accessible pointer for reading. On failure, both - // will be set to nullptr. - std::pair allocate(uint32_t size); - - // Releases a gralloc buffer previously returned by allocate() - void freeBuffer(native_handle_t* bufferHandle); - - private: - std::unique_ptr mGrallocHal; - - // Keep track of all cloned and imported handles. When a test fails with - // ASSERT_*, the destructor will free the handles for the test. - std::unordered_set mAllocatedBuffers; -}; - -} // namespace android diff --git a/sensors/common/vts/utils/include/sensors-vts-utils/SensorsTestSharedMemory.h b/sensors/common/vts/utils/include/sensors-vts-utils/SensorsTestSharedMemory.h index 39084a45e6374429952c4029c2150fcdf217690f..b96adb3df54948e681a741a2a3e9d3120570ef40 100644 --- a/sensors/common/vts/utils/include/sensors-vts-utils/SensorsTestSharedMemory.h +++ b/sensors/common/vts/utils/include/sensors-vts-utils/SensorsTestSharedMemory.h @@ -17,7 +17,11 @@ #ifndef ANDROID_SENSORS_TEST_SHARED_MEMORY_H #define ANDROID_SENSORS_TEST_SHARED_MEMORY_H -#include "GrallocWrapper.h" +#include +#include +#include +#include +#include #include #include @@ -28,6 +32,8 @@ #include using namespace ::android::hardware::sensors::V1_0; +using ::aidl::android::hardware::graphics::common::BufferUsage; +using ::aidl::android::hardware::graphics::common::PixelFormat; template class SensorsTestSharedMemory { @@ -48,11 +54,20 @@ class SensorsTestSharedMemory { } SharedMemInfo getSharedMemInfo() const { - SharedMemInfo mem = {.type = mType, - .format = SharedMemFormat::SENSORS_EVENT, - .size = static_cast(mSize), - .memoryHandle = mNativeHandle}; - return mem; + if (mType == SharedMemType::GRALLOC) { + SharedMemInfo mem = {.type = mType, + .format = SharedMemFormat::SENSORS_EVENT, + .size = static_cast(mSize), + .memoryHandle = mBufferHandle}; + return mem; + + } else { + SharedMemInfo mem = {.type = mType, + .format = SharedMemFormat::SENSORS_EVENT, + .size = static_cast(mSize), + .memoryHandle = mNativeHandle}; + return mem; + } } char* getBuffer() const { return mBuffer; } size_t getSize() const { return mSize; } @@ -128,17 +143,26 @@ class SensorsTestSharedMemory { } case SharedMemType::GRALLOC: { if (mSize != 0) { - mGrallocWrapper->freeBuffer(mNativeHandle); - mNativeHandle = nullptr; + android::status_t status = + android::GraphicBufferAllocator::get().free(mBufferHandle); + if (status != android::OK) { + ALOGE("SensorsAidlTestSharedMemory Gralloc failed to free buffer. Status: " + "%s", + android::statusToString(status).c_str()); + } + mBufferHandle = nullptr; + mBuffer = nullptr; mSize = 0; } break; } default: { - if (mNativeHandle != nullptr || mSize != 0 || mBuffer != nullptr) { - ALOGE("SensorsTestSharedMemory %p not properly destructed: " - "type %d, native handle %p, size %zu, buffer %p", - this, static_cast(mType), mNativeHandle, mSize, mBuffer); + if (mNativeHandle != nullptr || mSize != 0 || mBuffer != nullptr || + mBufferHandle != nullptr) { + ALOGE("SensorsAidlTestSharedMemory %p not properly destructed: " + "type %d, native handle %p, size %zu, buffer %p, buffer handle %p", + this, static_cast(mType), mNativeHandle, mSize, mBuffer, + mBufferHandle); } break; } @@ -171,14 +195,33 @@ class SensorsTestSharedMemory { break; } case SharedMemType::GRALLOC: { - mGrallocWrapper = std::make_unique<::android::GrallocWrapper>(); - if (!mGrallocWrapper->isInitialized()) { + static constexpr uint64_t kBufferUsage = + static_cast(BufferUsage::SENSOR_DIRECT_DATA) | + static_cast(BufferUsage::CPU_READ_OFTEN) | + static_cast(BufferUsage::CPU_WRITE_RARELY); + + uint32_t stride = 0; + buffer_handle_t bufferHandle; + android::status_t status = android::GraphicBufferAllocator::get().allocate( + size, 1, static_cast(PixelFormat::BLOB), 1, kBufferUsage, + &bufferHandle, &stride, "SensorVts"); + if (status != android::OK) { + ALOGE("SensorsAidlTestSharedMemory failed to allocate memory. Status: %s", + android::statusToString(status).c_str()); break; } - - std::pair buf = mGrallocWrapper->allocate(size); - handle = buf.first; - buffer = static_cast(buf.second); + // Per the HAL, all-zeros Rect means the entire buffer + android::Rect rect = {0, 0, 0, 0}; + void* ret; + status = android::GraphicBufferMapper::get().lock(bufferHandle, kBufferUsage, rect, + &ret); + if (status != android::OK) { + ALOGE("SensorsAidlTestSharedMemory failed to import buffer: Status: %s", + android::statusToString(status).c_str()); + } else { + buffer = static_cast(ret); + mBufferHandle = bufferHandle; + } break; } default: @@ -194,9 +237,9 @@ class SensorsTestSharedMemory { SharedMemType mType; native_handle_t* mNativeHandle; + buffer_handle_t mBufferHandle; size_t mSize; char* mBuffer; - std::unique_ptr<::android::GrallocWrapper> mGrallocWrapper; DISALLOW_COPY_AND_ASSIGN(SensorsTestSharedMemory); }; diff --git a/soundtrigger/aidl/cli/java/android/hardware/soundtrigger3/cli/SthalCli.java b/soundtrigger/aidl/cli/java/android/hardware/soundtrigger3/cli/SthalCli.java index 127f0629ffbc8dd4508856f49f62158bd3c2adc4..41e25336c08ef1772e1fa29212b3bb2516809cc0 100644 --- a/soundtrigger/aidl/cli/java/android/hardware/soundtrigger3/cli/SthalCli.java +++ b/soundtrigger/aidl/cli/java/android/hardware/soundtrigger3/cli/SthalCli.java @@ -289,6 +289,8 @@ public class SthalCli { Properties properties = new Properties(); properties.implementor = "Android"; properties.description = "Mock STHAL"; + properties.uuid = "a5af2d2a-4cc4-4b69-a22f-c9d5b6d492c3"; + properties.supportedModelArch = "Mock arch"; properties.maxSoundModels = 2; properties.maxKeyPhrases = 1; properties.recognitionModes = diff --git a/thermal/aidl/Android.bp b/thermal/aidl/Android.bp index efc763c3880c1b32f78fe9b5ed684a8c960b08d7..734aab7d0e5c54552d9a130f48cddefaa6067c26 100644 --- a/thermal/aidl/Android.bp +++ b/thermal/aidl/Android.bp @@ -35,6 +35,9 @@ aidl_interface { java: { platform_apis: true, }, + rust: { + enabled: true, + }, }, versions_with_info: [ { @@ -42,6 +45,6 @@ aidl_interface { imports: [], }, ], - frozen: true, + frozen: false, } diff --git a/thermal/aidl/aidl_api/android.hardware.thermal/current/android/hardware/thermal/CoolingType.aidl b/thermal/aidl/aidl_api/android.hardware.thermal/current/android/hardware/thermal/CoolingType.aidl index 1f87cf29aebb4d05030127059ed7f5c7a6e7b355..5e88aa056cdeb84cbc9459e3d51ee8d6810c7369 100644 --- a/thermal/aidl/aidl_api/android.hardware.thermal/current/android/hardware/thermal/CoolingType.aidl +++ b/thermal/aidl/aidl_api/android.hardware.thermal/current/android/hardware/thermal/CoolingType.aidl @@ -46,4 +46,8 @@ enum CoolingType { POWER_AMPLIFIER, DISPLAY, SPEAKER, + WIFI, + CAMERA, + FLASHLIGHT, + USB_PORT, } diff --git a/thermal/aidl/aidl_api/android.hardware.thermal/current/android/hardware/thermal/TemperatureType.aidl b/thermal/aidl/aidl_api/android.hardware.thermal/current/android/hardware/thermal/TemperatureType.aidl index e9710a7987f5722b84bf50e021d7903da70d40f7..665a36e8b184008d6994a8bfe3af572099050c35 100644 --- a/thermal/aidl/aidl_api/android.hardware.thermal/current/android/hardware/thermal/TemperatureType.aidl +++ b/thermal/aidl/aidl_api/android.hardware.thermal/current/android/hardware/thermal/TemperatureType.aidl @@ -35,7 +35,7 @@ package android.hardware.thermal; /* @hide */ @Backing(type="int") @VintfStability enum TemperatureType { - UNKNOWN = (-1), + UNKNOWN = (-1) /* -1 */, CPU = 0, GPU = 1, BATTERY = 2, @@ -50,4 +50,10 @@ enum TemperatureType { DISPLAY = 11, MODEM = 12, SOC = 13, + WIFI = 14, + CAMERA = 15, + FLASHLIGHT = 16, + SPEAKER = 17, + AMBIENT = 18, + POGO = 19, } diff --git a/thermal/aidl/android/hardware/thermal/CoolingType.aidl b/thermal/aidl/android/hardware/thermal/CoolingType.aidl index 08beb55d83ce093bfbe1689f080fc0d9909ed9aa..c00028debc93ac906d052cc71b2f6373eb0dedf5 100644 --- a/thermal/aidl/android/hardware/thermal/CoolingType.aidl +++ b/thermal/aidl/android/hardware/thermal/CoolingType.aidl @@ -34,4 +34,8 @@ enum CoolingType { POWER_AMPLIFIER, DISPLAY, SPEAKER, + WIFI, + CAMERA, + FLASHLIGHT, + USB_PORT, } diff --git a/thermal/aidl/android/hardware/thermal/TemperatureType.aidl b/thermal/aidl/android/hardware/thermal/TemperatureType.aidl index 467d096439a965913701b583b486761eb2b2591d..ce2a9fcf7e23dd4a674a34fb4828e4122858849a 100644 --- a/thermal/aidl/android/hardware/thermal/TemperatureType.aidl +++ b/thermal/aidl/android/hardware/thermal/TemperatureType.aidl @@ -44,4 +44,10 @@ enum TemperatureType { DISPLAY = 11, MODEM = 12, SOC = 13, + WIFI = 14, + CAMERA = 15, + FLASHLIGHT = 16, + SPEAKER = 17, + AMBIENT = 18, + POGO = 19, } diff --git a/thermal/aidl/default/Android.bp b/thermal/aidl/default/Android.bp index 451e1e2c88c996d162c463b79a0eebdef7e89a3a..9fe62cebdb905ccba10762b19947f361ff5ca3f5 100644 --- a/thermal/aidl/default/Android.bp +++ b/thermal/aidl/default/Android.bp @@ -27,7 +27,7 @@ cc_binary { vendor: true, stl: "c++_static", static_libs: [ - "android.hardware.thermal-V1-ndk", + "android.hardware.thermal-V2-ndk", "libbase", ], shared_libs: [ diff --git a/thermal/aidl/default/thermal-example.xml b/thermal/aidl/default/thermal-example.xml index bdee7446f05b6111c7564cd8c9ad2e3c1ead5204..08dc68ca046e6af0992daa71e8bcdfa611803184 100644 --- a/thermal/aidl/default/thermal-example.xml +++ b/thermal/aidl/default/thermal-example.xml @@ -1,7 +1,7 @@ android.hardware.thermal - 1 + 2 IThermal/default diff --git a/thermal/aidl/vts/Android.bp b/thermal/aidl/vts/Android.bp index b00eb33b1d9a1dd81383669e7fdfef33f5b66731..0812811738bb3be5dfa9c884b1b5a9b4f2402431 100644 --- a/thermal/aidl/vts/Android.bp +++ b/thermal/aidl/vts/Android.bp @@ -32,7 +32,7 @@ cc_test { "libbinder_ndk", ], static_libs: [ - "android.hardware.thermal-V1-ndk", + "android.hardware.thermal-V2-ndk", ], test_suites: [ "vts", diff --git a/thermal/aidl/vts/VtsHalThermalTargetTest.cpp b/thermal/aidl/vts/VtsHalThermalTargetTest.cpp index 835fbfa85aa09f1ff938b6d6bb7eb4aa41b9cd4d..4b0eb655b54071898c81ee4893e81b94440ff21e 100644 --- a/thermal/aidl/vts/VtsHalThermalTargetTest.cpp +++ b/thermal/aidl/vts/VtsHalThermalTargetTest.cpp @@ -128,7 +128,8 @@ TEST_P(ThermalAidlTest, RegisterThermalChangedCallbackTest) { ASSERT_EQ(EX_ILLEGAL_ARGUMENT, status.getExceptionCode()); // Expect to fail with null callback status = mThermal->registerThermalChangedCallback(nullptr); - ASSERT_EQ(EX_ILLEGAL_ARGUMENT, status.getExceptionCode()); + ASSERT_TRUE(status.getExceptionCode() == EX_ILLEGAL_ARGUMENT + || status.getExceptionCode() == EX_NULL_POINTER); std::shared_ptr localThermalCallback = ndk::SharedRefBase::make(); // Expect to succeed with different callback @@ -139,7 +140,8 @@ TEST_P(ThermalAidlTest, RegisterThermalChangedCallbackTest) { ASSERT_TRUE(status.isOk()) << status.getMessage(); // Expect to fail with null callback status = mThermal->unregisterThermalChangedCallback(nullptr); - ASSERT_EQ(EX_ILLEGAL_ARGUMENT, status.getExceptionCode()); + ASSERT_TRUE(status.getExceptionCode() == EX_ILLEGAL_ARGUMENT + || status.getExceptionCode() == EX_NULL_POINTER); } // Test Thermal->registerThermalChangedCallbackWithType. @@ -150,7 +152,8 @@ TEST_P(ThermalAidlTest, RegisterThermalChangedCallbackWithTypeTest) { ASSERT_EQ(EX_ILLEGAL_ARGUMENT, status.getExceptionCode()); // Expect to fail with null callback status = mThermal->registerThermalChangedCallbackWithType(nullptr, TemperatureType::SKIN); - ASSERT_EQ(EX_ILLEGAL_ARGUMENT, status.getExceptionCode()); + ASSERT_TRUE(status.getExceptionCode() == EX_ILLEGAL_ARGUMENT + || status.getExceptionCode() == EX_NULL_POINTER); std::shared_ptr localThermalCallback = ndk::SharedRefBase::make(); // Expect to succeed with different callback @@ -162,7 +165,8 @@ TEST_P(ThermalAidlTest, RegisterThermalChangedCallbackWithTypeTest) { ASSERT_TRUE(status.isOk()) << status.getMessage(); // Expect to fail with null callback status = mThermal->unregisterThermalChangedCallback(nullptr); - ASSERT_EQ(EX_ILLEGAL_ARGUMENT, status.getExceptionCode()); + ASSERT_TRUE(status.getExceptionCode() == EX_ILLEGAL_ARGUMENT + || status.getExceptionCode() == EX_NULL_POINTER); } // Test Thermal->getCurrentTemperatures(). diff --git a/tv/input/aidl/Android.bp b/tv/input/aidl/Android.bp index 35f510a1629ed827c8e4dfadad42c306b05d2df6..cd69130f8b83b60d71134ce4cdf13f25db8919f3 100644 --- a/tv/input/aidl/Android.bp +++ b/tv/input/aidl/Android.bp @@ -35,6 +35,5 @@ aidl_interface { ], }, ], - frozen: true, - + frozen: false, } diff --git a/tv/input/aidl/aidl_api/android.hardware.tv.input/current/android/hardware/tv/input/TvMessageEvent.aidl b/tv/input/aidl/aidl_api/android.hardware.tv.input/current/android/hardware/tv/input/TvMessageEvent.aidl index 94fe665d1d145da9c07ebaa2c7efd026e7db143b..3c1cb74860348d5cee4e86a8a7a238b2e31942eb 100644 --- a/tv/input/aidl/aidl_api/android.hardware.tv.input/current/android/hardware/tv/input/TvMessageEvent.aidl +++ b/tv/input/aidl/aidl_api/android.hardware.tv.input/current/android/hardware/tv/input/TvMessageEvent.aidl @@ -37,4 +37,5 @@ parcelable TvMessageEvent { android.hardware.tv.input.TvMessageEventType type; int streamId; android.hardware.tv.input.TvMessage[] messages; + int deviceId; } diff --git a/tv/input/aidl/android/hardware/tv/input/ITvInputCallback.aidl b/tv/input/aidl/android/hardware/tv/input/ITvInputCallback.aidl index a3afd41fd5549c03d474a72c23538c86fc8e682f..4121fc751601e6ebbff6e12ef2327f27fa85678f 100644 --- a/tv/input/aidl/android/hardware/tv/input/ITvInputCallback.aidl +++ b/tv/input/aidl/android/hardware/tv/input/ITvInputCallback.aidl @@ -32,17 +32,20 @@ interface ITvInputCallback { * Notifies the client that an TV message event has occurred. For possible event types, * check {@link android.hardware.tv.input.TvMessageEventType}. * - * The first message in a list of messages contained in a + *

      For implementations of version 1, The first message in a list of messages contained in a * {@link android.hardware.tv.input.TvMessageEvent} should always have a * {@link android.hardware.tv.input.TvMessage#subType} of "device_id", * otherwise the event is discarded. When the subType of a message is "device_id", the ID of * the device that sent the message should be contained in - * {@link android.hardware.tv.input.TvMessage#groupId} + * {@link android.hardware.tv.input.TvMessage#groupId}. * - * Invoking this callback for the first time immediately triggers + *

      For version 2 and beyond, the device ID should be contained in + * {@link android.hardware.tv.input.TvMessageEvent#deviceId}. + * + *

      Invoking this callback for the first time immediately triggers * {@link android.hardware.tv.input.ITvInput#getTvMessageQueueDesc}. It is - * expected for the queue to be ready with - * the relevant messages for the event before this callback is called. + * expected for the queue to be ready with the relevant messages for the event before this + * callback is called. * * @param event Event passed to the client. */ diff --git a/tv/input/aidl/android/hardware/tv/input/TvMessageEvent.aidl b/tv/input/aidl/android/hardware/tv/input/TvMessageEvent.aidl index 74a078a45e8d0cce6b51c1728c543241cc5eb2e7..e04a725e47922317bd691969e41a2cfa69596341 100644 --- a/tv/input/aidl/android/hardware/tv/input/TvMessageEvent.aidl +++ b/tv/input/aidl/android/hardware/tv/input/TvMessageEvent.aidl @@ -25,4 +25,5 @@ parcelable TvMessageEvent { int streamId; TvMessage[] messages; + int deviceId; } diff --git a/tv/input/aidl/default/TvInput.cpp b/tv/input/aidl/default/TvInput.cpp index 2ee8bcfec86c717aa1acc27bde4215c9540e108c..f6a64c4b40869f6ef1d171a8d9d84b1f7a4d4a4e 100644 --- a/tv/input/aidl/default/TvInput.cpp +++ b/tv/input/aidl/default/TvInput.cpp @@ -43,6 +43,9 @@ void TvInput::init() { new TvStreamConfigWrapper(11, 360, 480, false))}}; mStreamConfigs[3] = {{5, shared_ptr( new TvStreamConfigWrapper(5, 1080, 1920, false))}}; + + mQueue = shared_ptr>( + new (std::nothrow) AidlMessageQueue(8)); } ::ndk::ScopedAStatus TvInput::setCallback(const shared_ptr& in_callback) { @@ -74,7 +77,9 @@ void TvInput::init() { return ::ndk::ScopedAStatus::fromServiceSpecificError(STATUS_INVALID_ARGUMENTS); } + // When calling notifyTvMessage, make sure to verify against this map. mTvMessageEventEnabled[deviceId][streamId][in_type] = enabled; + return ::ndk::ScopedAStatus::ok(); } @@ -82,11 +87,17 @@ void TvInput::init() { MQDescriptor* out_queue, int32_t in_deviceId, int32_t in_streamId) { ALOGV("%s", __FUNCTION__); + ::ndk::ScopedAStatus status = ::ndk::ScopedAStatus::ok(); if (mStreamConfigs.count(in_deviceId) == 0) { ALOGW("Device with id %d isn't available", in_deviceId); - return ::ndk::ScopedAStatus::fromServiceSpecificError(STATUS_INVALID_ARGUMENTS); + status = ::ndk::ScopedAStatus::fromServiceSpecificError(STATUS_INVALID_ARGUMENTS); + } else if (!mQueue->isValid()) { + ALOGE("Tv Message Queue was not properly initialized"); + status = ::ndk::ScopedAStatus::fromServiceSpecificError(STATUS_INVALID_STATE); + } else { + *out_queue = mQueue->dupeDesc(); } - return ::ndk::ScopedAStatus::ok(); + return status; } ::ndk::ScopedAStatus TvInput::getStreamConfigurations(int32_t in_deviceId, diff --git a/tv/input/aidl/default/TvInput.h b/tv/input/aidl/default/TvInput.h index 57769618e3665595ce5250ea9fe3331f27a645c6..595f017fff266593357f6b15415d032d85d7a405 100644 --- a/tv/input/aidl/default/TvInput.h +++ b/tv/input/aidl/default/TvInput.h @@ -66,6 +66,7 @@ class TvInput : public BnTvInput { map> mDeviceInfos; map>> mStreamConfigs; TvMessageEnabledMap mTvMessageEventEnabled; + shared_ptr> mQueue; }; } // namespace input diff --git a/tv/input/aidl/vts/functional/Android.bp b/tv/input/aidl/vts/functional/Android.bp index 22487eafb1f93dcdfa7a48dfff978677d41642a3..930c5a808f413400d492e2f2378662c8d2960886 100644 --- a/tv/input/aidl/vts/functional/Android.bp +++ b/tv/input/aidl/vts/functional/Android.bp @@ -32,7 +32,7 @@ cc_test { "libvndksupport", "libfmq", "android.hardware.common.fmq-V1-ndk", - "android.hardware.tv.input-V1-ndk", + "android.hardware.tv.input-V2-ndk", ], require_root: true, } diff --git a/tv/input/aidl/vts/functional/VtsHalTvInputTargetTest.cpp b/tv/input/aidl/vts/functional/VtsHalTvInputTargetTest.cpp index 8d3395b8d21ae0b5fc8ac5e7208882cce8626833..746ae1e1af5fe93b6602712d4a5b5836547bd410 100644 --- a/tv/input/aidl/vts/functional/VtsHalTvInputTargetTest.cpp +++ b/tv/input/aidl/vts/functional/VtsHalTvInputTargetTest.cpp @@ -355,8 +355,12 @@ TEST_P(TvInputAidlTest, GetTvMessageQueueTest) { } int32_t stream_id = streamConfigs[0].streamId; ALOGD("GetTvMessageQueueTest: device_id=%d, stream_id=%d", device_id, stream_id); - MQDescriptor queue; - tv_input_->getTvMessageQueueDesc(&queue, device_id, stream_id); + MQDescriptor queueDescriptor; + AidlMessageQueue* queue; + tv_input_->getTvMessageQueueDesc(&queueDescriptor, device_id, stream_id); + queue = new (std::nothrow) AidlMessageQueue(queueDescriptor); + ASSERT_TRUE(queue->isValid()); + delete queue; } INSTANTIATE_TEST_SUITE_P(PerInstance, TvInputAidlTest, diff --git a/tv/tuner/aidl/default/Android.bp b/tv/tuner/aidl/default/Android.bp index 65fa82163af04fc034492bf0af6b7eb373508f1d..ed97d9cfc7cfef0c31634f85d5c4f4b06e5cab83 100644 --- a/tv/tuner/aidl/default/Android.bp +++ b/tv/tuner/aidl/default/Android.bp @@ -23,6 +23,7 @@ cc_defaults { "TimeFilter.cpp", "Tuner.cpp", "service.cpp", + "dtv_plugin.cpp", ], static_libs: [ "libaidlcommonsupport", diff --git a/tv/tuner/aidl/default/Demux.cpp b/tv/tuner/aidl/default/Demux.cpp index 11e7131220afccb54d249c4f584445715efb2bc3..de94467d1482a7b586a6a7203134d725a623c167 100644 --- a/tv/tuner/aidl/default/Demux.cpp +++ b/tv/tuner/aidl/default/Demux.cpp @@ -20,7 +20,9 @@ #include #include +#include #include +#include #include "Demux.h" namespace aidl { @@ -29,6 +31,15 @@ namespace hardware { namespace tv { namespace tuner { +using ::aidl::android::hardware::common::fmq::MQDescriptor; +using ::aidl::android::hardware::common::fmq::SynchronizedReadWrite; +using ::android::AidlMessageQueue; +using ::android::hardware::EventFlag; + +using FilterMQ = AidlMessageQueue; +using AidlMQ = AidlMessageQueue; +using AidlMQDesc = MQDescriptor; + #define WAIT_TIMEOUT 3000000000 Demux::Demux(int32_t demuxId, uint32_t filterTypes) { @@ -42,9 +53,128 @@ void Demux::setTunerService(std::shared_ptr tuner) { Demux::~Demux() { ALOGV("%s", __FUNCTION__); + if (mDemuxIptvReadThread.joinable()) { + mDemuxIptvReadThread.join(); + } close(); } +::ndk::ScopedAStatus Demux::openDvr(DvrType in_type, int32_t in_bufferSize, + const std::shared_ptr& in_cb, + std::shared_ptr* _aidl_return) { + ALOGV("%s", __FUNCTION__); + + if (in_cb == nullptr) { + ALOGW("[Demux] DVR callback can't be null"); + *_aidl_return = nullptr; + return ::ndk::ScopedAStatus::fromServiceSpecificError( + static_cast(Result::INVALID_ARGUMENT)); + } + + set::iterator it; + switch (in_type) { + case DvrType::PLAYBACK: + mDvrPlayback = ndk::SharedRefBase::make(in_type, in_bufferSize, in_cb, + this->ref()); + if (!mDvrPlayback->createDvrMQ()) { + ALOGE("[Demux] cannot create dvr message queue"); + mDvrPlayback = nullptr; + *_aidl_return = mDvrPlayback; + return ::ndk::ScopedAStatus::fromServiceSpecificError( + static_cast(Result::UNKNOWN_ERROR)); + } + + for (it = mPlaybackFilterIds.begin(); it != mPlaybackFilterIds.end(); it++) { + if (!mDvrPlayback->addPlaybackFilter(*it, mFilters[*it])) { + ALOGE("[Demux] Can't get filter info for DVR playback"); + mDvrPlayback = nullptr; + *_aidl_return = mDvrPlayback; + return ::ndk::ScopedAStatus::fromServiceSpecificError( + static_cast(Result::UNKNOWN_ERROR)); + } + } + + ALOGI("Playback normal case"); + + *_aidl_return = mDvrPlayback; + return ::ndk::ScopedAStatus::ok(); + case DvrType::RECORD: + mDvrRecord = ndk::SharedRefBase::make(in_type, in_bufferSize, in_cb, + this->ref()); + if (!mDvrRecord->createDvrMQ()) { + mDvrRecord = nullptr; + *_aidl_return = mDvrRecord; + return ::ndk::ScopedAStatus::fromServiceSpecificError( + static_cast(Result::UNKNOWN_ERROR)); + } + + *_aidl_return = mDvrRecord; + return ::ndk::ScopedAStatus::ok(); + default: + *_aidl_return = nullptr; + return ::ndk::ScopedAStatus::fromServiceSpecificError( + static_cast(Result::INVALID_ARGUMENT)); + } +} + +void Demux::setIptvThreadRunning(bool isIptvThreadRunning) { + std::unique_lock lock(mIsIptvThreadRunningMutex); + mIsIptvReadThreadRunning = isIptvThreadRunning; + mIsIptvThreadRunningCv.notify_all(); +} + +void Demux::readIptvThreadLoop(dtv_plugin* interface, dtv_streamer* streamer, size_t buf_size, + int timeout_ms, int buffer_timeout) { + Timer *timer, *fullBufferTimer; + while (true) { + std::unique_lock lock(mIsIptvThreadRunningMutex); + mIsIptvThreadRunningCv.wait(lock, [this] { return mIsIptvReadThreadRunning; }); + if (mIsIptvDvrFMQFull && fullBufferTimer->get_elapsed_time_ms() > buffer_timeout) { + ALOGE("DVR FMQ has not been flushed within timeout of %d ms", buffer_timeout); + delete fullBufferTimer; + break; + } + timer = new Timer(); + void* buf = malloc(sizeof(char) * IPTV_BUFFER_SIZE); + if (buf == nullptr) ALOGI("Buffer allocation failed"); + ssize_t bytes_read = interface->read_stream(streamer, buf, buf_size, timeout_ms); + if (bytes_read == 0) { + double elapsed_time = timer->get_elapsed_time_ms(); + if (elapsed_time > timeout_ms) { + ALOGE("[Demux] timeout reached - elapsed_time: %f, timeout: %d", elapsed_time, + timeout_ms); + } + ALOGE("[Demux] Cannot read data from the socket"); + delete timer; + break; + } + + delete timer; + ALOGI("Number of bytes read: %zd", bytes_read); + int result = mDvrPlayback->writePlaybackFMQ(buf, bytes_read); + + switch (result) { + case DVR_WRITE_FAILURE_REASON_FMQ_FULL: + if (!mIsIptvDvrFMQFull) { + mIsIptvDvrFMQFull = true; + fullBufferTimer = new Timer(); + } + ALOGI("Waiting for client to flush DVR FMQ."); + break; + case DVR_WRITE_FAILURE_REASON_UNKNOWN: + ALOGE("Failed to write data into DVR FMQ for unknown reason"); + break; + case DVR_WRITE_SUCCESS: + ALOGI("Wrote %zd bytes to DVR FMQ", bytes_read); + break; + default: + ALOGI("Invalid DVR Status"); + } + + free(buf); + } +} + ::ndk::ScopedAStatus Demux::setFrontendDataSource(int32_t in_frontendId) { ALOGV("%s", __FUNCTION__); @@ -52,7 +182,6 @@ Demux::~Demux() { return ::ndk::ScopedAStatus::fromServiceSpecificError( static_cast(Result::NOT_INITIALIZED)); } - mFrontend = mTuner->getFrontendById(in_frontendId); if (mFrontend == nullptr) { return ::ndk::ScopedAStatus::fromServiceSpecificError( @@ -61,6 +190,49 @@ Demux::~Demux() { mTuner->setFrontendAsDemuxSource(in_frontendId, mDemuxId); + // if mFrontend is an IPTV frontend, create streamer to read TS data from socket + if (mFrontend->getFrontendType() == FrontendType::IPTV) { + // create a DVR instance on the demux + shared_ptr iptvDvr; + + std::shared_ptr dvrPlaybackCallback = + ::ndk::SharedRefBase::make(); + + ::ndk::ScopedAStatus status = + openDvr(DvrType::PLAYBACK, IPTV_BUFFER_SIZE, dvrPlaybackCallback, &iptvDvr); + if (status.isOk()) { + ALOGI("DVR instance created"); + } + + // get plugin interface from frontend + dtv_plugin* interface = mFrontend->getIptvPluginInterface(); + if (interface == nullptr) { + ALOGE("[Demux] getIptvPluginInterface(): plugin interface is null"); + return ::ndk::ScopedAStatus::fromServiceSpecificError( + static_cast(Result::INVALID_STATE)); + } + ALOGI("[Demux] getIptvPluginInterface(): plugin interface is not null"); + + // get streamer object from Frontend instance + dtv_streamer* streamer = mFrontend->getIptvPluginStreamer(); + if (streamer == nullptr) { + ALOGE("[Demux] getIptvPluginStreamer(): streamer is null"); + return ::ndk::ScopedAStatus::fromServiceSpecificError( + static_cast(Result::INVALID_STATE)); + } + ALOGI("[Demux] getIptvPluginStreamer(): streamer is not null"); + + // get transport description from frontend + string transport_desc = mFrontend->getIptvTransportDescription(); + ALOGI("[Demux] getIptvTransportDescription(): transport_desc: %s", transport_desc.c_str()); + + // call read_stream on the socket to populate the buffer with TS data + // while thread is alive, keep reading data + int timeout_ms = 20; + int buffer_timeout = 10000; // 10s + mDemuxIptvReadThread = std::thread(&Demux::readIptvThreadLoop, this, interface, streamer, + IPTV_BUFFER_SIZE, timeout_ms, buffer_timeout); + } return ::ndk::ScopedAStatus::ok(); } @@ -193,61 +365,6 @@ Demux::~Demux() { return ::ndk::ScopedAStatus::ok(); } -::ndk::ScopedAStatus Demux::openDvr(DvrType in_type, int32_t in_bufferSize, - const std::shared_ptr& in_cb, - std::shared_ptr* _aidl_return) { - ALOGV("%s", __FUNCTION__); - - if (in_cb == nullptr) { - ALOGW("[Demux] DVR callback can't be null"); - *_aidl_return = nullptr; - return ::ndk::ScopedAStatus::fromServiceSpecificError( - static_cast(Result::INVALID_ARGUMENT)); - } - - set::iterator it; - switch (in_type) { - case DvrType::PLAYBACK: - mDvrPlayback = ndk::SharedRefBase::make(in_type, in_bufferSize, in_cb, - this->ref()); - if (!mDvrPlayback->createDvrMQ()) { - mDvrPlayback = nullptr; - *_aidl_return = mDvrPlayback; - return ::ndk::ScopedAStatus::fromServiceSpecificError( - static_cast(Result::UNKNOWN_ERROR)); - } - - for (it = mPlaybackFilterIds.begin(); it != mPlaybackFilterIds.end(); it++) { - if (!mDvrPlayback->addPlaybackFilter(*it, mFilters[*it])) { - ALOGE("[Demux] Can't get filter info for DVR playback"); - mDvrPlayback = nullptr; - *_aidl_return = mDvrPlayback; - return ::ndk::ScopedAStatus::fromServiceSpecificError( - static_cast(Result::UNKNOWN_ERROR)); - } - } - - *_aidl_return = mDvrPlayback; - return ::ndk::ScopedAStatus::ok(); - case DvrType::RECORD: - mDvrRecord = ndk::SharedRefBase::make(in_type, in_bufferSize, in_cb, - this->ref()); - if (!mDvrRecord->createDvrMQ()) { - mDvrRecord = nullptr; - *_aidl_return = mDvrRecord; - return ::ndk::ScopedAStatus::fromServiceSpecificError( - static_cast(Result::UNKNOWN_ERROR)); - } - - *_aidl_return = mDvrRecord; - return ::ndk::ScopedAStatus::ok(); - default: - *_aidl_return = nullptr; - return ::ndk::ScopedAStatus::fromServiceSpecificError( - static_cast(Result::INVALID_ARGUMENT)); - } -} - ::ndk::ScopedAStatus Demux::connectCiCam(int32_t in_ciCamId) { ALOGV("%s", __FUNCTION__); diff --git a/tv/tuner/aidl/default/Demux.h b/tv/tuner/aidl/default/Demux.h index 7d7aee4c8928731b21a20a622272184a5734836d..ad7b7a77a1ad6fd602bd1628a50d06cfad77004e 100644 --- a/tv/tuner/aidl/default/Demux.h +++ b/tv/tuner/aidl/default/Demux.h @@ -17,6 +17,7 @@ #pragma once #include +#include #include #include @@ -28,7 +29,9 @@ #include "Filter.h" #include "Frontend.h" #include "TimeFilter.h" +#include "Timer.h" #include "Tuner.h" +#include "dtv_plugin.h" using namespace std; @@ -44,6 +47,8 @@ using ::android::AidlMessageQueue; using ::android::hardware::EventFlag; using FilterMQ = AidlMessageQueue; +using AidlMQ = AidlMessageQueue; +using AidlMQDesc = MQDescriptor; class Dvr; class Filter; @@ -51,6 +56,19 @@ class Frontend; class TimeFilter; class Tuner; +class DvrPlaybackCallback : public BnDvrCallback { + public: + virtual ::ndk::ScopedAStatus onPlaybackStatus(PlaybackStatus status) override { + ALOGD("demux.h: playback status %d", status); + return ndk::ScopedAStatus::ok(); + } + + virtual ::ndk::ScopedAStatus onRecordStatus(RecordStatus status) override { + ALOGD("Record Status %hhd", status); + return ndk::ScopedAStatus::ok(); + } +}; + class Demux : public BnDemux { public: Demux(int32_t demuxId, uint32_t filterTypes); @@ -85,6 +103,8 @@ class Demux : public BnDemux { void setIsRecording(bool isRecording); bool isRecording(); void startFrontendInputLoop(); + void readIptvThreadLoop(dtv_plugin* interface, dtv_streamer* streamer, size_t size, + int timeout_ms, int buffer_timeout); /** * A dispatcher to read and dispatch input data to all the started filters. @@ -104,6 +124,11 @@ class Demux : public BnDemux { void setInUse(bool inUse); void setTunerService(std::shared_ptr tuner); + /** + * Setter for IPTV Reading thread + */ + void setIptvThreadRunning(bool isIptvThreadRunning); + private: // Tuner service std::shared_ptr mTuner; @@ -167,6 +192,10 @@ class Demux : public BnDemux { // Thread handlers std::thread mFrontendInputThread; + std::thread mDemuxIptvReadThread; + + // track whether the DVR FMQ for IPTV Playback is full + bool mIsIptvDvrFMQFull = false; /** * If a specific filter's writing loop is still running @@ -174,6 +203,13 @@ class Demux : public BnDemux { std::atomic mFrontendInputThreadRunning; std::atomic mKeepFetchingDataFromFrontend; + /** + * Controls IPTV reading thread status + */ + bool mIsIptvReadThreadRunning; + std::mutex mIsIptvThreadRunningMutex; + std::condition_variable mIsIptvThreadRunningCv; + /** * If the dvr recording is running. */ diff --git a/tv/tuner/aidl/default/Dvr.cpp b/tv/tuner/aidl/default/Dvr.cpp index c046ae3130d3ed9274cf68acc931479d2d46c316..393200cb4b4c39a8e1f3fd09941228e6248544f3 100644 --- a/tv/tuner/aidl/default/Dvr.cpp +++ b/tv/tuner/aidl/default/Dvr.cpp @@ -236,6 +236,25 @@ void Dvr::playbackThreadLoop() { ALOGD("[Dvr] playback thread ended."); } +void Dvr::maySendIptvPlaybackStatusCallback() { + lock_guard lock(mPlaybackStatusLock); + int availableToRead = mDvrMQ->availableToRead(); + int availableToWrite = mDvrMQ->availableToWrite(); + + PlaybackStatus newStatus = checkPlaybackStatusChange(availableToWrite, availableToRead, + IPTV_PLAYBACK_STATUS_THRESHOLD_HIGH, + IPTV_PLAYBACK_STATUS_THRESHOLD_LOW); + if (mPlaybackStatus != newStatus) { + map>::iterator it; + for (it = mFilters.begin(); it != mFilters.end(); it++) { + std::shared_ptr currentFilter = it->second; + currentFilter->setIptvDvrPlaybackStatus(newStatus); + } + mCallback->onPlaybackStatus(newStatus); + mPlaybackStatus = newStatus; + } +} + void Dvr::maySendPlaybackStatusCallback() { lock_guard lock(mPlaybackStatusLock); int availableToRead = mDvrMQ->availableToRead(); @@ -379,7 +398,7 @@ bool Dvr::processEsDataOnPlayback(bool isVirtualFrontend, bool isRecording) { // Read es raw data from the FMQ per meta data built previously vector frameData; - map>::iterator it; + map>::iterator it; int pid = 0; for (int i = 0; i < totalFrames; i++) { frameData.resize(esMeta[i].len); @@ -411,7 +430,7 @@ void Dvr::getMetaDataValue(int& index, int8_t* dataOutputBuffer, int& value) { } void Dvr::startTpidFilter(vector data) { - map>::iterator it; + map>::iterator it; for (it = mFilters.begin(); it != mFilters.end(); it++) { uint16_t pid = ((data[1] & 0x1f) << 8) | ((data[2] & 0xff)); if (DEBUG_DVR) { @@ -432,7 +451,7 @@ bool Dvr::startFilterDispatcher(bool isVirtualFrontend, bool isRecording) { } } - map>::iterator it; + map>::iterator it; // Handle the output data per filter type for (it = mFilters.begin(); it != mFilters.end(); it++) { if (!mDemux->startFilterHandler(it->first).isOk()) { @@ -443,6 +462,24 @@ bool Dvr::startFilterDispatcher(bool isVirtualFrontend, bool isRecording) { return true; } +int Dvr::writePlaybackFMQ(void* buf, size_t size) { + lock_guard lock(mWriteLock); + ALOGI("Playback status: %d", mPlaybackStatus); + if (mPlaybackStatus == PlaybackStatus::SPACE_FULL) { + ALOGW("[Dvr] stops writing and wait for the client side flushing."); + return DVR_WRITE_FAILURE_REASON_FMQ_FULL; + } + ALOGI("availableToWrite before: %zu", mDvrMQ->availableToWrite()); + if (mDvrMQ->write((int8_t*)buf, size)) { + mDvrEventFlag->wake(static_cast(DemuxQueueNotifyBits::DATA_READY)); + ALOGI("availableToWrite: %zu", mDvrMQ->availableToWrite()); + maySendIptvPlaybackStatusCallback(); + return DVR_WRITE_SUCCESS; + } + maySendIptvPlaybackStatusCallback(); + return DVR_WRITE_FAILURE_REASON_UNKNOWN; +} + bool Dvr::writeRecordFMQ(const vector& data) { lock_guard lock(mWriteLock); if (mRecordStatus == RecordStatus::OVERFLOW) { @@ -486,7 +523,7 @@ RecordStatus Dvr::checkRecordStatusChange(uint32_t availableToWrite, uint32_t av return mRecordStatus; } -bool Dvr::addPlaybackFilter(int64_t filterId, std::shared_ptr filter) { +bool Dvr::addPlaybackFilter(int64_t filterId, std::shared_ptr filter) { mFilters[filterId] = filter; return true; } diff --git a/tv/tuner/aidl/default/Dvr.h b/tv/tuner/aidl/default/Dvr.h index 293c533cfcfdb5096561e099947a8f50ed628a2a..07f95ad966ec8f90e3c0b5265208a4d117abfdf5 100644 --- a/tv/tuner/aidl/default/Dvr.h +++ b/tv/tuner/aidl/default/Dvr.h @@ -43,6 +43,19 @@ using ::android::hardware::EventFlag; using DvrMQ = AidlMessageQueue; +const int DVR_WRITE_SUCCESS = 0; +const int DVR_WRITE_FAILURE_REASON_FMQ_FULL = 1; +const int DVR_WRITE_FAILURE_REASON_UNKNOWN = 2; + +const int TS_SIZE = 188; +const int IPTV_BUFFER_SIZE = TS_SIZE * 7 * 8; // defined in service_streamer_udp in cbs v3 project + +// Thresholds are defined to indicate how full the buffers are. +const double HIGH_THRESHOLD_PERCENT = 0.90; +const double LOW_THRESHOLD_PERCENT = 0.15; +const int IPTV_PLAYBACK_STATUS_THRESHOLD_HIGH = IPTV_BUFFER_SIZE * HIGH_THRESHOLD_PERCENT; +const int IPTV_PLAYBACK_STATUS_THRESHOLD_LOW = IPTV_BUFFER_SIZE * LOW_THRESHOLD_PERCENT; + struct MediaEsMetaData { bool isAudio; int startIndex; @@ -80,8 +93,9 @@ class Dvr : public BnDvr { * Return false is any of the above processes fails. */ bool createDvrMQ(); + int writePlaybackFMQ(void* buf, size_t size); bool writeRecordFMQ(const std::vector& data); - bool addPlaybackFilter(int64_t filterId, std::shared_ptr filter); + bool addPlaybackFilter(int64_t filterId, std::shared_ptr filter); bool removePlaybackFilter(int64_t filterId); bool readPlaybackFMQ(bool isVirtualFrontend, bool isRecording); bool processEsDataOnPlayback(bool isVirtualFrontend, bool isRecording); @@ -96,12 +110,13 @@ class Dvr : public BnDvr { DvrType mType; uint32_t mBufferSize; std::shared_ptr mCallback; - std::map> mFilters; + std::map> mFilters; void deleteEventFlag(); bool readDataFromMQ(); void getMetaDataValue(int& index, int8_t* dataOutputBuffer, int& value); void maySendPlaybackStatusCallback(); + void maySendIptvPlaybackStatusCallback(); void maySendRecordStatusCallback(); PlaybackStatus checkPlaybackStatusChange(uint32_t availableToWrite, uint32_t availableToRead, int64_t highThreshold, int64_t lowThreshold); diff --git a/tv/tuner/aidl/default/Filter.cpp b/tv/tuner/aidl/default/Filter.cpp index ba9602e272b1046fd3a69e103c8365f026b42508..212d329cdcfb04a0d3b5b463a2a51a8347b0cbb7 100644 --- a/tv/tuner/aidl/default/Filter.cpp +++ b/tv/tuner/aidl/default/Filter.cpp @@ -326,6 +326,10 @@ Filter::~Filter() { ALOGV("%s", __FUNCTION__); mFilterThreadRunning = true; std::vector events; + + mFilterCount += 1; + mDemux->setIptvThreadRunning(true); + // All the filter event callbacks in start are for testing purpose. switch (mType.mainType) { case DemuxFilterMainType::TS: @@ -362,6 +366,11 @@ Filter::~Filter() { ::ndk::ScopedAStatus Filter::stop() { ALOGV("%s", __FUNCTION__); + mFilterCount -= 1; + if (mFilterCount == 0) { + mDemux->setIptvThreadRunning(false); + } + mFilterThreadRunning = false; if (mFilterThread.joinable()) { mFilterThread.join(); @@ -565,6 +574,8 @@ void Filter::filterThreadLoop() { ALOGD("[Filter] filter %" PRIu64 " threadLoop start.", mFilterId); + ALOGI("IPTV DVR Playback status on Filter: %d", mIptvDvrPlaybackStatus); + // For the first time of filter output, implementation needs to send the filter // Event Callback without waiting for the DATA_CONSUMED to init the process. while (mFilterThreadRunning) { diff --git a/tv/tuner/aidl/default/Filter.h b/tv/tuner/aidl/default/Filter.h index 09852966573bc66cea9b2eef5bed7a7889f59186..e2a0c7abfac37b783e90925265decfc71ffa93cb 100644 --- a/tv/tuner/aidl/default/Filter.h +++ b/tv/tuner/aidl/default/Filter.h @@ -147,6 +147,7 @@ class Filter : public BnFilter { bool isMediaFilter() { return mIsMediaFilter; }; bool isPcrFilter() { return mIsPcrFilter; }; bool isRecordFilter() { return mIsRecordFilter; }; + void setIptvDvrPlaybackStatus(PlaybackStatus newStatus) { mIptvDvrPlaybackStatus = newStatus; }; private: // Demux service @@ -286,6 +287,9 @@ class Filter : public BnFilter { int mStartId = 0; uint8_t mScramblingStatusMonitored = 0; uint8_t mIpCidMonitored = 0; + + PlaybackStatus mIptvDvrPlaybackStatus; + std::atomic mFilterCount = 0; }; } // namespace tuner diff --git a/tv/tuner/aidl/default/Frontend.cpp b/tv/tuner/aidl/default/Frontend.cpp index cd072bfe8d86527f0ece769832d8f421dcfd0b24..57ed1ba4f909df289c30236259dd70be29520f0f 100644 --- a/tv/tuner/aidl/default/Frontend.cpp +++ b/tv/tuner/aidl/default/Frontend.cpp @@ -34,6 +34,8 @@ Frontend::Frontend(FrontendType type, int32_t id) { mTuner = nullptr; // Init callback to nullptr mCallback = nullptr; + mIptvPluginInterface = nullptr; + mIptvPluginStreamer = nullptr; switch (mType) { case FrontendType::ISDBS: { @@ -213,21 +215,83 @@ Frontend::~Frontend() { return ::ndk::ScopedAStatus::ok(); } -::ndk::ScopedAStatus Frontend::tune(const FrontendSettings& /* in_settings */) { - ALOGV("%s", __FUNCTION__); +void Frontend::readTuneByte(dtv_streamer* streamer, void* buf, size_t buf_size, int timeout_ms) { + ssize_t bytes_read = mIptvPluginInterface->read_stream(streamer, buf, buf_size, timeout_ms); + if (bytes_read <= 0) { + ALOGI("[ ERROR ] Tune byte couldn't be read."); + return; + } + mCallback->onEvent(FrontendEventType::LOCKED); + mIsLocked = true; +} + +::ndk::ScopedAStatus Frontend::tune(const FrontendSettings& in_settings) { if (mCallback == nullptr) { - ALOGW("[ WARN ] Frontend callback is not set when tune"); + ALOGW("[ WARN ] Frontend callback is not set for tunin0g"); return ::ndk::ScopedAStatus::fromServiceSpecificError( static_cast(Result::INVALID_STATE)); } if (mType != FrontendType::IPTV) { mTuner->frontendStartTune(mId); + mCallback->onEvent(FrontendEventType::LOCKED); + mIsLocked = true; + } else { + // This is a reference implementation for IPTV. It uses an additional socket buffer. + // Vendors can use hardware memory directly to make the implementation more performant. + ALOGI("[ INFO ] Frontend type is set to IPTV, tag = %d id=%d", in_settings.getTag(), + mId); + + // load udp plugin for reading TS data + const char* path = "/vendor/lib/iptv_udp_plugin.so"; + DtvPlugin* plugin = new DtvPlugin(path); + if (!plugin) { + ALOGE("Failed to create DtvPlugin, plugin_path is invalid"); + return ::ndk::ScopedAStatus::fromServiceSpecificError( + static_cast(Result::INVALID_ARGUMENT)); + } + bool plugin_loaded = plugin->load(); + if (!plugin_loaded) { + ALOGE("Failed to load plugin"); + return ::ndk::ScopedAStatus::fromServiceSpecificError( + static_cast(Result::INVALID_ARGUMENT)); + } + mIptvPluginInterface = plugin->interface(); + + // validate content_url format + std::string content_url = in_settings.get()->contentUrl; + std::string transport_desc = "{ \"uri\": \"" + content_url + "\"}"; + ALOGI("[ INFO ] transport_desc: %s", transport_desc.c_str()); + bool is_transport_desc_valid = plugin->validate(transport_desc.c_str()); + if (!is_transport_desc_valid) { // not of format protocol://ip:port + ALOGE("[ INFO ] transport_desc is not valid"); + return ::ndk::ScopedAStatus::fromServiceSpecificError( + static_cast(Result::INVALID_ARGUMENT)); + } + mIptvTransportDescription = transport_desc; + + // create a streamer and open it for reading data + dtv_streamer* streamer = mIptvPluginInterface->create_streamer(); + mIptvPluginStreamer = streamer; + int open_fd = mIptvPluginInterface->open_stream(streamer, transport_desc.c_str()); + if (open_fd < 0) { + ALOGE("[ INFO ] could not open stream"); + return ::ndk::ScopedAStatus::fromServiceSpecificError( + static_cast(Result::INVALID_ARGUMENT)); + } + ALOGI("[ INFO ] open_stream successful, open_fd=%d", open_fd); + + size_t buf_size = 1; + int timeout_ms = 2000; + void* buf = malloc(sizeof(char) * buf_size); + if (buf == nullptr) ALOGI("malloc buf failed [TUNE]"); + ALOGI("[ INFO ] [Tune] Allocated buffer of size %zu", buf_size); + mIptvFrontendTuneThread = + std::thread(&Frontend::readTuneByte, this, streamer, buf, buf_size, timeout_ms); + if (mIptvFrontendTuneThread.joinable()) mIptvFrontendTuneThread.join(); + free(buf); } - mCallback->onEvent(FrontendEventType::LOCKED); - mIsLocked = true; - return ::ndk::ScopedAStatus::ok(); } @@ -1002,6 +1066,18 @@ int32_t Frontend::getFrontendId() { return mId; } +dtv_plugin* Frontend::getIptvPluginInterface() { + return mIptvPluginInterface; +} + +string Frontend::getIptvTransportDescription() { + return mIptvTransportDescription; +} + +dtv_streamer* Frontend::getIptvPluginStreamer() { + return mIptvPluginStreamer; +} + bool Frontend::supportsSatellite() { return mType == FrontendType::DVBS || mType == FrontendType::ISDBS || mType == FrontendType::ISDBS3; diff --git a/tv/tuner/aidl/default/Frontend.h b/tv/tuner/aidl/default/Frontend.h index 85bd636cc48958651f9d2269a571d860fc44d246..17a1aeeb40b043709608eadcf1de429d7c0a36d0 100644 --- a/tv/tuner/aidl/default/Frontend.h +++ b/tv/tuner/aidl/default/Frontend.h @@ -21,6 +21,7 @@ #include #include #include "Tuner.h" +#include "dtv_plugin.h" using namespace std; @@ -60,6 +61,10 @@ class Frontend : public BnFrontend { FrontendType getFrontendType(); int32_t getFrontendId(); string getSourceFile(); + dtv_plugin* getIptvPluginInterface(); + string getIptvTransportDescription(); + dtv_streamer* getIptvPluginStreamer(); + void readTuneByte(dtv_streamer* streamer, void* buf, size_t size, int timeout_ms); bool isLocked(); void getFrontendInfo(FrontendInfo* _aidl_return); void setTunerService(std::shared_ptr tuner); @@ -81,6 +86,10 @@ class Frontend : public BnFrontend { std::ifstream mFrontendData; FrontendCapabilities mFrontendCaps; vector mFrontendStatusCaps; + dtv_plugin* mIptvPluginInterface; + string mIptvTransportDescription; + dtv_streamer* mIptvPluginStreamer; + std::thread mIptvFrontendTuneThread; }; } // namespace tuner diff --git a/tv/tuner/aidl/default/Timer.h b/tv/tuner/aidl/default/Timer.h new file mode 100644 index 0000000000000000000000000000000000000000..c6327cbbe7814cb6101cc4bee5acea98f600d0bd --- /dev/null +++ b/tv/tuner/aidl/default/Timer.h @@ -0,0 +1,17 @@ +#include +using namespace std::chrono; +class Timer { + public: + Timer() { start_time = steady_clock::now(); } + + ~Timer() { stop_time = steady_clock::now(); } + + double get_elapsed_time_ms() { + auto current_time = std::chrono::steady_clock::now(); + return duration_cast(current_time - start_time).count(); + } + + private: + time_point start_time; + time_point stop_time; +}; \ No newline at end of file diff --git a/tv/tuner/aidl/default/dtv_plugin.cpp b/tv/tuner/aidl/default/dtv_plugin.cpp new file mode 100644 index 0000000000000000000000000000000000000000..4e73ee58784e6ddec498e7e32c829961b18ceabb --- /dev/null +++ b/tv/tuner/aidl/default/dtv_plugin.cpp @@ -0,0 +1,130 @@ +#include "dtv_plugin.h" +#include +#include +#include + +DtvPlugin::DtvPlugin(const char* plugin_path) { + path_ = plugin_path; + basename_ = basename(path_); + module_ = NULL; + interface_ = NULL; + loaded_ = false; +} + +DtvPlugin::~DtvPlugin() { + if (module_ != NULL) { + if (dlclose(module_)) ALOGE("DtvPlugin: Failed to close plugin '%s'", basename_); + } +} + +bool DtvPlugin::load() { + ALOGI("Loading plugin '%s' from path '%s'", basename_, path_); + + module_ = dlopen(path_, RTLD_LAZY); + if (module_ == NULL) { + ALOGE("DtvPlugin::Load::Failed to load plugin '%s'", basename_); + ALOGE("dlopen error: %s", dlerror()); + return false; + } + + interface_ = (dtv_plugin*)dlsym(module_, "plugin_entry"); + + if (interface_ == NULL) { + ALOGE("plugin_entry is NULL."); + goto error; + } + + if (!interface_->get_transport_types || !interface_->get_streamer_count || + !interface_->validate || !interface_->create_streamer || !interface_->destroy_streamer || + !interface_->open_stream || !interface_->close_stream || !interface_->read_stream) { + ALOGW("Plugin: missing one or more callbacks"); + goto error; + } + + loaded_ = true; + + return true; + +error: + if (dlclose(module_)) ALOGE("Failed to close plugin '%s'", basename_); + + return false; +} + +int DtvPlugin::getStreamerCount() { + if (!loaded_) { + ALOGE("DtvPlugin::GetStreamerCount: Plugin '%s' not loaded!", basename_); + return 0; + } + + return interface_->get_streamer_count(); +} + +bool DtvPlugin::isTransportTypeSupported(const char* transport_type) { + const char** transport; + + if (!loaded_) { + ALOGE("Plugin '%s' not loaded!", basename_); + return false; + } + + transport = interface_->get_transport_types(); + if (transport == NULL) return false; + + while (*transport) { + if (strcmp(transport_type, *transport) == 0) return true; + transport++; + } + + return false; +} + +bool DtvPlugin::validate(const char* transport_desc) { + if (!loaded_) { + ALOGE("Plugin '%s' is not loaded!", basename_); + return false; + } + + return interface_->validate(transport_desc); +} + +bool DtvPlugin::getProperty(const char* key, void* value, int* size) { + if (!loaded_) { + ALOGE("Plugin '%s' is not loaded!", basename_); + return false; + } + + if (!interface_->get_property) return false; + + *size = interface_->get_property(NULL, key, value, *size); + + return *size < 0 ? false : true; +} + +bool DtvPlugin::setProperty(const char* key, const void* value, int size) { + int ret; + + if (!loaded_) { + ALOGE("Plugin '%s': not loaded!", basename_); + return false; + } + + if (!interface_->set_property) return false; + + ret = interface_->set_property(NULL, key, value, size); + + return ret < 0 ? false : true; +} + +struct dtv_plugin* DtvPlugin::interface() { + if (!loaded_) { + ALOGE("Plugin '%s' is not loaded!", basename_); + return NULL; + } + + return interface_; +} + +const char* DtvPlugin::pluginBasename() { + return basename_; +} diff --git a/tv/tuner/aidl/default/dtv_plugin.h b/tv/tuner/aidl/default/dtv_plugin.h new file mode 100644 index 0000000000000000000000000000000000000000..0ee5489d2af4f5244cd5725f4d03accbbea1c151 --- /dev/null +++ b/tv/tuner/aidl/default/dtv_plugin.h @@ -0,0 +1,31 @@ +#ifndef LIVE_DTV_PLUGIN_H_ +#define LIVE_DTV_PLUGIN_H_ + +#include +#include "dtv_plugin_api.h" + +class DtvPlugin { + public: + DtvPlugin(const char* plugin_path); + ~DtvPlugin(); + + bool load(); + int getStreamerCount(); + bool validate(const char* transport_desc); + bool isTransportTypeSupported(const char* transport_type); + // /* plugin-wide properties */ + bool getProperty(const char* key, void* value, int* size); + bool setProperty(const char* key, const void* value, int size); + + struct dtv_plugin* interface(); + const char* pluginBasename(); + + protected: + const char* path_; + char* basename_; + void* module_; + struct dtv_plugin* interface_; + bool loaded_; +}; + +#endif // LIVE_DTV_PLUGIN_H_ diff --git a/tv/tuner/aidl/default/dtv_plugin_api.h b/tv/tuner/aidl/default/dtv_plugin_api.h new file mode 100644 index 0000000000000000000000000000000000000000..8fe7c1d24e66f8583f6981f99676e430c1b3e0c7 --- /dev/null +++ b/tv/tuner/aidl/default/dtv_plugin_api.h @@ -0,0 +1,137 @@ +#ifndef LIVE_DTV_PLUGIN_API_H_ +#define LIVE_DTV_PLUGIN_API_H_ + +#include + +struct dtv_streamer; + +struct dtv_plugin { + uint32_t version; + + /** + * get_transport_types() - Retrieve a list of supported transport types. + * + * Return: A NULL-terminated list of supported transport types. + */ + const char** (*get_transport_types)(void); + + /** + * get_streamer_count() - Get number of streamers that can be created. + * + * Return: The number of streamers that can be created. + */ + int (*get_streamer_count)(void); + + /** + * validate() - Check if transport description is valid. + * @transport_desc: NULL-terminated transport description in json format. + * + * Return: 1 if valid, 0 otherwise. + */ + int (*validate)(const char* transport_desc); + + /** + * create_streamer() - Create a streamer object. + * + * Return: A pointer to a new streamer object. + */ + struct dtv_streamer* (*create_streamer)(void); + + /** + * destroy_streamer() - Free a streamer object and all associated resources. + * @st: Pointer to a streamer object + */ + void (*destroy_streamer)(struct dtv_streamer* streamer); + + /** + * set_property() - Set a key/value pair property. + * @streamer: Pointer to a streamer object (may be NULL for plugin-wide properties). + * @key: NULL-terminated property name. + * @value: Property value. + * @size: Property value size. + * + * Return: 0 if success, -1 otherwise. + */ + int (*set_property)(struct dtv_streamer* streamer, const char* key, const void* value, + size_t size); + + /** + * get_property() - Get a property's value. + * @streamer: Pointer to a streamer (may be NULL for plugin-wide properties). + * @key: NULL-terminated property name. + * @value: Property value. + * @size: Property value size. + * + * Return: >= 0 if success, -1 otherwise. + * + * If size is 0, get_property will return the size needed to hold the value. + */ + int (*get_property)(struct dtv_streamer* streamer, const char* key, void* value, size_t size); + + /** + * add_pid() - Add a TS filter on a given pid. + * @streamer: The streamer that outputs the TS. + * @pid: The pid to add to the TS output. + * + * Return: 0 if success, -1 otherwise. + * + * This function is optional but can be useful if a hardware remux is + * available. + */ + int (*add_pid)(struct dtv_streamer* streamer, int pid); + + /** + * remove_pid() - Remove a TS filter on a given pid. + * @streamer: The streamer that outputs the TS. + * @pid: The pid to remove from the TS output. + * + * Return: 0 if success, -1 otherwise. + * + * This function is optional. + */ + int (*remove_pid)(struct dtv_streamer* streamer, int pid); + + /** + * open_stream() - Open a stream from a transport description. + * @streamer: The streamer which will handle the stream. + * @transport_desc: NULL-terminated transport description in json format. + * + * The streamer will allocate the resources and make the appropriate + * connections to handle this transport. + * This function returns a file descriptor that can be polled for events. + * + * Return: A file descriptor if success, -1 otherwise. + */ + int (*open_stream)(struct dtv_streamer* streamer, const char* transport_desc); + + /** + * close_stream() - Release an open stream. + * @streamer: The streamer from which the stream should be released. + */ + void (*close_stream)(struct dtv_streamer* streamer); + + /** + * read_stream() - Read stream data. + * @streamer: The streamer to read from. + * @buf: The destination buffer. + * @count: The number of bytes to read. + * @timeout_ms: Timeout in ms. + * + * Return: The number of bytes read, -1 if error. + */ + ssize_t (*read_stream)(struct dtv_streamer* streamer, void* buf, size_t count, int timeout_ms); +}; + +struct dtv_plugin_event { + int id; + char data[0]; +}; + +enum { + DTV_PLUGIN_EVENT_SIGNAL_LOST = 1, + DTV_PLUGIN_EVENT_SIGNAL_READY, +}; + +#define PROPERTY_STATISTICS "statistics" + +#endif // LIVE_DTV_PLUGIN_API_H_ diff --git a/usb/aidl/Android.bp b/usb/aidl/Android.bp index b82f6d5043af7621c1ff482144bed5abdc9c7264..b61576d682b12dc0fb11cdac511314a4b3f6f414 100644 --- a/usb/aidl/Android.bp +++ b/usb/aidl/Android.bp @@ -45,6 +45,6 @@ aidl_interface { }, ], - frozen: true, + frozen: false, } diff --git a/usb/aidl/aidl_api/android.hardware.usb/current/android/hardware/usb/ComplianceWarning.aidl b/usb/aidl/aidl_api/android.hardware.usb/current/android/hardware/usb/ComplianceWarning.aidl index 8b67070bc68fa71ed3ad86633e927b07508bbd80..c7c910324e610ac000d262a94f65439c0ad81723 100644 --- a/usb/aidl/aidl_api/android.hardware.usb/current/android/hardware/usb/ComplianceWarning.aidl +++ b/usb/aidl/aidl_api/android.hardware.usb/current/android/hardware/usb/ComplianceWarning.aidl @@ -38,4 +38,9 @@ enum ComplianceWarning { DEBUG_ACCESSORY = 2, BC_1_2 = 3, MISSING_RP = 4, + INPUT_POWER_LIMITED = 5, + MISSING_DATA_LINES = 6, + ENUMERATION_FAIL = 7, + FLAKY_CONNECTION = 8, + UNRELIABLE_IO = 9, } diff --git a/usb/aidl/android/hardware/usb/ComplianceWarning.aidl b/usb/aidl/android/hardware/usb/ComplianceWarning.aidl index 4c18a310a4bc73259d395bb47bc9e39c913b0364..bf79399c14ab8675bad8a4d2f22b5d70fd73849a 100644 --- a/usb/aidl/android/hardware/usb/ComplianceWarning.aidl +++ b/usb/aidl/android/hardware/usb/ComplianceWarning.aidl @@ -56,4 +56,29 @@ enum ComplianceWarning { * Type-C Cable and Connector Specification. */ MISSING_RP = 4, + /** + * Used to indicate the charging setups on the USB ports are unable to + * deliver negotiated power. + */ + INPUT_POWER_LIMITED = 5, + /** + * Used to indicate the cable/connector on the USB ports are missing + * the required wires on the data pins to make data transfer. + */ + MISSING_DATA_LINES = 6, + /** + * Used to indicate enumeration failures on the USB ports, potentially due to + * signal integrity issues or other causes. + */ + ENUMERATION_FAIL = 7, + /** + * Used to indicate unexpected data disconnection on the USB ports, + * potentially due to signal integrity issues or other causes. + */ + FLAKY_CONNECTION = 8, + /** + * Used to indicate unreliable or slow data transfer on the USB ports, + * potentially due to signal integrity issues or other causes. + */ + UNRELIABLE_IO = 9, } diff --git a/usb/aidl/default/Android.bp b/usb/aidl/default/Android.bp index 2c6ed07d487e90a43aea451afaee9cf49a31c18c..ee8e479d2f80782e507c131ce359068d361f6417 100644 --- a/usb/aidl/default/Android.bp +++ b/usb/aidl/default/Android.bp @@ -34,7 +34,7 @@ cc_binary { "Usb.cpp", ], shared_libs: [ - "android.hardware.usb-V2-ndk", + "android.hardware.usb-V3-ndk", "libbase", "libbinder_ndk", "libcutils", diff --git a/usb/aidl/default/android.hardware.usb-service.example.xml b/usb/aidl/default/android.hardware.usb-service.example.xml index c3f07f5270692a2d4b9ebc4c3e8d11c9581c4535..7ac206797aa52e3d4d59f29a2a905b07e466aa01 100644 --- a/usb/aidl/default/android.hardware.usb-service.example.xml +++ b/usb/aidl/default/android.hardware.usb-service.example.xml @@ -1,7 +1,7 @@ android.hardware.usb - 2 + 3 IUsb default diff --git a/usb/aidl/vts/Android.bp b/usb/aidl/vts/Android.bp index d0e0eecb3f721393f205410d744038bf571cb1a6..cf9299e2fc0eeb4259caded044ef062432b2d176 100644 --- a/usb/aidl/vts/Android.bp +++ b/usb/aidl/vts/Android.bp @@ -34,7 +34,7 @@ cc_test { "libbinder_ndk", ], static_libs: [ - "android.hardware.usb-V2-ndk", + "android.hardware.usb-V3-ndk", ], test_suites: [ "general-tests", diff --git a/usb/aidl/vts/VtsAidlUsbTargetTest.cpp b/usb/aidl/vts/VtsAidlUsbTargetTest.cpp index e9aa65bc8dbda5c748be408e03f45f13f6c783a4..7b7269df6a927cc72982ad7acb3db26e6500f83f 100644 --- a/usb/aidl/vts/VtsAidlUsbTargetTest.cpp +++ b/usb/aidl/vts/VtsAidlUsbTargetTest.cpp @@ -654,11 +654,18 @@ TEST_P(UsbAidlTest, nonCompliantChargerValues) { EXPECT_EQ(2, usb_last_cookie); EXPECT_EQ(transactionId, last_transactionId); - // Current compliance values range from [1, 4] if (usb_last_port_status.supportsComplianceWarnings) { for (auto warning : usb_last_port_status.complianceWarnings) { EXPECT_TRUE((int)warning >= (int)ComplianceWarning::OTHER); - EXPECT_TRUE((int)warning <= (int)ComplianceWarning::MISSING_RP); + /* + * Version 2 compliance values range from [1, 4] + * Version 3 compliance values range from [1, 9] + */ + if (usb_version < 3) { + EXPECT_TRUE((int)warning <= (int)ComplianceWarning::MISSING_RP); + } else { + EXPECT_TRUE((int)warning <= (int)ComplianceWarning::UNRELIABLE_IO); + } } } diff --git a/wifi/aidl/Android.bp b/wifi/aidl/Android.bp index 7bc8ae773948f1f432f6aad3919c4fe9406d904b..ac95f85c2b60245532a9ea56d4344874e6f7b4d7 100644 --- a/wifi/aidl/Android.bp +++ b/wifi/aidl/Android.bp @@ -27,6 +27,9 @@ aidl_interface { srcs: [ "android/hardware/wifi/*.aidl", ], + imports: [ + "android.hardware.wifi.common-V1", + ], stability: "vintf", backend: { java: { @@ -42,6 +45,9 @@ aidl_interface { enabled: false, }, }, + cpp: { + enabled: false, + }, }, versions_with_info: [ { @@ -49,6 +55,5 @@ aidl_interface { imports: [], }, ], - frozen: true, - + frozen: false, } diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/CachedScanData.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/CachedScanData.aidl new file mode 100644 index 0000000000000000000000000000000000000000..cd4a456917c71712706cbcaf6d7aa20159c3bc3a --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/CachedScanData.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/////////////////////////////////////////////////////////////////////////////// +// THIS 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 -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.wifi; +@VintfStability +parcelable CachedScanData { + int[] scannedFrequenciesMhz; + android.hardware.wifi.CachedScanResult[] cachedScanResults; +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/CachedScanResult.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/CachedScanResult.aidl new file mode 100644 index 0000000000000000000000000000000000000000..1806b0f53433db061ebc2f82bf13a884190b803e --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/CachedScanResult.aidl @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/////////////////////////////////////////////////////////////////////////////// +// THIS 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 -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.wifi; +@VintfStability +parcelable CachedScanResult { + long timeStampInUs; + byte[] ssid; + byte[6] bssid; + int rssiDbm; + int frequencyMhz; + android.hardware.wifi.WifiChannelWidthInMhz channelWidthMhz; + android.hardware.wifi.WifiRatePreamble preambleType; +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IWifiChip.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IWifiChip.aidl index 4ea2081acee76bd4b0b1a5b15b8f9aab20ff0abb..5ed7517766717633f43c408539a814fab18a3d65 100644 --- a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IWifiChip.aidl +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IWifiChip.aidl @@ -83,6 +83,8 @@ interface IWifiChip { void triggerSubsystemRestart(); void enableStaChannelForPeerNetwork(in int channelCategoryEnableFlag); void setMloMode(in android.hardware.wifi.IWifiChip.ChipMloMode mode); + @PropagateAllowBlocking android.hardware.wifi.IWifiApIface createApOrBridgedApIface(in android.hardware.wifi.IfaceConcurrencyType iface, in android.hardware.wifi.common.OuiKeyedData[] vendorData); + void setVoipMode(in android.hardware.wifi.IWifiChip.VoipMode mode); const int NO_POWER_CAP_CONSTANT = 0x7FFFFFFF; @Backing(type="int") @VintfStability enum FeatureSetMask { @@ -95,6 +97,7 @@ interface IWifiChip { WIGIG = (1 << 6) /* 64 */, SET_AFC_CHANNEL_ALLOWANCE = (1 << 7) /* 128 */, T2LM_NEGOTIATION = (1 << 8) /* 256 */, + SET_VOIP_MODE = (1 << 9) /* 512 */, } @VintfStability parcelable ChipConcurrencyCombinationLimit { @@ -161,6 +164,11 @@ interface IWifiChip { NAN_INSTANT_MODE = (1 << 2) /* 4 */, } @Backing(type="int") @VintfStability + enum VoipMode { + OFF = 0, + VOICE = 1, + } + @Backing(type="int") @VintfStability enum ChannelCategoryMask { INDOOR_CHANNEL = (1 << 0) /* 1 */, DFS_CHANNEL = (1 << 1) /* 2 */, diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IWifiStaIface.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IWifiStaIface.aidl index 923deff01f4dc6674985d23e375704da2a50f6b6..ccb7876513769d257cacaf8e32a842704969405f 100644 --- a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IWifiStaIface.aidl +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IWifiStaIface.aidl @@ -61,6 +61,14 @@ interface IWifiStaIface { void stopRssiMonitoring(in int cmdId); void stopSendingKeepAlivePackets(in int cmdId); void setDtimMultiplier(in int multiplier); + android.hardware.wifi.CachedScanData getCachedScanData(); + android.hardware.wifi.TwtCapabilities twtGetCapabilities(); + void twtSessionSetup(in int cmdId, in android.hardware.wifi.TwtRequest twtRequest); + void twtSessionUpdate(in int cmdId, in int sessionId, in android.hardware.wifi.TwtRequest twtRequest); + void twtSessionSuspend(in int cmdId, in int sessionId); + void twtSessionResume(in int cmdId, in int sessionId); + void twtSessionTeardown(in int cmdId, in int sessionId); + void twtSessionGetStats(in int cmdId, in int sessionId); @Backing(type="int") @VintfStability enum FeatureSetMask { APF = (1 << 0) /* 1 */, @@ -77,5 +85,7 @@ interface IWifiStaIface { TDLS_OFFCHANNEL = (1 << 11) /* 2048 */, ND_OFFLOAD = (1 << 12) /* 4096 */, KEEP_ALIVE = (1 << 13) /* 8192 */, + ROAMING_MODE_CONTROL = (1 << 14) /* 16384 */, + CACHED_SCAN_DATA = (1 << 15) /* 32768 */, } } diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IWifiStaIfaceEventCallback.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IWifiStaIfaceEventCallback.aidl index 48b85b0fcfe7ab5f2b041d3b3c647a3fc40af07b..629ca3d922a71fa9ac09b569605f208237eac85c 100644 --- a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IWifiStaIfaceEventCallback.aidl +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IWifiStaIfaceEventCallback.aidl @@ -38,4 +38,31 @@ interface IWifiStaIfaceEventCallback { oneway void onBackgroundScanFailure(in int cmdId); oneway void onBackgroundScanResults(in int cmdId, in android.hardware.wifi.StaScanData[] scanDatas); oneway void onRssiThresholdBreached(in int cmdId, in byte[6] currBssid, in int currRssi); + oneway void onTwtFailure(in int cmdId, in android.hardware.wifi.IWifiStaIfaceEventCallback.TwtErrorCode error); + oneway void onTwtSessionCreate(in int cmdId, in android.hardware.wifi.TwtSession twtSession); + oneway void onTwtSessionUpdate(in int cmdId, in android.hardware.wifi.TwtSession twtSession); + oneway void onTwtSessionTeardown(in int cmdId, in int twtSessionId, in android.hardware.wifi.IWifiStaIfaceEventCallback.TwtTeardownReasonCode reasonCode); + oneway void onTwtSessionStats(in int cmdId, in int twtSessionId, in android.hardware.wifi.TwtSessionStats twtSessionStats); + oneway void onTwtSessionSuspend(in int cmdId, in int twtSessionId); + oneway void onTwtSessionResume(in int cmdId, in int twtSessionId); + @Backing(type="byte") @VintfStability + enum TwtErrorCode { + FAILURE_UNKNOWN, + ALREADY_RESUMED, + ALREADY_SUSPENDED, + INVALID_PARAMS, + MAX_SESSION_REACHED, + NOT_AVAILABLE, + NOT_SUPPORTED, + PEER_NOT_SUPPORTED, + PEER_REJECTED, + TIMEOUT, + } + @Backing(type="byte") @VintfStability + enum TwtTeardownReasonCode { + UNKNOWN, + LOCALLY_REQUESTED, + INTERNALLY_INITIATED, + PEER_INITIATED, + } } diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanBootstrappingRequest.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanBootstrappingRequest.aidl index dd0a5ede2f291bb038a5e2ab7eb8a06e29d91d99..b5f78b06b57bc817ec67d1c4585d7f7643df2570 100644 --- a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanBootstrappingRequest.aidl +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanBootstrappingRequest.aidl @@ -38,4 +38,6 @@ parcelable NanBootstrappingRequest { byte[6] peerDiscMacAddr; android.hardware.wifi.NanBootstrappingMethod requestBootstrappingMethod; byte[] cookie; + boolean isComeback; + byte discoverySessionId; } diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanBootstrappingResponse.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanBootstrappingResponse.aidl index 6dd9b2603a78988015b4e26de14899cc1eb25c05..7b17493d884c1e28194498a0ed0f7aa57752f35d 100644 --- a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanBootstrappingResponse.aidl +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanBootstrappingResponse.aidl @@ -36,4 +36,5 @@ package android.hardware.wifi; parcelable NanBootstrappingResponse { int bootstrappingInstanceId; boolean acceptRequest; + byte discoverySessionId; } diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanConfigRequest.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanConfigRequest.aidl index 5ead6515d0559e432cd04d82e471e5612f92b629..a3693d64983a0753867a6d4c21b6a97373542ea7 100644 --- a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanConfigRequest.aidl +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanConfigRequest.aidl @@ -45,4 +45,5 @@ parcelable NanConfigRequest { char rssiWindowSize; int macAddressRandomizationIntervalSec; android.hardware.wifi.NanBandSpecificConfig[3] bandSpecificConfig; + @nullable android.hardware.wifi.common.OuiKeyedData[] vendorData; } diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanDataPathSecurityConfig.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanDataPathSecurityConfig.aidl index 635dbce788c659c31911a3510542b953b0366af3..48e9501b3e57fcdf527da9b436ca4bce3a3d9d8f 100644 --- a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanDataPathSecurityConfig.aidl +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanDataPathSecurityConfig.aidl @@ -39,4 +39,10 @@ parcelable NanDataPathSecurityConfig { byte[32] pmk; byte[] passphrase; byte[16] scid; + boolean enable16ReplyCountersForTksa; + boolean enable16ReplyCountersForGtksa; + boolean supportGtkAndIgtk; + boolean supportBigtksa; + boolean enableNcsBip256; + boolean requiresEnhancedFrameProtection; } diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanMatchInd.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanMatchInd.aidl index 317489f22352b0f0107fe3a064d8d629603fb8c5..4acc7732f3c07dbeb7800a0a8426a7d2f3cf87c3 100644 --- a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanMatchInd.aidl +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanMatchInd.aidl @@ -51,4 +51,5 @@ parcelable NanMatchInd { byte[] scid; android.hardware.wifi.NanPairingConfig peerPairingConfig; android.hardware.wifi.NanIdentityResolutionAttribute peerNira; + @nullable android.hardware.wifi.common.OuiKeyedData[] vendorData; } diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanPairingConfirmInd.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanPairingConfirmInd.aidl index 8ecf22aa0147cc1d0b2f4aeba2c8198c75a412de..699ecdce778cffcad407562a7dc439f35ef4ddf0 100644 --- a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanPairingConfirmInd.aidl +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanPairingConfirmInd.aidl @@ -40,4 +40,5 @@ parcelable NanPairingConfirmInd { android.hardware.wifi.NanPairingRequestType requestType; boolean enablePairingCache; android.hardware.wifi.NpkSecurityAssociation npksa; + @nullable android.hardware.wifi.common.OuiKeyedData[] vendorData; } diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanPairingRequest.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanPairingRequest.aidl index 2a644ae63bfd30d347d6ec7f28e04b33ece9940d..121b038b5409092494d7d678a7896869adef07d5 100644 --- a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanPairingRequest.aidl +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanPairingRequest.aidl @@ -40,4 +40,5 @@ parcelable NanPairingRequest { boolean enablePairingCache; byte[16] pairingIdentityKey; android.hardware.wifi.NanPairingSecurityConfig securityConfig; + @nullable android.hardware.wifi.common.OuiKeyedData[] vendorData; } diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanPairingRequestInd.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanPairingRequestInd.aidl index 66762b93e675e068d98447e340d33a91baf4f5b8..57072c04a4f3ea455140b5813fe6a4cd88fdcef9 100644 --- a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanPairingRequestInd.aidl +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanPairingRequestInd.aidl @@ -41,4 +41,5 @@ parcelable NanPairingRequestInd { android.hardware.wifi.NanPairingRequestType requestType; boolean enablePairingCache; android.hardware.wifi.NanIdentityResolutionAttribute peerNira; + @nullable android.hardware.wifi.common.OuiKeyedData[] vendorData; } diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanPublishRequest.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanPublishRequest.aidl index c49f5f9012631651b90c7d6af94b805375efedbe..bdc83579ad9bb36231923bdfec4caa2bfd74c12e 100644 --- a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanPublishRequest.aidl +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanPublishRequest.aidl @@ -40,4 +40,5 @@ parcelable NanPublishRequest { boolean autoAcceptDataPathRequests; android.hardware.wifi.NanPairingConfig pairingConfig; byte[16] identityKey; + @nullable android.hardware.wifi.common.OuiKeyedData[] vendorData; } diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanRespondToPairingIndicationRequest.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanRespondToPairingIndicationRequest.aidl index a58890c542b0f43c95912b097df9200458f211e4..da81c394b7b5b5794b54021b32bcb58586fad3dd 100644 --- a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanRespondToPairingIndicationRequest.aidl +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanRespondToPairingIndicationRequest.aidl @@ -40,4 +40,5 @@ parcelable NanRespondToPairingIndicationRequest { boolean enablePairingCache; byte[16] pairingIdentityKey; android.hardware.wifi.NanPairingSecurityConfig securityConfig; + @nullable android.hardware.wifi.common.OuiKeyedData[] vendorData; } diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanSubscribeRequest.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanSubscribeRequest.aidl index 96be096d746aaabf325723abbbe88954fd01ffff..bf525a9c7ede3c59d790f7f9fe97c14fe8c29187 100644 --- a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanSubscribeRequest.aidl +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanSubscribeRequest.aidl @@ -43,4 +43,5 @@ parcelable NanSubscribeRequest { android.hardware.wifi.MacAddress[] intfAddr; android.hardware.wifi.NanPairingConfig pairingConfig; byte[16] identityKey; + @nullable android.hardware.wifi.common.OuiKeyedData[] vendorData; } diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/RttCapabilities.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/RttCapabilities.aidl index cf64687c50cbb7d6a83b6bfa31ec867357a1f710..56ef2d204dfd8b653b5a9ab21944c32969b28503 100644 --- a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/RttCapabilities.aidl +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/RttCapabilities.aidl @@ -42,4 +42,9 @@ parcelable RttCapabilities { android.hardware.wifi.RttPreamble preambleSupport; android.hardware.wifi.RttBw bwSupport; byte mcVersion; + android.hardware.wifi.RttPreamble azPreambleSupport; + android.hardware.wifi.RttBw azBwSupport; + boolean ntbInitiatorSupported; + boolean ntbResponderSupported; + int maxTxLtfRepetitionCount; } diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/RttConfig.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/RttConfig.aidl index ccdf2cee68f0f426fc5fd14c2ea8ed75d20c847e..b7830bd12669019551c496dfe97749f62febebaa 100644 --- a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/RttConfig.aidl +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/RttConfig.aidl @@ -48,4 +48,7 @@ parcelable RttConfig { int burstDuration; android.hardware.wifi.RttPreamble preamble; android.hardware.wifi.RttBw bw; + int ntbMinMeasurementTimeMillis; + int ntbMaxMeasurementTimeMillis; + int txLtfRepetitionCount; } diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/RttPreamble.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/RttPreamble.aidl index de26f28f81130908b9590fe11ffae15516a23de7..280246451e365354994be19770596e6975578525 100644 --- a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/RttPreamble.aidl +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/RttPreamble.aidl @@ -34,6 +34,7 @@ package android.hardware.wifi; @Backing(type="int") @VintfStability enum RttPreamble { + INVALID = 0, LEGACY = 0x1, HT = 0x2, VHT = 0x4, diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/RttResult.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/RttResult.aidl index 8375dcb14825537cae68f63b402549efea14db8a..30f5f58b523d14d08b31a9d4ece01d37f6c86c9b 100644 --- a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/RttResult.aidl +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/RttResult.aidl @@ -59,4 +59,7 @@ parcelable RttResult { android.hardware.wifi.WifiInformationElement lcr; int channelFreqMHz; android.hardware.wifi.RttBw packetBw; + int txLtfRepetitionCount; + int ntbMinMeasurementTimeMillis; + int ntbMaxMeasurementTimeMillis; } diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/RttType.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/RttType.aidl index 2b6087a6bcfd1366afb4e4955748e4cb16e00c8b..cb25673af37d33be9884c41bb79657e5fe5b04c0 100644 --- a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/RttType.aidl +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/RttType.aidl @@ -36,4 +36,6 @@ package android.hardware.wifi; enum RttType { ONE_SIDED = 1, TWO_SIDED = 2, + TWO_SIDED_11MC = TWO_SIDED /* 2 */, + TWO_SIDED_11AZ_NTB = 3, } diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/StaRoamingState.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/StaRoamingState.aidl index 1f3d91f2904c44c83c4bd0c7800b1078f2614875..fd7d567105e0ff7a18ceff5767e4ebe81d190f56 100644 --- a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/StaRoamingState.aidl +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/StaRoamingState.aidl @@ -36,4 +36,5 @@ package android.hardware.wifi; enum StaRoamingState { DISABLED = 0, ENABLED = 1, + AGGRESSIVE = 2, } diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/TwtCapabilities.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/TwtCapabilities.aidl new file mode 100644 index 0000000000000000000000000000000000000000..d8e73fb4b7bda510decb11768688e8387ac4c503 --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/TwtCapabilities.aidl @@ -0,0 +1,45 @@ +/* + * Copyright (C) 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/////////////////////////////////////////////////////////////////////////////// +// THIS 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 -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.wifi; +@VintfStability +parcelable TwtCapabilities { + boolean isTwtRequesterSupported; + boolean isTwtResponderSupported; + boolean isBroadcastTwtSupported; + boolean isFlexibleTwtScheduleSupported; + int minWakeDurationMicros; + int maxWakeDurationMicros; + int minWakeIntervalMicros; + int maxWakeIntervalMicros; +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/TwtRequest.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/TwtRequest.aidl new file mode 100644 index 0000000000000000000000000000000000000000..3051b943a3ef1de622b5045d0108606cdd79dc75 --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/TwtRequest.aidl @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/////////////////////////////////////////////////////////////////////////////// +// THIS 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 -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.wifi; +@VintfStability +parcelable TwtRequest { + int mloLinkId; + int minWakeDurationMicros; + int maxWakeDurationMicros; + int minWakeIntervalMicros; + int maxWakeIntervalMicros; +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/TwtSession.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/TwtSession.aidl new file mode 100644 index 0000000000000000000000000000000000000000..92c2533e2cecc0999a611d2c08875cfc89079f36 --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/TwtSession.aidl @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/////////////////////////////////////////////////////////////////////////////// +// THIS 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 -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.wifi; +@VintfStability +parcelable TwtSession { + int sessionId; + int mloLinkId; + int wakeDurationMicros; + int wakeIntervalMicros; + android.hardware.wifi.TwtSession.TwtNegotiationType negotiationType; + boolean isTriggerEnabled; + boolean isAnnounced; + boolean isImplicit; + boolean isProtected; + boolean isUpdatable; + boolean isSuspendable; + boolean isResponderPmModeEnabled; + @Backing(type="byte") @VintfStability + enum TwtNegotiationType { + INDIVIDUAL = 0, + BROADCAST = 1, + } +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/TwtSessionStats.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/TwtSessionStats.aidl new file mode 100644 index 0000000000000000000000000000000000000000..528444a84b531eaedfcfd85d8832583967fb6f40 --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/TwtSessionStats.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/////////////////////////////////////////////////////////////////////////////// +// THIS 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 -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.wifi; +@VintfStability +parcelable TwtSessionStats { + int avgTxPktCount; + int avgRxPktCount; + int avgTxPktSize; + int avgRxPktSize; + int avgEospDurationMicros; + int eospCount; +} diff --git a/wifi/aidl/android/hardware/wifi/CachedScanData.aidl b/wifi/aidl/android/hardware/wifi/CachedScanData.aidl new file mode 100644 index 0000000000000000000000000000000000000000..feda079ffdda29b4ded4bfd7f0bf319ff7d00100 --- /dev/null +++ b/wifi/aidl/android/hardware/wifi/CachedScanData.aidl @@ -0,0 +1,35 @@ +/* + * Copyright (C) 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.hardware.wifi; + +import android.hardware.wifi.CachedScanResult; + +/** + * Scan data cached in Wifi firmware + */ +@VintfStability +parcelable CachedScanData { + /** + * List of scanned frequencies in MHz. + */ + int[] scannedFrequenciesMhz; + + /** + * List of scan results. + */ + CachedScanResult[] cachedScanResults; +} diff --git a/wifi/aidl/android/hardware/wifi/CachedScanResult.aidl b/wifi/aidl/android/hardware/wifi/CachedScanResult.aidl new file mode 100644 index 0000000000000000000000000000000000000000..9c9dbc723e29acb79289eeaba822556ae3d19fe6 --- /dev/null +++ b/wifi/aidl/android/hardware/wifi/CachedScanResult.aidl @@ -0,0 +1,55 @@ +/* + * Copyright (C) 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.hardware.wifi; + +import android.hardware.wifi.WifiChannelWidthInMhz; +import android.hardware.wifi.WifiRatePreamble; + +/** + * Scan result cached in Wifi firmware + */ +@VintfStability +parcelable CachedScanResult { + /** + * Time in micro seconds since boot when the scan was done + */ + long timeStampInUs; + /** + * SSID of beacon excluding null. + */ + byte[] ssid; + /** + * BSSID of beacon + */ + byte[6] bssid; + /** + * Beacon received signal stength indicatior (RSSI), in dbm + */ + int rssiDbm; + /** + * Frequency of beacon, in MHz + */ + int frequencyMhz; + /** + * Channel bandwidth of found network + */ + WifiChannelWidthInMhz channelWidthMhz; + /** + * Supported rate and preamble type + */ + WifiRatePreamble preambleType; +} diff --git a/wifi/aidl/android/hardware/wifi/IWifiChip.aidl b/wifi/aidl/android/hardware/wifi/IWifiChip.aidl index c1caa7e6c6f6cbdd5ff6812980576190ea6b8fe9..d12d26c65ca2bfd095f0fc7a4b3f8712748207e6 100644 --- a/wifi/aidl/android/hardware/wifi/IWifiChip.aidl +++ b/wifi/aidl/android/hardware/wifi/IWifiChip.aidl @@ -33,6 +33,7 @@ import android.hardware.wifi.WifiDebugRingBufferVerboseLevel; import android.hardware.wifi.WifiIfaceMode; import android.hardware.wifi.WifiRadioCombination; import android.hardware.wifi.WifiUsableChannel; +import android.hardware.wifi.common.OuiKeyedData; /** * Interface that represents a chip that must be configured as a single unit. @@ -82,6 +83,10 @@ interface IWifiChip { * Chip supports Tid-To-Link mapping negotiation. */ T2LM_NEGOTIATION = 1 << 8, + /** + * Chip supports voip mode setting. + */ + SET_VOIP_MODE = 1 << 9, } /** @@ -383,6 +388,16 @@ interface IWifiChip { NAN_INSTANT_MODE = 1 << 2, } + /** + * This enum represents the different VoIP mode that can be set through |setVoipMode|. + */ + @VintfStability + @Backing(type="int") + enum VoipMode { + OFF = 0, + VOICE = 1, + } + /** * Configure the Chip. * This may NOT be called to reconfigure a chip due to an internal @@ -1149,4 +1164,46 @@ interface IWifiChip { * */ void setMloMode(in ChipMloMode mode); + + /** + * Create an AP or bridged AP iface on the chip using vendor-provided configuration parameters. + * + * Depending on the mode the chip is configured in, the interface creation + * may fail (code: |WifiStatusCode.ERROR_NOT_AVAILABLE|) if we've already + * reached the maximum allowed (specified in |ChipIfaceCombination|) number + * of ifaces of the AP or AP_BRIDGED type. + * + * @param iface IfaceConcurrencyType to be created. Takes one of + |IfaceConcurrencyType.AP| or |IfaceConcurrencyType.AP_BRIDGED| + * @param vendorData Vendor-provided configuration data as a list of |OuiKeyedData|. + * @return AIDL interface object representing the iface if + * successful, null otherwise. + * @throws ServiceSpecificException with one of the following values: + * |WifiStatusCode.ERROR_WIFI_CHIP_INVALID|, + * |WifiStatusCode.ERROR_NOT_SUPPORTED|, + * |WifiStatusCode.ERROR_NOT_AVAILABLE|, + * |WifiStatusCode.ERROR_INVALID_ARGS| + */ + @PropagateAllowBlocking + IWifiApIface createApOrBridgedApIface( + in IfaceConcurrencyType iface, in OuiKeyedData[] vendorData); + + /** + * API to set the wifi VoIP mode. + * + * The VoIP mode is a hint to the HAL to enable or disable Wi-Fi VoIP + * optimization. The optimization should be enabled if the mode is NOT set to |OFF|. + * Furthermore, HAL should implement relevant optimization techniques based on the + * current operational mode. + * + * Note: Wi-Fi VoIP optimization may trade-off power against Wi-Fi + * performance but it provides better voice quility. + * + * @param mode Voip mode as defined by the enum |VoipMode| + * @throws ServiceSpecificException with one of the following values: + * |WifiStatusCode.ERROR_WIFI_CHIP_INVALID|, + * |WifiStatusCode.ERROR_INVALID_ARGS|, + * |WifiStatusCode.ERROR_UNKNOWN| + */ + void setVoipMode(in VoipMode mode); } diff --git a/wifi/aidl/android/hardware/wifi/IWifiStaIface.aidl b/wifi/aidl/android/hardware/wifi/IWifiStaIface.aidl index 6d6afafc1261d784fbabdf3e4610d70d6935913e..6c5451b56f8cce58265e81609443f7cc5170184d 100644 --- a/wifi/aidl/android/hardware/wifi/IWifiStaIface.aidl +++ b/wifi/aidl/android/hardware/wifi/IWifiStaIface.aidl @@ -16,6 +16,7 @@ package android.hardware.wifi; +import android.hardware.wifi.CachedScanData; import android.hardware.wifi.IWifiStaIfaceEventCallback; import android.hardware.wifi.StaApfPacketFilterCapabilities; import android.hardware.wifi.StaBackgroundScanCapabilities; @@ -24,6 +25,8 @@ import android.hardware.wifi.StaLinkLayerStats; import android.hardware.wifi.StaRoamingCapabilities; import android.hardware.wifi.StaRoamingConfig; import android.hardware.wifi.StaRoamingState; +import android.hardware.wifi.TwtCapabilities; +import android.hardware.wifi.TwtRequest; import android.hardware.wifi.WifiBand; import android.hardware.wifi.WifiDebugRxPacketFateReport; import android.hardware.wifi.WifiDebugTxPacketFateReport; @@ -99,6 +102,14 @@ interface IWifiStaIface { * Support for keep alive packet offload. */ KEEP_ALIVE = 1 << 13, + /** + * Support for configuring roaming mode. + */ + ROAMING_MODE_CONTROL = 1 << 14, + /** + * Support for cached scan data report. + */ + CACHED_SCAN_DATA = 1 << 15, } /** @@ -552,4 +563,125 @@ interface IWifiStaIface { * |WifiStatusCode.ERROR_UNKNOWN| */ void setDtimMultiplier(in int multiplier); + + /** + * Get the cached scan data. + * + * @return Instance of |CachedScanData|. + * @throws ServiceSpecificException with one of the following values: + * |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|, + * |WifiStatusCode.ERROR_NOT_SUPPORTED|, + * |WifiStatusCode.ERROR_NOT_AVAILABLE|, + * |WifiStatusCode.ERROR_UNKNOWN| + */ + CachedScanData getCachedScanData(); + + /** + * Get Target Wake Time (TWT) local device capabilities for the station interface. + * + * @return Instance of |TwtCapabilities|. + * @throws ServiceSpecificException with one of the following values: + * |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|, + * |WifiStatusCode.ERROR_NOT_SUPPORTED|, + * |WifiStatusCode.ERROR_NOT_AVAILABLE|, + * |WifiStatusCode.ERROR_UNKNOWN| + */ + TwtCapabilities twtGetCapabilities(); + + /** + * Setup a Target Wake Time (TWT) session. + * + * Supported only if |TwtCapabilities.isTwtRequesterSupported| is set. Results in asynchronous + * callback |IWifiStaIfaceEventCallback.onTwtSessionCreate| on success or + * |IWifiStaIfaceEventCallback.onTwtFailure| on failure. + * + * @param cmdId Command Id to use for this invocation. The value 0 is reserved. + * @param twtRequest TWT Request parameters. + * @throws ServiceSpecificException with one of the following values: + * |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|, + * |WifiStatusCode.ERROR_NOT_SUPPORTED|, + * |WifiStatusCode.ERROR_UNKNOWN| + */ + void twtSessionSetup(in int cmdId, in TwtRequest twtRequest); + + /** + * Update a Target Wake Time (TWT) session. + * + * Supported only if the TWT session can be updated. See |TwtSession.isUpdatable|. Results in + * asynchronous callback |IWifiStaIfaceEventCallback.onTwtSessionUpdate| on success or + * |IWifiStaIfaceEventCallback.onTwtFailure| on failure. + * + * @param cmdId Command Id to use for this invocation. The value 0 is reserved. + * @param sessionId TWT session id. + * @param twtRequest TWT Request parameters. + * @throws ServiceSpecificException with one of the following values: + * |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|, + * |WifiStatusCode.ERROR_NOT_SUPPORTED|, + * |WifiStatusCode.ERROR_UNKNOWN| + */ + void twtSessionUpdate(in int cmdId, in int sessionId, in TwtRequest twtRequest); + + /** + * Suspend a Target Wake Time (TWT) session until a resume is called. + * + * Supported only if the TWT session supports suspend and resume. See + * |TwtSession.isSuspendable|. Results in asynchronous callback + * |IWifiStaIfaceEventCallback.onTwtSessionSuspend| on success or + * |IWifiStaIfaceEventCallback.onTwtFailure| on failure. + * + * @param cmdId Command Id to use for this invocation. The value 0 is reserved. + * @param sessionId TWT session id. + * @throws ServiceSpecificException with one of the following values: + * |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|, + * |WifiStatusCode.ERROR_NOT_SUPPORTED|, + * |WifiStatusCode.ERROR_UNKNOWN| + */ + void twtSessionSuspend(in int cmdId, in int sessionId); + + /** + * Resume a Target Wake Time (TWT) session which is suspended. + * + * Supported only if the TWT session supports suspend and resume. See + * |TwtSession.isSuspendable|. Results in asynchronous callback + * |IWifiStaIfaceEventCallback.onTwtSessionResume| on success or + * |IWifiStaIfaceEventCallback.onTwtFailure| on failure. + * + * @param cmdId Command Id to use for this invocation. The value 0 is reserved. + * @param sessionId TWT session id. + * @throws ServiceSpecificException with one of the following values: + * |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|, + * |WifiStatusCode.ERROR_NOT_SUPPORTED|, + * |WifiStatusCode.ERROR_UNKNOWN| + */ + void twtSessionResume(in int cmdId, in int sessionId); + + /** + * Teardown a Target Wake Time (TWT) session. + * + * Results in asynchronous callback |IWifiStaIfaceEventCallback.onTwtSessionTeardown| on + * success or |IWifiStaIfaceEventCallback.onTwtFailure| on failure. + * + * @param cmdId Command Id to use for this invocation. The value 0 is reserved. + * @param sessionId TWT session id. + * @throws ServiceSpecificException with one of the following values: + * |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|, + * |WifiStatusCode.ERROR_NOT_SUPPORTED|, + * |WifiStatusCode.ERROR_UNKNOWN| + */ + void twtSessionTeardown(in int cmdId, in int sessionId); + + /** + * Get stats for a Target Wake Time (TWT) session. + * + * Results in asynchronous callback |IWifiStaIfaceEventCallback.onTwtSessionStats| on success + * or |IWifiStaIfaceEventCallback.onTwtFailure| on failure. + * + * @param cmdId Command Id to use for this invocation. The value 0 is reserved. + * @param sessionId TWT session id. + * @throws ServiceSpecificException with one of the following values: + * |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|, + * |WifiStatusCode.ERROR_NOT_SUPPORTED|, + * |WifiStatusCode.ERROR_UNKNOWN| + */ + void twtSessionGetStats(in int cmdId, in int sessionId); } diff --git a/wifi/aidl/android/hardware/wifi/IWifiStaIfaceEventCallback.aidl b/wifi/aidl/android/hardware/wifi/IWifiStaIfaceEventCallback.aidl index 93a255f9b4ca8c3a5c27b4c921dfb8e9a6e04743..dda7c771f56687632dca121fed936b51e915f5a6 100644 --- a/wifi/aidl/android/hardware/wifi/IWifiStaIfaceEventCallback.aidl +++ b/wifi/aidl/android/hardware/wifi/IWifiStaIfaceEventCallback.aidl @@ -18,6 +18,8 @@ package android.hardware.wifi; import android.hardware.wifi.StaScanData; import android.hardware.wifi.StaScanResult; +import android.hardware.wifi.TwtSession; +import android.hardware.wifi.TwtSessionStats; @VintfStability oneway interface IWifiStaIfaceEventCallback { @@ -61,4 +63,104 @@ oneway interface IWifiStaIfaceEventCallback { * @param currRssi RSSI of the currently connected access point. */ void onRssiThresholdBreached(in int cmdId, in byte[6] currBssid, in int currRssi); + + @VintfStability + @Backing(type="byte") + enum TwtErrorCode { + /** Unknown failure */ + FAILURE_UNKNOWN, + /** TWT session is already resumed */ + ALREADY_RESUMED, + /** TWT session is already suspended */ + ALREADY_SUSPENDED, + /** Invalid parameters */ + INVALID_PARAMS, + /** Maximum number of sessions reached */ + MAX_SESSION_REACHED, + /** Requested operation is not available */ + NOT_AVAILABLE, + /** Requested operation is not supported */ + NOT_SUPPORTED, + /** Requested operation is not supported by the peer */ + PEER_NOT_SUPPORTED, + /** Requested operation is rejected by the peer */ + PEER_REJECTED, + /** Requested operation is timed out */ + TIMEOUT, + } + + @VintfStability + @Backing(type="byte") + enum TwtTeardownReasonCode { + /** Unknown reason */ + UNKNOWN, + /** Teardown requested by the framework */ + LOCALLY_REQUESTED, + /** Teardown initiated internally by the firmware or driver */ + INTERNALLY_INITIATED, + /** Teardown initiated by the peer */ + PEER_INITIATED, + } + + /** + * Called to indicate a TWT failure. If there is no command associated with this failure cmdId + * will be 0. + * + * @param cmdId Id used to identify the command. The value 0 indicates no associated command. + * @param error error code. + */ + void onTwtFailure(in int cmdId, in TwtErrorCode error); + + /** + * Called when a Target Wake Time session is created. See |IWifiStaIface.twtSessionSetup|. + * + * @param cmdId Id used to identify the command. + * @param twtSession TWT session. + */ + void onTwtSessionCreate(in int cmdId, in TwtSession twtSession); + + /** + * Called when a Target Wake Time session is updated. See |IWifiStaIface.twtSessionUpdate|. + * + * @param cmdId Id used to identify the command. + * @param twtSession TWT session. + */ + void onTwtSessionUpdate(in int cmdId, in TwtSession twtSession); + + /** + * Called when the Target Wake Time session is torndown. + * See |IWifiStaIface.twtSessionTeardown|. + * + * @param cmdId Id used to identify the command. The value 0 indicates no associated command. + * @param twtSessionId TWT session id. + * @param reasonCode reason code for the TWT teardown. + */ + void onTwtSessionTeardown( + in int cmdId, in int twtSessionId, in TwtTeardownReasonCode reasonCode); + + /** + * Called when TWT session stats available. See |IWifiStaIface.twtSessionGetStats|. + * + * @param cmdId Id used to identify the command. + * @param twtSessionId TWT session id. + * @param twtSessionStats TWT session stats. + */ + void onTwtSessionStats(in int cmdId, in int twtSessionId, in TwtSessionStats twtSessionStats); + + /** + * Called when the Target Wake Time session is suspended. + * See |IWifiStaIface.twtSessionSuspend|. + * + * @param cmdId Id used to identify the command. The value 0 indicates no associated command. + * @param twtSessionId TWT session id. + */ + void onTwtSessionSuspend(in int cmdId, in int twtSessionId); + + /** + * Called when the Target Wake Time session is resumed. See |IWifiStaIface.twtSessionResume|. + * + * @param cmdId Id used to identify the command. The value 0 indicates no associated command. + * @param twtSessionId TWT session id. + */ + void onTwtSessionResume(in int cmdId, in int twtSessionId); } diff --git a/wifi/aidl/android/hardware/wifi/NanBootstrappingRequest.aidl b/wifi/aidl/android/hardware/wifi/NanBootstrappingRequest.aidl index 4b74cd9e205d39189e20fce8c14515cfbf32d841..e23bd23607ef6c0eae992b962f32d00779870df1 100644 --- a/wifi/aidl/android/hardware/wifi/NanBootstrappingRequest.aidl +++ b/wifi/aidl/android/hardware/wifi/NanBootstrappingRequest.aidl @@ -45,4 +45,16 @@ parcelable NanBootstrappingRequest { * Cookie received from previous |NanBootstrappingConfirmInd| for comeback request. */ byte[] cookie; + + /** + * Identify if it is a request for come back response + */ + boolean isComeback; + + /** + * ID of an active publish or subscribe discovery session. Follow-up message is transmitted in + * the context of the discovery session. NAN Spec: Service Descriptor Attribute (SDA) / Instance + * ID + */ + byte discoverySessionId; } diff --git a/wifi/aidl/android/hardware/wifi/NanBootstrappingResponse.aidl b/wifi/aidl/android/hardware/wifi/NanBootstrappingResponse.aidl index dbe892316e17baf4633f3403ebc2718b88d3f9eb..a2ee0e60e116a8d4fd3220f7227fc7390a137eac 100644 --- a/wifi/aidl/android/hardware/wifi/NanBootstrappingResponse.aidl +++ b/wifi/aidl/android/hardware/wifi/NanBootstrappingResponse.aidl @@ -29,4 +29,11 @@ parcelable NanBootstrappingResponse { * True if accept the request, false otherwise. */ boolean acceptRequest; + + /** + * ID of an active publish or subscribe discovery session. Follow-up message is transmitted in + * the context of the discovery session. NAN Spec: Service Descriptor Attribute (SDA) / Instance + * ID + */ + byte discoverySessionId; } diff --git a/wifi/aidl/android/hardware/wifi/NanConfigRequest.aidl b/wifi/aidl/android/hardware/wifi/NanConfigRequest.aidl index 82a7b6e754cb542178eac230498b8126c9765a73..47561dc08f691469dc28106af40b786f6579d508 100644 --- a/wifi/aidl/android/hardware/wifi/NanConfigRequest.aidl +++ b/wifi/aidl/android/hardware/wifi/NanConfigRequest.aidl @@ -17,6 +17,7 @@ package android.hardware.wifi; import android.hardware.wifi.NanBandSpecificConfig; +import android.hardware.wifi.common.OuiKeyedData; /** * Configuration parameters of NAN. Used when enabling and re-configuring a NAN cluster. @@ -79,4 +80,9 @@ parcelable NanConfigRequest { * Additional configuration provided per band. Indexed by |NanBandIndex|. */ NanBandSpecificConfig[3] bandSpecificConfig; + /** + * Optional vendor-specific parameters. Null value indicates + * that no vendor data is provided. + */ + @nullable OuiKeyedData[] vendorData; } diff --git a/wifi/aidl/android/hardware/wifi/NanDataPathSecurityConfig.aidl b/wifi/aidl/android/hardware/wifi/NanDataPathSecurityConfig.aidl index 9a2013bf12c55a1bf5e15ee70d9f475c5cf0de46..b6c5eefcb31ac510283226be7792f56b720396b5 100644 --- a/wifi/aidl/android/hardware/wifi/NanDataPathSecurityConfig.aidl +++ b/wifi/aidl/android/hardware/wifi/NanDataPathSecurityConfig.aidl @@ -58,4 +58,49 @@ parcelable NanDataPathSecurityConfig { * setting up the Secure Data Path. */ byte[16] scid; + + /** + * Enables the 16 replay counter for ND-TKSA(NAN Data Pairwise Security Association) and + * NM-TKSA(NAN managerment Pairwise Security Association), if set to false will use 4 replay + * counter as default + * Wi-Fi Aware spec 4.0: 9.5.21.2 Cipher Suite Information attribute + */ + boolean enable16ReplyCountersForTksa; + + /** + * Enables the 16 replay counter for GTKSA(Group Transient Key security associations), if set to + * false will use 4 replay counter as default. + * Wi-Fi Aware spec 4.0: 9.5.21.2 Cipher Suite Information attribute + */ + boolean enable16ReplyCountersForGtksa; + + /** + * GTK(Group Transient Key) used to protect group addressed data frames, + * IGTK(Integrity Group Transient Key) used to protect multicast management frames, set to true + * if supported. + * Wi-Fi Aware spec 4.0: 9.5.21.2 Cipher Suite Information attribute + */ + boolean supportGtkAndIgtk; + + /** + * BIGTK(Beacon Integrity Group Transient Key) used to protect Beacon frames, set to true if + * supported. + * Ref: Wi-Fi Aware spec 4.0: 9.5.21.2 Cipher Suite Information attribute + */ + boolean supportBigtksa; + + /** + * Enables NCS-BIP-256 for IGTKSA(Integrity Group Transient Key security associations) + * and BIGTK(Beacon Integrity Group Transient Key security associations), if set to false will + * use NCS-BIP-128 as default + * Wi-Fi Aware spec 4.0: 9.5.21.2 Cipher Suite Information attribute + */ + boolean enableNcsBip256; + + /** + * Require enhanced frame protection if supported, which includes multicast management frame + * protection, group addressed data protection and beacon frame protection. + * Wi-Fi Aware spec 4.0: 7.3 frame protection + */ + boolean requiresEnhancedFrameProtection; } diff --git a/wifi/aidl/android/hardware/wifi/NanDiscoveryCommonConfig.aidl b/wifi/aidl/android/hardware/wifi/NanDiscoveryCommonConfig.aidl index 58777c5d6575c5f8a0b3b9206e451dd3a0538257..4bedce01007345b9d115cb56083ee45808314379 100644 --- a/wifi/aidl/android/hardware/wifi/NanDiscoveryCommonConfig.aidl +++ b/wifi/aidl/android/hardware/wifi/NanDiscoveryCommonConfig.aidl @@ -73,8 +73,9 @@ parcelable NanDiscoveryCommonConfig { /** * Arbitrary information communicated in discovery packets - there is no semantic meaning to * these bytes. They are passed-through from publisher to subscriber as-is with no parsing. Max - * length: |NanCapabilities.maxExtendedServiceSpecificInfoLen|. Spec: Service Descriptor - * Extension Attribute (SDEA) / Service Info + * length: |NanCapabilities.maxExtendedServiceSpecificInfoLen|. This info is using Generic + * Service Protocol with setting Service Info type to 2 (Generic). NAN Spec: Service + * Descriptor Extension Attribute (SDEA) / Service Info */ byte[] extendedServiceSpecificInfo; /** diff --git a/wifi/aidl/android/hardware/wifi/NanMatchInd.aidl b/wifi/aidl/android/hardware/wifi/NanMatchInd.aidl index 5a04376c75808b8ae85a186e91d6f29903d09d43..622213cf88bb474162f42b24102a95d2059f1eaa 100644 --- a/wifi/aidl/android/hardware/wifi/NanMatchInd.aidl +++ b/wifi/aidl/android/hardware/wifi/NanMatchInd.aidl @@ -19,6 +19,7 @@ package android.hardware.wifi; import android.hardware.wifi.NanCipherSuiteType; import android.hardware.wifi.NanIdentityResolutionAttribute; import android.hardware.wifi.NanPairingConfig; +import android.hardware.wifi.common.OuiKeyedData; /** * Match indication structure. @@ -137,4 +138,9 @@ parcelable NanMatchInd { * The NIRA from peer for NAN pairing verification */ NanIdentityResolutionAttribute peerNira; + /** + * Optional vendor-specific parameters. Null value indicates + * that no vendor data is provided. + */ + @nullable OuiKeyedData[] vendorData; } diff --git a/wifi/aidl/android/hardware/wifi/NanPairingConfirmInd.aidl b/wifi/aidl/android/hardware/wifi/NanPairingConfirmInd.aidl index a5670ec4607a8b657f66154dbeba7ae94ac352bf..692d3d6b16656bbb6622a38f2cd0263a4c7b615f 100644 --- a/wifi/aidl/android/hardware/wifi/NanPairingConfirmInd.aidl +++ b/wifi/aidl/android/hardware/wifi/NanPairingConfirmInd.aidl @@ -19,6 +19,7 @@ package android.hardware.wifi; import android.hardware.wifi.NanPairingRequestType; import android.hardware.wifi.NanStatus; import android.hardware.wifi.NpkSecurityAssociation; +import android.hardware.wifi.common.OuiKeyedData; /** * NAN pairing confirmation indication structure. Event indication is @@ -51,4 +52,9 @@ parcelable NanPairingConfirmInd { * The security association negotiated for the pairing, can be cached for future verification */ NpkSecurityAssociation npksa; + /** + * Optional vendor-specific parameters. Null value indicates + * that no vendor data is provided. + */ + @nullable OuiKeyedData[] vendorData; } diff --git a/wifi/aidl/android/hardware/wifi/NanPairingRequest.aidl b/wifi/aidl/android/hardware/wifi/NanPairingRequest.aidl index 0c2080b9e02ec8181d99385a285b59472190fd49..950d1e26d77ccf159dc42642e1ebf06a16f0e8ea 100644 --- a/wifi/aidl/android/hardware/wifi/NanPairingRequest.aidl +++ b/wifi/aidl/android/hardware/wifi/NanPairingRequest.aidl @@ -18,6 +18,7 @@ package android.hardware.wifi; import android.hardware.wifi.NanPairingRequestType; import android.hardware.wifi.NanPairingSecurityConfig; +import android.hardware.wifi.common.OuiKeyedData; /** * NAN pairing initiate request. @@ -54,4 +55,9 @@ parcelable NanPairingRequest { * Security config used for the pairing */ NanPairingSecurityConfig securityConfig; + /** + * Optional vendor-specific parameters. Null value indicates + * that no vendor data is provided. + */ + @nullable OuiKeyedData[] vendorData; } diff --git a/wifi/aidl/android/hardware/wifi/NanPairingRequestInd.aidl b/wifi/aidl/android/hardware/wifi/NanPairingRequestInd.aidl index ec8548f0f534586c0baff9941bc0ada2a95790a3..7e98bac96b28d4c3818bac42f4ade5aeee0ba4b1 100644 --- a/wifi/aidl/android/hardware/wifi/NanPairingRequestInd.aidl +++ b/wifi/aidl/android/hardware/wifi/NanPairingRequestInd.aidl @@ -18,6 +18,7 @@ package android.hardware.wifi; import android.hardware.wifi.NanIdentityResolutionAttribute; import android.hardware.wifi.NanPairingRequestType; +import android.hardware.wifi.common.OuiKeyedData; /** * NAN pairing request indication message structure. @@ -58,4 +59,9 @@ parcelable NanPairingRequestInd { * The NIRA from peer for NAN pairing verification */ NanIdentityResolutionAttribute peerNira; + /** + * Optional vendor-specific parameters. Null value indicates + * that no vendor data is provided. + */ + @nullable OuiKeyedData[] vendorData; } diff --git a/wifi/aidl/android/hardware/wifi/NanPublishRequest.aidl b/wifi/aidl/android/hardware/wifi/NanPublishRequest.aidl index 956a7dfb26fabf20102b3d91c5ebe29b4f66de98..ae75caf09fdd922ae53162988c41c5795c104986 100644 --- a/wifi/aidl/android/hardware/wifi/NanPublishRequest.aidl +++ b/wifi/aidl/android/hardware/wifi/NanPublishRequest.aidl @@ -20,6 +20,7 @@ import android.hardware.wifi.NanDiscoveryCommonConfig; import android.hardware.wifi.NanPairingConfig; import android.hardware.wifi.NanPublishType; import android.hardware.wifi.NanTxType; +import android.hardware.wifi.common.OuiKeyedData; /** * Publish request. Specifies a publish discovery operation. @@ -55,4 +56,9 @@ parcelable NanPublishRequest { * The Identity key for pairing, will generate NIRA for verification by the peer */ byte[16] identityKey; + /** + * Optional vendor-specific parameters. Null value indicates + * that no vendor data is provided. + */ + @nullable OuiKeyedData[] vendorData; } diff --git a/wifi/aidl/android/hardware/wifi/NanRespondToPairingIndicationRequest.aidl b/wifi/aidl/android/hardware/wifi/NanRespondToPairingIndicationRequest.aidl index fab2a40be637750afbd3e7cf678d173ed5e52c21..0527f067dedff991c10af6a3d96bca4baf57ddb2 100644 --- a/wifi/aidl/android/hardware/wifi/NanRespondToPairingIndicationRequest.aidl +++ b/wifi/aidl/android/hardware/wifi/NanRespondToPairingIndicationRequest.aidl @@ -18,6 +18,7 @@ package android.hardware.wifi; import android.hardware.wifi.NanPairingRequestType; import android.hardware.wifi.NanPairingSecurityConfig; +import android.hardware.wifi.common.OuiKeyedData; /** * Response to a pairing request from a peer. @@ -51,4 +52,9 @@ parcelable NanRespondToPairingIndicationRequest { * Security config used for the pairing */ NanPairingSecurityConfig securityConfig; + /** + * Optional vendor-specific parameters. Null value indicates + * that no vendor data is provided. + */ + @nullable OuiKeyedData[] vendorData; } diff --git a/wifi/aidl/android/hardware/wifi/NanSubscribeRequest.aidl b/wifi/aidl/android/hardware/wifi/NanSubscribeRequest.aidl index 0b246eda8ceb373a4eae67c7eb4608c7f895ae40..e7094bf55d0f62adebbf3011e374859ce09a06a8 100644 --- a/wifi/aidl/android/hardware/wifi/NanSubscribeRequest.aidl +++ b/wifi/aidl/android/hardware/wifi/NanSubscribeRequest.aidl @@ -21,6 +21,7 @@ import android.hardware.wifi.NanDiscoveryCommonConfig; import android.hardware.wifi.NanPairingConfig; import android.hardware.wifi.NanSrfType; import android.hardware.wifi.NanSubscribeType; +import android.hardware.wifi.common.OuiKeyedData; /** * Subscribe request. Specifies a subscribe discovery operation. @@ -76,4 +77,9 @@ parcelable NanSubscribeRequest { * The Identity key for pairing, will generate NIRA for verification by the peer */ byte[16] identityKey; + /** + * Optional vendor-specific parameters. Null value indicates + * that no vendor data is provided. + */ + @nullable OuiKeyedData[] vendorData; } diff --git a/wifi/aidl/android/hardware/wifi/RttCapabilities.aidl b/wifi/aidl/android/hardware/wifi/RttCapabilities.aidl index 7c47ed5f9cd2b916a13987f6e08b37d3f94db2fe..0352ec8ea677c5427071da9e81d94bff8087bf5d 100644 --- a/wifi/aidl/android/hardware/wifi/RttCapabilities.aidl +++ b/wifi/aidl/android/hardware/wifi/RttCapabilities.aidl @@ -33,24 +33,25 @@ parcelable RttCapabilities { */ boolean rttFtmSupported; /** - * Whether initiator supports LCI request. Applies to 2-sided RTT. + * Whether initiator supports Location Configuration Information (LCI) request. Applies to + * 2-sided RTT. */ boolean lciSupported; /** - * Whether initiator supports LCR request. Applies to 2-sided RTT. + * Whether initiator supports Location Civic Report (LCR) request. Applies to 2-sided RTT. */ boolean lcrSupported; /** - * Whether 11mc responder mode is supported. + * Whether IEEE 802.11mc responder mode is supported. */ boolean responderSupported; /** - * Bit mask indicating what preamble is supported by initiator. + * Bit mask indicating what preamble is supported by IEEE 802.11mc initiator. * Combination of |RttPreamble| values. */ RttPreamble preambleSupport; /** - * Bit mask indicating what BW is supported by initiator. + * Bit mask indicating what BW is supported by IEEE 802.11mc initiator. * Combination of |RttBw| values. */ RttBw bwSupport; @@ -59,4 +60,27 @@ parcelable RttCapabilities { * For instance, version 4.0 must be 40 and version 4.3 must be 43 etc. */ byte mcVersion; + /** + * Bit mask indicating what preamble is supported by IEEE 802.11az initiator. + * Combination of |RttPreamble| values. + */ + RttPreamble azPreambleSupport; + /** + * Bit mask indicating what BW is supported by IEEE 802.11az initiator. + * Combination of |RttBw| values. + */ + RttBw azBwSupport; + /** + * Whether the initiator supports IEEE 802.11az Non-Trigger-based (non-TB) measurement. + */ + boolean ntbInitiatorSupported; + /** + * Whether IEEE 802.11az Non-Trigger-based (non-TB) responder mode is supported. + */ + boolean ntbResponderSupported; + /** + * Maximum HE LTF repetitions the IEEE 802.11az initiator is capable of transmitting in the + * preamble of I2R NDP. + */ + int maxTxLtfRepetitionCount; } diff --git a/wifi/aidl/android/hardware/wifi/RttConfig.aidl b/wifi/aidl/android/hardware/wifi/RttConfig.aidl index fc2c2e0e7ef215d0fe0c78da05ac5e94655e6cfb..e9706562299d7dd8483a38f866a7c39a06ae0f45 100644 --- a/wifi/aidl/android/hardware/wifi/RttConfig.aidl +++ b/wifi/aidl/android/hardware/wifi/RttConfig.aidl @@ -32,7 +32,7 @@ parcelable RttConfig { */ byte[6] addr; /** - * 1-sided or 2-sided RTT. + * 1-sided or 2-sided RTT (IEEE 802.11mc or IEEE 802. 11az). */ RttType type; /** @@ -47,6 +47,8 @@ parcelable RttConfig { * Time interval between bursts (units: 100 ms). * Applies to 1-sided and 2-sided RTT multi-burst requests. * Range: 0-31, 0: no preference by initiator (2-sided RTT). + * + * Note: Applicable to IEEE 802.11mc only. */ int burstPeriod; /** @@ -60,6 +62,9 @@ parcelable RttConfig { * number of RTT results is the following: * for 1-sided RTT: max num of RTT results = (2^num_burst)*(num_frames_per_burst) * for 2-sided RTT: max num of RTT results = (2^num_burst)*(num_frames_per_burst - 1) + * + * Note: Applicable to IEEE 802.11mc only. For IEEE 802.11az refer + * |RttConfig.txLtfRepetitionCount|. */ int numBurst; /** @@ -70,6 +75,8 @@ parcelable RttConfig { * equals the number of FTM frames that the * initiator will request that the responder sends * in a single frame. + * + * Note: Applicable to IEEE 802.11mc only. */ int numFramesPerBurst; /** @@ -95,8 +102,8 @@ parcelable RttConfig { */ boolean mustRequestLcr; /** - * Applies to 1-sided and 2-sided RTT. Valid values will - * be 2-11 and 15 as specified by the 802.11mc std for + * Applies to 1-sided and 2-sided IEEE 802.11mc RTT. Valid values will + * be 2-11 and 15 as specified by the IEEE 802.11mc std for * the FTM parameter burst duration. In a multi-burst * request, if responder overrides with larger value, * the initiator will return failure. In a single-burst @@ -113,4 +120,17 @@ parcelable RttConfig { * RTT BW to be used in the RTT frames. */ RttBw bw; + /** + * IEEE 802.11az Non-Trigger-based (non-TB) minimum measurement time in milliseconds. + */ + int ntbMinMeasurementTimeMillis; + /** + * IEEE 802.11az Non-Trigger-based (non-TB) maximum measurement time in milliseconds. + */ + int ntbMaxMeasurementTimeMillis; + /** + * Multiple transmissions of HE-LTF symbols in an HE Ranging NDP. A value of 1 indicates no + * repetition. + */ + int txLtfRepetitionCount; } diff --git a/wifi/aidl/android/hardware/wifi/RttPreamble.aidl b/wifi/aidl/android/hardware/wifi/RttPreamble.aidl index e460a949782133b420b4ffd99aee106e6619ec51..21df171bf6f760f997e7b751fa5d1263f6511cc6 100644 --- a/wifi/aidl/android/hardware/wifi/RttPreamble.aidl +++ b/wifi/aidl/android/hardware/wifi/RttPreamble.aidl @@ -22,6 +22,7 @@ package android.hardware.wifi; @VintfStability @Backing(type="int") enum RttPreamble { + INVALID = 0, LEGACY = 0x1, HT = 0x2, VHT = 0x4, diff --git a/wifi/aidl/android/hardware/wifi/RttResult.aidl b/wifi/aidl/android/hardware/wifi/RttResult.aidl index 6c45e2c3495c4c7ba3979a692b4a0db7fd7c7a03..2cb0afa3171f122a5d06f4ad40f4e4193f247853 100644 --- a/wifi/aidl/android/hardware/wifi/RttResult.aidl +++ b/wifi/aidl/android/hardware/wifi/RttResult.aidl @@ -33,6 +33,8 @@ parcelable RttResult { byte[6] addr; /** * Burst number in a multi-burst request. + * + * Note: Applicable to 1-sided RTT and 2-sided IEEE 802.11mc only. */ int burstNum; /** @@ -45,7 +47,7 @@ parcelable RttResult { int successNumber; /** * Maximum number of "FTM frames per burst" supported by - * the responder STA. Applies to 2-sided RTT only. + * the responder STA. Applies to 2-sided IEEE 802.11mc RTT only. * If reponder overrides with larger value: * - for single-burst request, initiator will truncate the * larger value and send a TMR_STOP after receiving as @@ -59,10 +61,8 @@ parcelable RttResult { */ RttStatus status; /** - * If status is RTT_STATUS_FAIL_BUSY_TRY_LATER, - * this will be the time provided by the responder as to - * when the request can be tried again. Applies to 2-sided - * RTT only. In sec, 1-31 sec. + * If status is RTT_STATUS_FAIL_BUSY_TRY_LATER, this will be the time provided by the responder + * as to when the request can be tried again. Applies to 2-sided RTT only. In sec, 1-31 sec. */ byte retryAfterDuration; /** @@ -104,11 +104,13 @@ parcelable RttResult { */ int distanceInMm; /** - * Standard deviation in mm (optional). + * Standard deviation in mm. */ int distanceSdInMm; /** * Difference between max and min distance recorded in mm (optional). + * + * Note: Only applicable for IEEE 802.11mc */ int distanceSpreadInMm; /** @@ -116,21 +118,20 @@ parcelable RttResult { */ long timeStampInUs; /** - * Actual time taken by the FW to finish one burst - * measurement (in ms). Applies to 1-sided and 2-sided RTT. + * Actual time taken by the FW to finish one burst measurement (in ms). Applies to 1-sided + * and 2-sided IEEE 802.11mc RTT. */ int burstDurationInMs; /** - * Number of bursts allowed by the responder. Applies - * to 2-sided RTT only. + * Number of bursts allowed by the responder. Applies to 2-sided IEEE 802.11mc RTT only. */ int negotiatedBurstNum; /** - * For 11mc only. + * For IEEE 802.11mc and IEEE 802.11az only. */ WifiInformationElement lci; /** - * For 11mc only. + * For IEEE 802.11mc and IEEE 802.11az only. */ WifiInformationElement lcr; /** @@ -140,8 +141,38 @@ parcelable RttResult { int channelFreqMHz; /** * RTT packet bandwidth. - * This value is an average bandwidth of the bandwidths of measurement - * frames. Cap the average close to a specific valid RttBw. + * This value is an average bandwidth of the bandwidths of measurement frames. Cap the average + * close to a specific valid RttBw. */ RttBw packetBw; + /** + * IEEE 802.11az Transmit LTF repetitions used to get this result. + */ + int txLtfRepetitionCount; + /** + * Minimum non-trigger based (non-TB) dynamic measurement time in milliseconds assigned by the + * IEEE 802.11az responder. + * + * After initial non-TB negotiation, if the next ranging request for this peer comes in between + * [ntbMinMeasurementTime, ntbMaxMeasurementTime], vendor software shall do the NDPA sounding + * sequence for dynamic non-TB measurement. + * + * If the ranging request for this peer comes sooner than minimum measurement time, vendor + * software shall return the cached result of the last measurement including the time stamp + * |RttResult.timestamp|. + */ + int ntbMinMeasurementTimeMillis; + /** + * Maximum non-trigger based (non-TB) dynamic measurement time in milliseconds assigned by the + * IEEE 802.11az responder. + * + * After initial non-TB negotiation, if the next ranging request for this peer comes in between + * [ntbMinMeasurementTime, ntbMaxMeasurementTime], vendor software shall do the NDPA sounding + * sequence for dynamic non-TB measurement. + * + * If the ranging request for this peer comes later than the maximum measurement time, vendor + * software shall clean up any existing IEEE 802.11ax non-TB ranging session and re-do the + * non-TB ranging negotiation. + */ + int ntbMaxMeasurementTimeMillis; } diff --git a/wifi/aidl/android/hardware/wifi/RttType.aidl b/wifi/aidl/android/hardware/wifi/RttType.aidl index e95a92875a71cb69344887a27fc115ed1aed96ec..3f1a2f165b67271c1e256390453c7d4c88909fb1 100644 --- a/wifi/aidl/android/hardware/wifi/RttType.aidl +++ b/wifi/aidl/android/hardware/wifi/RttType.aidl @@ -23,5 +23,18 @@ package android.hardware.wifi; @Backing(type="int") enum RttType { ONE_SIDED = 1, + /** + * Two-sided RTT 11mc type. + * + * Note: TWO_SIDED was used for IEEE 802.11mc. Use TWO_SIDED_11MC for IEEE 802.11mc instead. + */ TWO_SIDED = 2, + /** + * Two-sided RTT 11mc type is same as two-sided. + */ + TWO_SIDED_11MC = TWO_SIDED, + /** + * Two-sided RTT 11az non trigger based (non-TB) type. + */ + TWO_SIDED_11AZ_NTB = 3, } diff --git a/wifi/aidl/android/hardware/wifi/StaRoamingState.aidl b/wifi/aidl/android/hardware/wifi/StaRoamingState.aidl index d75d3236f158b82203d7d467df51d1009e76c11e..6872a17608a59015cc4407bbfc6e63b4e3eae193 100644 --- a/wifi/aidl/android/hardware/wifi/StaRoamingState.aidl +++ b/wifi/aidl/android/hardware/wifi/StaRoamingState.aidl @@ -32,4 +32,9 @@ enum StaRoamingState { * the |StaRoamingConfig| parameters set using |configureRoaming|. */ ENABLED = 1, + /** + * Driver/Firmware is allowed to roam more aggressively. For instance, + * roaming can be triggered at higher RSSI thresholds than normal. + */ + AGGRESSIVE = 2, } diff --git a/wifi/aidl/android/hardware/wifi/TwtCapabilities.aidl b/wifi/aidl/android/hardware/wifi/TwtCapabilities.aidl new file mode 100644 index 0000000000000000000000000000000000000000..9007d0e5be667478189c1fc189fac3401a486bd5 --- /dev/null +++ b/wifi/aidl/android/hardware/wifi/TwtCapabilities.aidl @@ -0,0 +1,56 @@ +/* + * Copyright (C) 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.hardware.wifi; + +/** + * Target Wake Time (TWT) Capabilities supported. + */ +@VintfStability +parcelable TwtCapabilities { + /** + * Whether the TWT requester mode supported. + */ + boolean isTwtRequesterSupported; + /** + * Whether the TWT responder mode supported. + */ + boolean isTwtResponderSupported; + /** + * Whether the Broadcast TWT mode (TWT scheduling STA) supported. + */ + boolean isBroadcastTwtSupported; + /** + * Whether supports Flexible TWT schedules. + */ + boolean isFlexibleTwtScheduleSupported; + /** + * Minimum TWT wake duration in microseconds. + */ + int minWakeDurationMicros; + /** + * Maximum TWT wake duration in microseconds. + */ + int maxWakeDurationMicros; + /** + * Minimum TWT wake interval in microseconds. + */ + int minWakeIntervalMicros; + /** + * Maximum TWT wake interval in microseconds. + */ + int maxWakeIntervalMicros; +} diff --git a/wifi/aidl/android/hardware/wifi/TwtRequest.aidl b/wifi/aidl/android/hardware/wifi/TwtRequest.aidl new file mode 100644 index 0000000000000000000000000000000000000000..5191713f5736633bc6c1538c15d0524a44bc7c30 --- /dev/null +++ b/wifi/aidl/android/hardware/wifi/TwtRequest.aidl @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.hardware.wifi; + +/** + * Target Wake Time (TWT) Request + */ +@VintfStability +parcelable TwtRequest { + /** + * MLO Link id in case TWT is requesting for MLO connection. Otherwise -1. + */ + int mloLinkId; + /** + * Minimum TWT wake duration in microseconds. + */ + int minWakeDurationMicros; + /** + * Maximum TWT wake duration in microseconds. + */ + int maxWakeDurationMicros; + /** + * Minimum TWT wake interval in microseconds. + */ + int minWakeIntervalMicros; + /** + * Maximum TWT wake interval in microseconds. + */ + int maxWakeIntervalMicros; +} diff --git a/wifi/aidl/android/hardware/wifi/TwtSession.aidl b/wifi/aidl/android/hardware/wifi/TwtSession.aidl new file mode 100644 index 0000000000000000000000000000000000000000..5a7ddb1a0bec927fe12bec8114332fdd820f6bf5 --- /dev/null +++ b/wifi/aidl/android/hardware/wifi/TwtSession.aidl @@ -0,0 +1,92 @@ +/* + * Copyright (C) 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.hardware.wifi; + +/** + * Target Wake Time (TWT) Session + */ +@VintfStability +parcelable TwtSession { + @VintfStability + @Backing(type="byte") + enum TwtNegotiationType { + INDIVIDUAL = 0, + BROADCAST = 1, + } + + /** + * An unique identifier for the session. + */ + int sessionId; + + /** + * MLO Link id in case of MLO connection. Otherwise -1. + */ + int mloLinkId; + + /** + * TWT service period in microseconds. + */ + int wakeDurationMicros; + + /** + * Time interval in microseconds between two successive TWT service periods. + */ + int wakeIntervalMicros; + + /** + * TWT negotiation type. + */ + TwtNegotiationType negotiationType; + + /** + * Whether the TWT session is trigger enabled or non-trigger enabled. + */ + boolean isTriggerEnabled; + + /** + * Whether the TWT session is announced or unannounced. + */ + boolean isAnnounced; + + /** + * Whether the TWT session is implicit or explicit. + */ + boolean isImplicit; + + /** + * Whether the TWT session is protected or not. + */ + boolean isProtected; + + /** + * Whether the TWT session can be updated. + */ + boolean isUpdatable; + + /** + * Whether the TWT session can be suspended and then resumed. + */ + boolean isSuspendable; + + /** + * Whether AP (TWT responder) intends to go to doze state outside of TWT Service Periods. + * + * Refer IEEE 802.11 spec, Section 10.47.7 (TWT Sleep Setup). + */ + boolean isResponderPmModeEnabled; +} diff --git a/wifi/aidl/android/hardware/wifi/TwtSessionStats.aidl b/wifi/aidl/android/hardware/wifi/TwtSessionStats.aidl new file mode 100644 index 0000000000000000000000000000000000000000..e2e2d12b7eb060bdbf980227467e98e61a884a8b --- /dev/null +++ b/wifi/aidl/android/hardware/wifi/TwtSessionStats.aidl @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.hardware.wifi; + +/** + * Target Wake Time (TWT) Session Stats + */ +@VintfStability +parcelable TwtSessionStats { + /** + * Average number of Tx packets in each wake duration. + */ + int avgTxPktCount; + + /** + * Average number of Rx packets in each wake duration. + */ + int avgRxPktCount; + + /** + * Average bytes per Tx packets in each wake duration. + */ + int avgTxPktSize; + + /** + * Average bytes per Rx packets in each wake duration. + */ + int avgRxPktSize; + + /** + * Average End of Service period in microseconds. + */ + int avgEospDurationMicros; + + /** + * Count of early terminations. + */ + int eospCount; +} diff --git a/wifi/aidl/default/Android.bp b/wifi/aidl/default/Android.bp index 91d609ddc7e451e4973cbe30a553fb479ee5e4cc..31a35310463b8743c908e2c98bc56e1f0382f5d6 100644 --- a/wifi/aidl/default/Android.bp +++ b/wifi/aidl/default/Android.bp @@ -105,7 +105,7 @@ cc_library_static { "libwifi-hal", "libwifi-system-iface", "libxml2", - "android.hardware.wifi-V1-ndk", + "android.hardware.wifi-V2-ndk", ], export_include_dirs: ["."], @@ -132,7 +132,7 @@ cc_binary { "libwifi-hal", "libwifi-system-iface", "libxml2", - "android.hardware.wifi-V1-ndk", + "android.hardware.wifi-V2-ndk", ], static_libs: ["android.hardware.wifi-service-lib"], init_rc: ["android.hardware.wifi-service.rc"], @@ -161,7 +161,7 @@ cc_binary { "libwifi-hal", "libwifi-system-iface", "libxml2", - "android.hardware.wifi-V1-ndk", + "android.hardware.wifi-V2-ndk", ], static_libs: ["android.hardware.wifi-service-lib"], init_rc: ["android.hardware.wifi-service-lazy.rc"], @@ -192,7 +192,8 @@ cc_test { static_libs: [ "libgmock", "libgtest", - "android.hardware.wifi-V1-ndk", + "android.hardware.wifi-V2-ndk", + "android.hardware.wifi.common-V1-ndk", "android.hardware.wifi-service-lib", ], shared_libs: [ diff --git a/wifi/aidl/default/aidl_struct_util.cpp b/wifi/aidl/default/aidl_struct_util.cpp index 83e11939fd6d57632d0951f3d09006ae53943619..b62b3a0774c2ee0bce1046533c02fa0567edcbd7 100644 --- a/wifi/aidl/default/aidl_struct_util.cpp +++ b/wifi/aidl/default/aidl_struct_util.cpp @@ -59,6 +59,8 @@ IWifiChip::FeatureSetMask convertLegacyChipFeatureToAidl(uint64_t feature) { return IWifiChip::FeatureSetMask::P2P_RAND_MAC; case WIFI_FEATURE_AFC_CHANNEL: return IWifiChip::FeatureSetMask::SET_AFC_CHANNEL_ALLOWANCE; + case WIFI_FEATURE_SET_VOIP_MODE: + return IWifiChip::FeatureSetMask::SET_VOIP_MODE; }; CHECK(false) << "Unknown legacy feature: " << feature; return {}; @@ -92,6 +94,10 @@ IWifiStaIface::FeatureSetMask convertLegacyStaIfaceFeatureToAidl(uint64_t featur return IWifiStaIface::FeatureSetMask::ND_OFFLOAD; case WIFI_FEATURE_MKEEP_ALIVE: return IWifiStaIface::FeatureSetMask::KEEP_ALIVE; + case WIFI_FEATURE_ROAMING_MODE_CONTROL: + return IWifiStaIface::FeatureSetMask::ROAMING_MODE_CONTROL; + case WIFI_FEATURE_CACHED_SCAN_RESULTS: + return IWifiStaIface::FeatureSetMask::CACHED_SCAN_DATA; }; CHECK(false) << "Unknown legacy feature: " << feature; return {}; @@ -109,7 +115,8 @@ bool convertLegacyChipFeaturesToAidl(uint64_t legacy_feature_set, uint32_t* aidl WIFI_FEATURE_INFRA_60G, WIFI_FEATURE_SET_LATENCY_MODE, WIFI_FEATURE_P2P_RAND_MAC, - WIFI_FEATURE_AFC_CHANNEL}; + WIFI_FEATURE_AFC_CHANNEL, + WIFI_FEATURE_SET_VOIP_MODE}; for (const auto feature : features) { if (feature & legacy_feature_set) { *aidl_feature_set |= static_cast(convertLegacyChipFeatureToAidl(feature)); @@ -457,7 +464,8 @@ bool convertLegacyStaIfaceFeaturesToAidl(uint64_t legacy_feature_set, uint32_t* {WIFI_FEATURE_GSCAN, WIFI_FEATURE_LINK_LAYER_STATS, WIFI_FEATURE_RSSI_MONITOR, WIFI_FEATURE_CONTROL_ROAMING, WIFI_FEATURE_IE_WHITELIST, WIFI_FEATURE_SCAN_RAND, WIFI_FEATURE_INFRA_5G, WIFI_FEATURE_HOTSPOT, WIFI_FEATURE_PNO, WIFI_FEATURE_TDLS, - WIFI_FEATURE_TDLS_OFFCHANNEL, WIFI_FEATURE_CONFIG_NDO, WIFI_FEATURE_MKEEP_ALIVE}) { + WIFI_FEATURE_TDLS_OFFCHANNEL, WIFI_FEATURE_CONFIG_NDO, WIFI_FEATURE_MKEEP_ALIVE, + WIFI_FEATURE_ROAMING_MODE_CONTROL, WIFI_FEATURE_CACHED_SCAN_RESULTS}) { if (feature & legacy_feature_set) { *aidl_feature_set |= static_cast(convertLegacyStaIfaceFeatureToAidl(feature)); } @@ -1147,6 +1155,8 @@ legacy_hal::fw_roaming_state_t convertAidlRoamingStateToLegacy(StaRoamingState s return legacy_hal::ROAMING_ENABLE; case StaRoamingState::DISABLED: return legacy_hal::ROAMING_DISABLE; + case StaRoamingState::AGGRESSIVE: + return legacy_hal::ROAMING_AGGRESSIVE; }; CHECK(false); } @@ -2088,6 +2098,17 @@ bool convertAidlNanDataPathInitiatorRequestToLegacy( memcpy(legacy_request->scid, aidl_request.securityConfig.scid.data(), legacy_request->scid_len); legacy_request->publish_subscribe_id = static_cast(aidl_request.discoverySessionId); + legacy_request->csia_capabilities |= + aidl_request.securityConfig.enable16ReplyCountersForTksa ? 0x1 : 0x0; + legacy_request->csia_capabilities |= + aidl_request.securityConfig.enable16ReplyCountersForGtksa ? 0x8 : 0x0; + if (aidl_request.securityConfig.supportGtkAndIgtk) { + legacy_request->csia_capabilities |= aidl_request.securityConfig.supportBigtksa ? 0x4 : 0x2; + } + legacy_request->csia_capabilities |= aidl_request.securityConfig.enableNcsBip256 ? 0x16 : 0x0; + legacy_request->gtk_protection = + aidl_request.securityConfig.requiresEnhancedFrameProtection ? 1 : 0; + return true; } @@ -2170,6 +2191,17 @@ bool convertAidlNanDataPathIndicationResponseToLegacy( memcpy(legacy_request->scid, aidl_request.securityConfig.scid.data(), legacy_request->scid_len); legacy_request->publish_subscribe_id = static_cast(aidl_request.discoverySessionId); + legacy_request->csia_capabilities |= + aidl_request.securityConfig.enable16ReplyCountersForTksa ? 0x1 : 0x0; + legacy_request->csia_capabilities |= + aidl_request.securityConfig.enable16ReplyCountersForGtksa ? 0x8 : 0x0; + if (aidl_request.securityConfig.supportGtkAndIgtk) { + legacy_request->csia_capabilities |= aidl_request.securityConfig.supportBigtksa ? 0x4 : 0x2; + } + legacy_request->csia_capabilities |= aidl_request.securityConfig.enableNcsBip256 ? 0x16 : 0x0; + legacy_request->gtk_protection = + aidl_request.securityConfig.requiresEnhancedFrameProtection ? 1 : 0; + return true; } @@ -2394,8 +2426,11 @@ legacy_hal::wifi_rtt_type convertAidlRttTypeToLegacy(RttType type) { switch (type) { case RttType::ONE_SIDED: return legacy_hal::RTT_TYPE_1_SIDED; - case RttType::TWO_SIDED: - return legacy_hal::RTT_TYPE_2_SIDED; + case RttType::TWO_SIDED_11MC: + // Same as RttType::TWO_SIDED + return legacy_hal::RTT_TYPE_2_SIDED_11MC; + case RttType::TWO_SIDED_11AZ_NTB: + return legacy_hal::RTT_TYPE_2_SIDED_11AZ_NTB; }; CHECK(false); } @@ -2404,8 +2439,11 @@ RttType convertLegacyRttTypeToAidl(legacy_hal::wifi_rtt_type type) { switch (type) { case legacy_hal::RTT_TYPE_1_SIDED: return RttType::ONE_SIDED; - case legacy_hal::RTT_TYPE_2_SIDED: - return RttType::TWO_SIDED; + case legacy_hal::RTT_TYPE_2_SIDED_11MC: + // Same as legacy_hal::RTT_TYPE_2_SIDED + return RttType::TWO_SIDED_11MC; + case legacy_hal::RTT_TYPE_2_SIDED_11AZ_NTB: + return RttType::TWO_SIDED_11AZ_NTB; }; CHECK(false) << "Unknown legacy type: " << type; } @@ -2485,6 +2523,8 @@ legacy_hal::wifi_rtt_preamble convertAidlRttPreambleToLegacy(RttPreamble type) { return legacy_hal::WIFI_RTT_PREAMBLE_HE; case RttPreamble::EHT: return legacy_hal::WIFI_RTT_PREAMBLE_EHT; + case RttPreamble::INVALID: + return legacy_hal::WIFI_RTT_PREAMBLE_INVALID; }; CHECK(false); } @@ -2501,6 +2541,8 @@ RttPreamble convertLegacyRttPreambleToAidl(legacy_hal::wifi_rtt_preamble type) { return RttPreamble::HE; case legacy_hal::WIFI_RTT_PREAMBLE_EHT: return RttPreamble::EHT; + case legacy_hal::WIFI_RTT_PREAMBLE_INVALID: + return RttPreamble::INVALID; }; CHECK(false) << "Unknown legacy type: " << type; } @@ -2690,6 +2732,21 @@ bool convertAidlRttConfigToLegacy(const RttConfig& aidl_config, return true; } +bool convertAidlRttConfigToLegacyV3(const RttConfig& aidl_config, + legacy_hal::wifi_rtt_config_v3* legacy_config) { + if (!legacy_config) { + return false; + } + *legacy_config = {}; + if (!convertAidlRttConfigToLegacy(aidl_config, &(legacy_config->rtt_config))) { + return false; + } + legacy_config->tx_ltf_repetition_count = aidl_config.txLtfRepetitionCount; + legacy_config->ntb_min_measurement_time_millis = aidl_config.ntbMinMeasurementTimeMillis; + legacy_config->ntb_max_measurement_time_millis = aidl_config.ntbMaxMeasurementTimeMillis; + return true; +} + bool convertAidlVectorOfRttConfigToLegacy( const std::vector& aidl_configs, std::vector* legacy_configs) { @@ -2699,7 +2756,24 @@ bool convertAidlVectorOfRttConfigToLegacy( *legacy_configs = {}; for (const auto& aidl_config : aidl_configs) { legacy_hal::wifi_rtt_config legacy_config; - if (!convertAidlRttConfigToLegacy(aidl_config, &legacy_config)) { + if (!convertAidlRttConfigToLegacy(aidl_config, &(legacy_config))) { + return false; + } + legacy_configs->push_back(legacy_config); + } + return true; +} + +bool convertAidlVectorOfRttConfigToLegacyV3( + const std::vector& aidl_configs, + std::vector* legacy_configs) { + if (!legacy_configs) { + return false; + } + *legacy_configs = {}; + for (const auto& aidl_config : aidl_configs) { + legacy_hal::wifi_rtt_config_v3 legacy_config; + if (!convertAidlRttConfigToLegacyV3(aidl_config, &legacy_config)) { return false; } legacy_configs->push_back(legacy_config); @@ -2768,40 +2842,84 @@ bool convertLegacyRttResponderToAidl(const legacy_hal::wifi_rtt_responder& legac return true; } -bool convertLegacyRttCapabilitiesToAidl( - const legacy_hal::wifi_rtt_capabilities& legacy_capabilities, - RttCapabilities* aidl_capabilities) { - if (!aidl_capabilities) { - return false; - } - *aidl_capabilities = {}; - aidl_capabilities->rttOneSidedSupported = legacy_capabilities.rtt_one_sided_supported; - aidl_capabilities->rttFtmSupported = legacy_capabilities.rtt_ftm_supported; - aidl_capabilities->lciSupported = legacy_capabilities.lci_support; - aidl_capabilities->lcrSupported = legacy_capabilities.lcr_support; - aidl_capabilities->responderSupported = legacy_capabilities.responder_supported; - int32_t preambleSupport = 0; +RttPreamble convertLegacyRttPreambleBitmapToAidl(byte legacyPreambleBitmap) { + int32_t aidlPreambleBitmap = 0; for (const auto flag : {legacy_hal::WIFI_RTT_PREAMBLE_LEGACY, legacy_hal::WIFI_RTT_PREAMBLE_HT, legacy_hal::WIFI_RTT_PREAMBLE_VHT, legacy_hal::WIFI_RTT_PREAMBLE_HE, legacy_hal::WIFI_RTT_PREAMBLE_EHT}) { - if (legacy_capabilities.preamble_support & flag) { - preambleSupport |= static_cast::type>( + if (legacyPreambleBitmap & flag) { + aidlPreambleBitmap |= static_cast::type>( convertLegacyRttPreambleToAidl(flag)); } } - aidl_capabilities->preambleSupport = static_cast(preambleSupport); - int32_t bwSupport = 0; + + return static_cast(aidlPreambleBitmap); +} + +RttBw convertLegacyRttBwBitmapToAidl(byte legacyBwBitmap) { + int32_t aidlBwBitmap = 0; for (const auto flag : {legacy_hal::WIFI_RTT_BW_5, legacy_hal::WIFI_RTT_BW_10, legacy_hal::WIFI_RTT_BW_20, legacy_hal::WIFI_RTT_BW_40, legacy_hal::WIFI_RTT_BW_80, legacy_hal::WIFI_RTT_BW_160, legacy_hal::WIFI_RTT_BW_320}) { - if (legacy_capabilities.bw_support & flag) { - bwSupport |= + if (legacyBwBitmap & flag) { + aidlBwBitmap |= static_cast::type>(convertLegacyRttBwToAidl(flag)); } } - aidl_capabilities->bwSupport = static_cast(bwSupport); + return static_cast(aidlBwBitmap); +} + +bool convertLegacyRttCapabilitiesToAidl( + const legacy_hal::wifi_rtt_capabilities& legacy_capabilities, + RttCapabilities* aidl_capabilities) { + if (!aidl_capabilities) { + return false; + } + *aidl_capabilities = {}; + aidl_capabilities->rttOneSidedSupported = legacy_capabilities.rtt_one_sided_supported; + aidl_capabilities->rttFtmSupported = legacy_capabilities.rtt_ftm_supported; + aidl_capabilities->lciSupported = legacy_capabilities.lci_support; + aidl_capabilities->lcrSupported = legacy_capabilities.lcr_support; + aidl_capabilities->responderSupported = legacy_capabilities.responder_supported; + aidl_capabilities->preambleSupport = + convertLegacyRttPreambleBitmapToAidl(legacy_capabilities.preamble_support); + aidl_capabilities->bwSupport = convertLegacyRttBwBitmapToAidl(legacy_capabilities.bw_support); aidl_capabilities->mcVersion = legacy_capabilities.mc_version; + // Initialize 11az parameters to default + aidl_capabilities->azPreambleSupport = RttPreamble::INVALID; + aidl_capabilities->azBwSupport = RttBw::BW_UNSPECIFIED; + aidl_capabilities->ntbInitiatorSupported = false; + aidl_capabilities->ntbResponderSupported = false; + aidl_capabilities->maxTxLtfRepetitionCount = 0; + return true; +} + +bool convertLegacyRttCapabilitiesV3ToAidl( + const legacy_hal::wifi_rtt_capabilities_v3& legacy_capabilities_v3, + RttCapabilities* aidl_capabilities) { + if (!aidl_capabilities) { + return false; + } + *aidl_capabilities = {}; + aidl_capabilities->rttOneSidedSupported = + legacy_capabilities_v3.rtt_capab.rtt_one_sided_supported; + aidl_capabilities->rttFtmSupported = legacy_capabilities_v3.rtt_capab.rtt_ftm_supported; + aidl_capabilities->lciSupported = legacy_capabilities_v3.rtt_capab.lci_support; + aidl_capabilities->lcrSupported = legacy_capabilities_v3.rtt_capab.lcr_support; + aidl_capabilities->responderSupported = legacy_capabilities_v3.rtt_capab.responder_supported; + aidl_capabilities->preambleSupport = + convertLegacyRttPreambleBitmapToAidl(legacy_capabilities_v3.rtt_capab.preamble_support); + aidl_capabilities->bwSupport = + convertLegacyRttBwBitmapToAidl(legacy_capabilities_v3.rtt_capab.bw_support); + aidl_capabilities->mcVersion = legacy_capabilities_v3.rtt_capab.mc_version; + aidl_capabilities->azPreambleSupport = + convertLegacyRttPreambleBitmapToAidl(legacy_capabilities_v3.az_preamble_support); + aidl_capabilities->azBwSupport = + convertLegacyRttBwBitmapToAidl(legacy_capabilities_v3.az_bw_support); + aidl_capabilities->ntbInitiatorSupported = legacy_capabilities_v3.ntb_initiator_supported; + aidl_capabilities->ntbResponderSupported = legacy_capabilities_v3.ntb_responder_supported; + aidl_capabilities->maxTxLtfRepetitionCount = legacy_capabilities_v3.max_tx_ltf_repetition_count; return true; } @@ -2876,6 +2994,9 @@ bool convertLegacyVectorOfRttResultToAidl( } aidl_result.channelFreqMHz = 0; aidl_result.packetBw = RttBw::BW_UNSPECIFIED; + aidl_result.txLtfRepetitionCount = 0; + aidl_result.ntbMinMeasurementTimeMillis = 0; + aidl_result.ntbMaxMeasurementTimeMillis = 0; aidl_results->push_back(aidl_result); } return true; @@ -2896,6 +3017,33 @@ bool convertLegacyVectorOfRttResultV2ToAidl( aidl_result.channelFreqMHz = legacy_result->frequency != UNSPECIFIED ? legacy_result->frequency : 0; aidl_result.packetBw = convertLegacyRttBwToAidl(legacy_result->packet_bw); + aidl_result.txLtfRepetitionCount = 0; + aidl_result.ntbMinMeasurementTimeMillis = 0; + aidl_result.ntbMaxMeasurementTimeMillis = 0; + aidl_results->push_back(aidl_result); + } + return true; +} + +bool convertLegacyVectorOfRttResultV3ToAidl( + const std::vector& legacy_results, + std::vector* aidl_results) { + if (!aidl_results) { + return false; + } + *aidl_results = {}; + for (const auto legacy_result : legacy_results) { + RttResult aidl_result; + if (!convertLegacyRttResultToAidl(legacy_result->rtt_result.rtt_result, &aidl_result)) { + return false; + } + aidl_result.channelFreqMHz = legacy_result->rtt_result.frequency != UNSPECIFIED + ? legacy_result->rtt_result.frequency + : 0; + aidl_result.packetBw = convertLegacyRttBwToAidl(legacy_result->rtt_result.packet_bw); + aidl_result.txLtfRepetitionCount = legacy_result->tx_ltf_repetition_count; + aidl_result.ntbMinMeasurementTimeMillis = legacy_result->ntb_min_measurement_time_millis; + aidl_result.ntbMaxMeasurementTimeMillis = legacy_result->ntb_max_measurement_time_millis; aidl_results->push_back(aidl_result); } return true; @@ -3178,6 +3326,8 @@ bool convertAidlNanBootstrappingInitiatorRequestToLegacy( legacy_request->cookie_length = aidl_request.cookie.size(); memcpy(legacy_request->cookie, aidl_request.cookie.data(), legacy_request->cookie_length); + legacy_request->publish_subscribe_id = static_cast(aidl_request.discoverySessionId); + legacy_request->comeback = aidl_request.isComeback ? 0x1 : 0x0; return true; } @@ -3195,6 +3345,7 @@ bool convertAidlNanBootstrappingIndicationResponseToLegacy( legacy_request->service_instance_id = aidl_request.bootstrappingInstanceId; legacy_request->rsp_code = aidl_request.acceptRequest ? NAN_BOOTSTRAPPING_REQUEST_ACCEPT : NAN_BOOTSTRAPPING_REQUEST_REJECT; + legacy_request->publish_subscribe_id = static_cast(aidl_request.discoverySessionId); return true; } @@ -3362,6 +3513,195 @@ bool convertLegacyIfaceCombinationsMatrixToChipMode( return true; } +bool convertCachedScanReportToAidl(const legacy_hal::WifiCachedScanReport& report, + CachedScanData* aidl_scan_data) { + if (!aidl_scan_data) { + return false; + } + *aidl_scan_data = {}; + + std::vector aidl_scan_results; + for (const auto& result : report.results) { + CachedScanResult aidl_scan_result; + if (!convertCachedScanResultToAidl(result, report.ts, &aidl_scan_result)) { + return false; + } + aidl_scan_results.push_back(aidl_scan_result); + } + aidl_scan_data->cachedScanResults = aidl_scan_results; + + aidl_scan_data->scannedFrequenciesMhz = report.scanned_freqs; + return true; +} + +bool convertCachedScanResultToAidl(const legacy_hal::wifi_cached_scan_result& legacy_scan_result, + uint64_t ts_us, CachedScanResult* aidl_scan_result) { + if (!aidl_scan_result) { + return false; + } + *aidl_scan_result = {}; + aidl_scan_result->timeStampInUs = ts_us - legacy_scan_result.age_ms * 1000; + if (aidl_scan_result->timeStampInUs < 0) { + aidl_scan_result->timeStampInUs = 0; + return false; + } + size_t max_len_excluding_null = sizeof(legacy_scan_result.ssid) - 1; + size_t ssid_len = strnlen((const char*)legacy_scan_result.ssid, max_len_excluding_null); + aidl_scan_result->ssid = + std::vector(legacy_scan_result.ssid, legacy_scan_result.ssid + ssid_len); + aidl_scan_result->bssid = std::array(); + std::copy(legacy_scan_result.bssid, legacy_scan_result.bssid + 6, + std::begin(aidl_scan_result->bssid)); + aidl_scan_result->frequencyMhz = legacy_scan_result.chanspec.primary_frequency; + aidl_scan_result->channelWidthMhz = + convertLegacyWifiChannelWidthToAidl(legacy_scan_result.chanspec.width); + aidl_scan_result->rssiDbm = legacy_scan_result.rssi; + aidl_scan_result->preambleType = convertScanResultFlagsToPreambleType(legacy_scan_result.flags); + return true; +} + +WifiRatePreamble convertScanResultFlagsToPreambleType(int flags) { + if ((flags & WIFI_CACHED_SCAN_RESULT_FLAGS_EHT_OPS_PRESENT) > 0) { + return WifiRatePreamble::EHT; + } + if ((flags & WIFI_CACHED_SCAN_RESULT_FLAGS_HE_OPS_PRESENT) > 0) { + return WifiRatePreamble::HE; + } + if ((flags & WIFI_CACHED_SCAN_RESULT_FLAGS_VHT_OPS_PRESENT) > 0) { + return WifiRatePreamble::VHT; + } + if ((flags & WIFI_CACHED_SCAN_RESULT_FLAGS_HT_OPS_PRESENT) > 0) { + return WifiRatePreamble::HT; + } + return WifiRatePreamble::OFDM; +} + +bool convertTwtCapabilitiesToAidl(legacy_hal::wifi_twt_capabilities legacy_twt_capabs, + TwtCapabilities* aidl_twt_capabs) { + if (!aidl_twt_capabs) { + return false; + } + aidl_twt_capabs->isTwtRequesterSupported = legacy_twt_capabs.is_twt_requester_supported; + aidl_twt_capabs->isTwtResponderSupported = legacy_twt_capabs.is_twt_responder_supported; + aidl_twt_capabs->isBroadcastTwtSupported = legacy_twt_capabs.is_flexible_twt_supported; + if (legacy_twt_capabs.min_wake_duration_micros > legacy_twt_capabs.max_wake_duration_micros) { + return false; + } + aidl_twt_capabs->minWakeDurationMicros = legacy_twt_capabs.min_wake_duration_micros; + aidl_twt_capabs->maxWakeDurationMicros = legacy_twt_capabs.max_wake_duration_micros; + if (legacy_twt_capabs.min_wake_interval_micros > legacy_twt_capabs.max_wake_interval_micros) { + return false; + } + aidl_twt_capabs->minWakeIntervalMicros = legacy_twt_capabs.min_wake_interval_micros; + aidl_twt_capabs->maxWakeIntervalMicros = legacy_twt_capabs.max_wake_interval_micros; + return true; +} + +bool convertAidlTwtRequestToLegacy(const TwtRequest aidl_twt_request, + legacy_hal::wifi_twt_request* legacy_twt_request) { + if (legacy_twt_request == nullptr) { + return false; + } + legacy_twt_request->mlo_link_id = aidl_twt_request.mloLinkId; + if (aidl_twt_request.minWakeDurationMicros > aidl_twt_request.maxWakeDurationMicros) { + return false; + } + legacy_twt_request->min_wake_duration_micros = aidl_twt_request.minWakeDurationMicros; + legacy_twt_request->max_wake_duration_micros = aidl_twt_request.maxWakeDurationMicros; + if (aidl_twt_request.minWakeIntervalMicros > aidl_twt_request.maxWakeIntervalMicros) { + return false; + } + legacy_twt_request->min_wake_interval_micros = aidl_twt_request.minWakeIntervalMicros; + legacy_twt_request->max_wake_interval_micros = aidl_twt_request.maxWakeIntervalMicros; + return true; +} + +IWifiStaIfaceEventCallback::TwtErrorCode convertLegacyHalTwtErrorCodeToAidl( + legacy_hal::wifi_twt_error_code legacy_error_code) { + switch (legacy_error_code) { + case WIFI_TWT_ERROR_CODE_TIMEOUT: + return IWifiStaIfaceEventCallback::TwtErrorCode::TIMEOUT; + case WIFI_TWT_ERROR_CODE_PEER_REJECTED: + return IWifiStaIfaceEventCallback::TwtErrorCode::PEER_REJECTED; + case WIFI_TWT_ERROR_CODE_PEER_NOT_SUPPORTED: + return IWifiStaIfaceEventCallback::TwtErrorCode::PEER_NOT_SUPPORTED; + case WIFI_TWT_ERROR_CODE_NOT_SUPPORTED: + return IWifiStaIfaceEventCallback::TwtErrorCode::NOT_SUPPORTED; + case WIFI_TWT_ERROR_CODE_NOT_AVAILABLE: + return IWifiStaIfaceEventCallback::TwtErrorCode::NOT_AVAILABLE; + case WIFI_TWT_ERROR_CODE_MAX_SESSION_REACHED: + return IWifiStaIfaceEventCallback::TwtErrorCode::MAX_SESSION_REACHED; + case WIFI_TWT_ERROR_CODE_INVALID_PARAMS: + return IWifiStaIfaceEventCallback::TwtErrorCode::INVALID_PARAMS; + case WIFI_TWT_ERROR_CODE_ALREADY_SUSPENDED: + return IWifiStaIfaceEventCallback::TwtErrorCode::ALREADY_SUSPENDED; + case WIFI_TWT_ERROR_CODE_ALREADY_RESUMED: + return IWifiStaIfaceEventCallback::TwtErrorCode::ALREADY_RESUMED; + default: + return IWifiStaIfaceEventCallback::TwtErrorCode::FAILURE_UNKNOWN; + } +} + +IWifiStaIfaceEventCallback::TwtTeardownReasonCode convertLegacyHalTwtReasonCodeToAidl( + legacy_hal::wifi_twt_teardown_reason_code legacy_reason_code) { + switch (legacy_reason_code) { + case WIFI_TWT_TEARDOWN_REASON_CODE_LOCALLY_REQUESTED: + return IWifiStaIfaceEventCallback::TwtTeardownReasonCode::LOCALLY_REQUESTED; + case WIFI_TWT_TEARDOWN_REASON_CODE_INTERNALLY_INITIATED: + return IWifiStaIfaceEventCallback::TwtTeardownReasonCode::INTERNALLY_INITIATED; + case WIFI_TWT_TEARDOWN_REASON_CODE_PEER_INITIATED: + return IWifiStaIfaceEventCallback::TwtTeardownReasonCode::PEER_INITIATED; + default: + return IWifiStaIfaceEventCallback::TwtTeardownReasonCode::UNKNOWN; + } +} + +bool convertLegacyHalTwtSessionToAidl(legacy_hal::wifi_twt_session twt_session, + TwtSession* aidl_twt_session) { + if (aidl_twt_session == nullptr) { + return false; + } + + aidl_twt_session->sessionId = twt_session.session_id; + aidl_twt_session->mloLinkId = twt_session.mlo_link_id; + aidl_twt_session->wakeDurationMicros = twt_session.wake_duration_micros; + aidl_twt_session->wakeIntervalMicros = twt_session.wake_interval_micros; + switch (twt_session.negotiation_type) { + case WIFI_TWT_NEGO_TYPE_INDIVIDUAL: + aidl_twt_session->negotiationType = TwtSession::TwtNegotiationType::INDIVIDUAL; + break; + case WIFI_TWT_NEGO_TYPE_BROADCAST: + aidl_twt_session->negotiationType = TwtSession::TwtNegotiationType::BROADCAST; + break; + default: + return false; + } + aidl_twt_session->isTriggerEnabled = twt_session.is_trigger_enabled; + aidl_twt_session->isAnnounced = twt_session.is_announced; + aidl_twt_session->isImplicit = twt_session.is_implicit; + aidl_twt_session->isProtected = twt_session.is_protected; + aidl_twt_session->isUpdatable = twt_session.is_updatable; + aidl_twt_session->isSuspendable = twt_session.is_suspendable; + aidl_twt_session->isResponderPmModeEnabled = twt_session.is_responder_pm_mode_enabled; + return true; +} + +bool convertLegacyHalTwtSessionStatsToAidl(legacy_hal::wifi_twt_session_stats twt_stats, + TwtSessionStats* aidl_twt_stats) { + if (aidl_twt_stats == nullptr) { + return false; + } + + aidl_twt_stats->avgTxPktCount = twt_stats.avg_pkt_num_tx; + aidl_twt_stats->avgRxPktCount = twt_stats.avg_pkt_num_rx; + aidl_twt_stats->avgTxPktSize = twt_stats.avg_tx_pkt_size; + aidl_twt_stats->avgRxPktSize = twt_stats.avg_rx_pkt_size; + aidl_twt_stats->avgEospDurationMicros = twt_stats.avg_eosp_dur_us; + aidl_twt_stats->eospCount = twt_stats.eosp_count; + + return true; +} + } // namespace aidl_struct_util } // namespace wifi } // namespace hardware diff --git a/wifi/aidl/default/aidl_struct_util.h b/wifi/aidl/default/aidl_struct_util.h index e4ff9638bb74f114e82d3807e69733fe1724d950..708936354a819f14d8aadbdddc95c6d8a9b6cb43 100644 --- a/wifi/aidl/default/aidl_struct_util.h +++ b/wifi/aidl/default/aidl_struct_util.h @@ -148,6 +148,10 @@ bool convertLegacyNanDataPathScheduleUpdateIndToAidl( // RTT controller conversion methods. bool convertAidlVectorOfRttConfigToLegacy(const std::vector& aidl_configs, std::vector* legacy_configs); +bool convertAidlVectorOfRttConfigToLegacyV3( + const std::vector& aidl_configs, + std::vector* legacy_configs); + bool convertAidlRttLciInformationToLegacy(const RttLciInformation& aidl_info, legacy_hal::wifi_lci_information* legacy_info); bool convertAidlRttLcrInformationToLegacy(const RttLcrInformation& aidl_info, @@ -161,12 +165,19 @@ bool convertLegacyRttResponderToAidl(const legacy_hal::wifi_rtt_responder& legac bool convertLegacyRttCapabilitiesToAidl( const legacy_hal::wifi_rtt_capabilities& legacy_capabilities, RttCapabilities* aidl_capabilities); +bool convertLegacyRttCapabilitiesV3ToAidl( + const legacy_hal::wifi_rtt_capabilities_v3& legacy_capabilities_v3, + RttCapabilities* aidl_capabilities); + bool convertLegacyVectorOfRttResultToAidl( const std::vector& legacy_results, std::vector* aidl_results); bool convertLegacyVectorOfRttResultV2ToAidl( const std::vector& legacy_results, std::vector* aidl_results); +bool convertLegacyVectorOfRttResultV3ToAidl( + const std::vector& legacy_results, + std::vector* aidl_results); uint32_t convertAidlWifiBandToLegacyMacBand(WifiBand band); uint32_t convertAidlWifiIfaceModeToLegacy(uint32_t aidl_iface_mask); uint32_t convertAidlUsableChannelFilterToLegacy(uint32_t aidl_filter_mask); @@ -202,6 +213,23 @@ bool convertLegacyNanBootstrappingConfirmIndToAidl( const legacy_hal::NanBootstrappingConfirmInd& legacy_ind, NanBootstrappingConfirmInd* aidl_ind); uint32_t convertAidlChannelCategoryToLegacy(uint32_t aidl_channel_category_mask); +bool convertCachedScanReportToAidl(const legacy_hal::WifiCachedScanReport& report, + CachedScanData* aidl_scan_data); +bool convertCachedScanResultToAidl(const legacy_hal::wifi_cached_scan_result& legacy_scan_result, + uint64_t ts_us, CachedScanResult* aidl_scan_result); +WifiRatePreamble convertScanResultFlagsToPreambleType(int flags); +bool convertTwtCapabilitiesToAidl(const legacy_hal::wifi_twt_capabilities legacy_twt_capabs, + TwtCapabilities* aidl_twt_capabs); +bool convertAidlTwtRequestToLegacy(const TwtRequest aidl_twt_request, + legacy_hal::wifi_twt_request* legacy_twt_request); +IWifiStaIfaceEventCallback::TwtErrorCode convertLegacyHalTwtErrorCodeToAidl( + legacy_hal::wifi_twt_error_code legacy_error_code); +IWifiStaIfaceEventCallback::TwtTeardownReasonCode convertLegacyHalTwtReasonCodeToAidl( + legacy_hal::wifi_twt_teardown_reason_code legacy_reason_code); +bool convertLegacyHalTwtSessionToAidl(legacy_hal::wifi_twt_session twt_session, + TwtSession* aidl_twt_session); +bool convertLegacyHalTwtSessionStatsToAidl(legacy_hal::wifi_twt_session_stats twt_stats, + TwtSessionStats* aidl_twt_stats); } // namespace aidl_struct_util } // namespace wifi } // namespace hardware diff --git a/wifi/aidl/default/android.hardware.wifi-service.xml b/wifi/aidl/default/android.hardware.wifi-service.xml index 5398ee77b5d755f026f940dbe7956491fcce68ff..3b68c8eeb0bd969cb349122cfc9688174d6305eb 100644 --- a/wifi/aidl/default/android.hardware.wifi-service.xml +++ b/wifi/aidl/default/android.hardware.wifi-service.xml @@ -1,6 +1,7 @@ android.hardware.wifi + 2 IWifi/default diff --git a/wifi/aidl/default/tests/aidl_struct_util_unit_tests.cpp b/wifi/aidl/default/tests/aidl_struct_util_unit_tests.cpp index 995a13d99682e1141747089b61b18c072299dc60..2a030eee1ac0b7ab3c011a2cf103f9509f9b3580 100644 --- a/wifi/aidl/default/tests/aidl_struct_util_unit_tests.cpp +++ b/wifi/aidl/default/tests/aidl_struct_util_unit_tests.cpp @@ -35,6 +35,12 @@ byte LCI[] = {0x27, 0x1A, 0x1, 0x00, 0x8, 0x01, 0x00, 0x08, 0x00, 0x10, 0x52, 0x2c, 0x00, 0x00, 0x41, 0x06, 0x03, 0x06, 0x00, 0x80}; byte LCR[] = {0x27, 0xE, 0x1, 0x00, 0xB, 0x01, 0x00, 0x0b, 0x00, 0x09, 0x55, 0x53, 0x18, 0x05, 0x39, 0x34, 0x30, 0x34, 0x33}; + +constexpr int kNumScanResult = 2; +constexpr int kRssi[] = {-60, -70}; +constexpr uint8_t kBssid[] = {0x12, 0x34, 0x56, 0x78, 0x9a, 0}; +constexpr uint8_t kSsidLen = 6; +constexpr char kSsid[] = {'a', 'b', 'c', 'd', 'e', '\0'}; } // namespace namespace aidl { @@ -883,6 +889,51 @@ TEST_F(AidlStructUtilTest, convertLegacyVectorOfRttResultV2ToAidl) { } } +TEST_F(AidlStructUtilTest, convertCachedScanReportToAidl) { + legacy_hal::WifiCachedScanReport hw_report; + + hw_report.ts = 10000000; + std::vector scanned_freqs{5260, 2437, 5200}; + std::vector results; + hw_report.scanned_freqs = scanned_freqs; + + for (int i = 0; i < kNumScanResult; i++) { + wifi_cached_scan_result result; + result.age_ms = i * 1000; + result.capability = i; + memcpy(result.ssid, kSsid, kSsidLen); + result.ssid_len = kSsidLen; + memcpy(result.bssid, kBssid, 6); + result.flags = WIFI_CACHED_SCAN_RESULT_FLAGS_HE_OPS_PRESENT; + result.rssi = kRssi[i]; + result.chanspec = {legacy_hal::WIFI_CHAN_WIDTH_40, 0, 0, i}; + results.push_back(result); + } + hw_report.results = results; + + CachedScanData aidl_data; + aidl_struct_util::convertCachedScanReportToAidl(hw_report, &aidl_data); + + EXPECT_EQ(scanned_freqs.size(), aidl_data.scannedFrequenciesMhz.size()); + EXPECT_EQ(scanned_freqs[2], aidl_data.scannedFrequenciesMhz[2]); + EXPECT_EQ(5260, aidl_data.scannedFrequenciesMhz[0]); + EXPECT_EQ(kNumScanResult, (int)aidl_data.cachedScanResults.size()); + for (int i = 0; i < kNumScanResult; i++) { + EXPECT_EQ(hw_report.results[i].rssi, aidl_data.cachedScanResults[i].rssiDbm); + EXPECT_EQ(i, aidl_data.cachedScanResults[i].frequencyMhz); + int64_t expected_ts = 10000000 - i * 1000 * 1000; + EXPECT_EQ(expected_ts, aidl_data.cachedScanResults[i].timeStampInUs); + EXPECT_EQ(WifiRatePreamble::HE, aidl_data.cachedScanResults[i].preambleType); + EXPECT_EQ(WifiChannelWidthInMhz::WIDTH_40, aidl_data.cachedScanResults[i].channelWidthMhz); + for (int k = 0; k < 6; k++) { + EXPECT_EQ(kBssid[k], aidl_data.cachedScanResults[i].bssid[k]); + } + for (int k = 0; k < kSsidLen; k++) { + EXPECT_EQ(kSsid[k], aidl_data.cachedScanResults[i].ssid[k]); + } + } +} + } // namespace wifi } // namespace hardware } // namespace android diff --git a/wifi/aidl/default/wifi.cpp b/wifi/aidl/default/wifi.cpp index 34a7f35d4d6f1fcb456601df09273ca7f8c2430f..12017b654a16bb0e3b0db72e48d8350660a1980b 100644 --- a/wifi/aidl/default/wifi.cpp +++ b/wifi/aidl/default/wifi.cpp @@ -16,15 +16,153 @@ #include "wifi.h" +#include #include +#include +#include +#include #include "aidl_return_util.h" #include "aidl_sync_util.h" #include "wifi_status_util.h" namespace { +using android::base::unique_fd; + // Starting Chip ID, will be assigned to primary chip static constexpr int32_t kPrimaryChipId = 0; +constexpr char kCpioMagic[] = "070701"; +constexpr char kTombstoneFolderPath[] = "/data/vendor/tombstones/wifi/"; + +// Helper function for |cpioArchiveFilesInDir| +bool cpioWriteHeader(int out_fd, struct stat& st, const char* file_name, size_t file_name_len) { + const int buf_size = 32 * 1024; + std::array read_buf; + ssize_t llen = snprintf( + read_buf.data(), buf_size, "%s%08X%08X%08X%08X%08X%08X%08X%08X%08X%08X%08X%08X%08X", + kCpioMagic, static_cast(st.st_ino), st.st_mode, st.st_uid, st.st_gid, + static_cast(st.st_nlink), static_cast(st.st_mtime), + static_cast(st.st_size), major(st.st_dev), minor(st.st_dev), major(st.st_rdev), + minor(st.st_rdev), static_cast(file_name_len), 0); + if (write(out_fd, read_buf.data(), llen < buf_size ? llen : buf_size - 1) == -1) { + PLOG(ERROR) << "Error writing cpio header to file " << file_name; + return false; + } + if (write(out_fd, file_name, file_name_len) == -1) { + PLOG(ERROR) << "Error writing filename to file " << file_name; + return false; + } + + // NUL Pad header up to 4 multiple bytes. + llen = (llen + file_name_len) % 4; + if (llen != 0) { + const uint32_t zero = 0; + if (write(out_fd, &zero, 4 - llen) == -1) { + PLOG(ERROR) << "Error padding 0s to file " << file_name; + return false; + } + } + return true; +} + +// Helper function for |cpioArchiveFilesInDir| +size_t cpioWriteFileContent(int fd_read, int out_fd, struct stat& st) { + // writing content of file + std::array read_buf; + ssize_t llen = st.st_size; + size_t n_error = 0; + while (llen > 0) { + ssize_t bytes_read = read(fd_read, read_buf.data(), read_buf.size()); + if (bytes_read == -1) { + PLOG(ERROR) << "Error reading file"; + return ++n_error; + } + llen -= bytes_read; + if (write(out_fd, read_buf.data(), bytes_read) == -1) { + PLOG(ERROR) << "Error writing data to file"; + return ++n_error; + } + if (bytes_read == 0) { // this should never happen, but just in case + // to unstuck from while loop + PLOG(ERROR) << "Unexpected read result"; + n_error++; + break; + } + } + llen = st.st_size % 4; + if (llen != 0) { + const uint32_t zero = 0; + if (write(out_fd, &zero, 4 - llen) == -1) { + PLOG(ERROR) << "Error padding 0s to file"; + return ++n_error; + } + } + return n_error; +} + +// Helper function for |cpioArchiveFilesInDir| +bool cpioWriteFileTrailer(int out_fd) { + const int buf_size = 4096; + std::array read_buf; + read_buf.fill(0); + ssize_t llen = snprintf(read_buf.data(), 4096, "070701%040X%056X%08XTRAILER!!!", 1, 0x0b, 0); + if (write(out_fd, read_buf.data(), (llen < buf_size ? llen : buf_size - 1) + 4) == -1) { + PLOG(ERROR) << "Error writing trailing bytes"; + return false; + } + return true; +} + +// Archives all files in |input_dir| and writes result into |out_fd| +// Logic obtained from //external/toybox/toys/posix/cpio.c "Output cpio archive" +// portion +size_t cpioArchiveFilesInDir(int out_fd, const char* input_dir) { + struct dirent* dp; + size_t n_error = 0; + std::unique_ptr dir_dump(opendir(input_dir), closedir); + if (!dir_dump) { + PLOG(ERROR) << "Failed to open directory"; + return ++n_error; + } + while ((dp = readdir(dir_dump.get()))) { + if (dp->d_type != DT_REG) { + continue; + } + std::string cur_file_name(dp->d_name); + struct stat st; + const std::string cur_file_path = kTombstoneFolderPath + cur_file_name; + if (stat(cur_file_path.c_str(), &st) == -1) { + PLOG(ERROR) << "Failed to get file stat for " << cur_file_path; + n_error++; + continue; + } + const int fd_read = open(cur_file_path.c_str(), O_RDONLY); + if (fd_read == -1) { + PLOG(ERROR) << "Failed to open file " << cur_file_path; + n_error++; + continue; + } + std::string file_name_with_last_modified_time = + cur_file_name + "-" + std::to_string(st.st_mtime); + // string.size() does not include the null terminator. The cpio FreeBSD + // file header expects the null character to be included in the length. + const size_t file_name_len = file_name_with_last_modified_time.size() + 1; + unique_fd file_auto_closer(fd_read); + if (!cpioWriteHeader(out_fd, st, file_name_with_last_modified_time.c_str(), + file_name_len)) { + return ++n_error; + } + size_t write_error = cpioWriteFileContent(fd_read, out_fd, st); + if (write_error) { + return n_error + write_error; + } + } + if (!cpioWriteFileTrailer(out_fd)) { + return ++n_error; + } + return n_error; +} + } // namespace namespace aidl { @@ -82,15 +220,18 @@ ndk::ScopedAStatus Wifi::getChip(int32_t in_chipId, std::shared_ptr* binder_status_t Wifi::dump(int fd, const char** args, uint32_t numArgs) { const auto lock = acquireGlobalLock(); LOG(INFO) << "-----------Debug was called----------------"; - if (chips_.size() == 0) { - LOG(INFO) << "No chips to display."; - return STATUS_OK; + if (chips_.size() != 0) { + for (std::shared_ptr chip : chips_) { + if (!chip.get()) continue; + chip->dump(fd, args, numArgs); + } } - - for (std::shared_ptr chip : chips_) { - if (!chip.get()) continue; - chip->dump(fd, args, numArgs); + uint32_t n_error = cpioArchiveFilesInDir(fd, kTombstoneFolderPath); + if (n_error != 0) { + LOG(ERROR) << n_error << " errors occurred in cpio function"; } + ::android::base::WriteStringToFd("\n", fd); + fsync(fd); return STATUS_OK; } diff --git a/wifi/aidl/default/wifi_chip.cpp b/wifi/aidl/default/wifi_chip.cpp index 8265e5bdc900d4d38b5f8fc53891007fba02c098..9b9c565dd5b882155d3c15d14e3ac5d69fdde13d 100644 --- a/wifi/aidl/default/wifi_chip.cpp +++ b/wifi/aidl/default/wifi_chip.cpp @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include @@ -32,13 +33,8 @@ #define P2P_MGMT_DEVICE_PREFIX "p2p-dev-" namespace { -using aidl::android::hardware::wifi::IfaceType; -using aidl::android::hardware::wifi::IWifiChip; -using CoexRestriction = aidl::android::hardware::wifi::IWifiChip::CoexRestriction; -using ChannelCategoryMask = aidl::android::hardware::wifi::IWifiChip::ChannelCategoryMask; using android::base::unique_fd; -constexpr char kCpioMagic[] = "070701"; constexpr size_t kMaxBufferSizeBytes = 1024 * 1024 * 3; constexpr uint32_t kMaxRingBufferFileAgeSeconds = 60 * 60 * 10; constexpr uint32_t kMaxRingBufferFileNum = 20; @@ -215,135 +211,6 @@ bool removeOldFilesInternal() { return success; } -// Helper function for |cpioArchiveFilesInDir| -bool cpioWriteHeader(int out_fd, struct stat& st, const char* file_name, size_t file_name_len) { - const int buf_size = 32 * 1024; - std::array read_buf; - ssize_t llen = snprintf( - read_buf.data(), buf_size, "%s%08X%08X%08X%08X%08X%08X%08X%08X%08X%08X%08X%08X%08X", - kCpioMagic, static_cast(st.st_ino), st.st_mode, st.st_uid, st.st_gid, - static_cast(st.st_nlink), static_cast(st.st_mtime), - static_cast(st.st_size), major(st.st_dev), minor(st.st_dev), major(st.st_rdev), - minor(st.st_rdev), static_cast(file_name_len), 0); - if (write(out_fd, read_buf.data(), llen < buf_size ? llen : buf_size - 1) == -1) { - PLOG(ERROR) << "Error writing cpio header to file " << file_name; - return false; - } - if (write(out_fd, file_name, file_name_len) == -1) { - PLOG(ERROR) << "Error writing filename to file " << file_name; - return false; - } - - // NUL Pad header up to 4 multiple bytes. - llen = (llen + file_name_len) % 4; - if (llen != 0) { - const uint32_t zero = 0; - if (write(out_fd, &zero, 4 - llen) == -1) { - PLOG(ERROR) << "Error padding 0s to file " << file_name; - return false; - } - } - return true; -} - -// Helper function for |cpioArchiveFilesInDir| -size_t cpioWriteFileContent(int fd_read, int out_fd, struct stat& st) { - // writing content of file - std::array read_buf; - ssize_t llen = st.st_size; - size_t n_error = 0; - while (llen > 0) { - ssize_t bytes_read = read(fd_read, read_buf.data(), read_buf.size()); - if (bytes_read == -1) { - PLOG(ERROR) << "Error reading file"; - return ++n_error; - } - llen -= bytes_read; - if (write(out_fd, read_buf.data(), bytes_read) == -1) { - PLOG(ERROR) << "Error writing data to file"; - return ++n_error; - } - if (bytes_read == 0) { // this should never happen, but just in case - // to unstuck from while loop - PLOG(ERROR) << "Unexpected read result"; - n_error++; - break; - } - } - llen = st.st_size % 4; - if (llen != 0) { - const uint32_t zero = 0; - if (write(out_fd, &zero, 4 - llen) == -1) { - PLOG(ERROR) << "Error padding 0s to file"; - return ++n_error; - } - } - return n_error; -} - -// Helper function for |cpioArchiveFilesInDir| -bool cpioWriteFileTrailer(int out_fd) { - const int buf_size = 4096; - std::array read_buf; - read_buf.fill(0); - ssize_t llen = snprintf(read_buf.data(), 4096, "070701%040X%056X%08XTRAILER!!!", 1, 0x0b, 0); - if (write(out_fd, read_buf.data(), (llen < buf_size ? llen : buf_size - 1) + 4) == -1) { - PLOG(ERROR) << "Error writing trailing bytes"; - return false; - } - return true; -} - -// Archives all files in |input_dir| and writes result into |out_fd| -// Logic obtained from //external/toybox/toys/posix/cpio.c "Output cpio archive" -// portion -size_t cpioArchiveFilesInDir(int out_fd, const char* input_dir) { - struct dirent* dp; - size_t n_error = 0; - std::unique_ptr dir_dump(opendir(input_dir), closedir); - if (!dir_dump) { - PLOG(ERROR) << "Failed to open directory"; - return ++n_error; - } - while ((dp = readdir(dir_dump.get()))) { - if (dp->d_type != DT_REG) { - continue; - } - std::string cur_file_name(dp->d_name); - struct stat st; - const std::string cur_file_path = kTombstoneFolderPath + cur_file_name; - if (stat(cur_file_path.c_str(), &st) == -1) { - PLOG(ERROR) << "Failed to get file stat for " << cur_file_path; - n_error++; - continue; - } - const int fd_read = open(cur_file_path.c_str(), O_RDONLY); - if (fd_read == -1) { - PLOG(ERROR) << "Failed to open file " << cur_file_path; - n_error++; - continue; - } - std::string file_name_with_last_modified_time = - cur_file_name + "-" + std::to_string(st.st_mtime); - // string.size() does not include the null terminator. The cpio FreeBSD - // file header expects the null character to be included in the length. - const size_t file_name_len = file_name_with_last_modified_time.size() + 1; - unique_fd file_auto_closer(fd_read); - if (!cpioWriteHeader(out_fd, st, file_name_with_last_modified_time.c_str(), - file_name_len)) { - return ++n_error; - } - size_t write_error = cpioWriteFileContent(fd_read, out_fd, st); - if (write_error) { - return n_error + write_error; - } - } - if (!cpioWriteFileTrailer(out_fd)) { - return ++n_error; - } - return n_error; -} - // Helper function to create a non-const char*. std::vector makeCharVec(const std::string& str) { std::vector vec(str.size() + 1); @@ -503,6 +370,14 @@ ndk::ScopedAStatus WifiChip::createBridgedApIface(std::shared_ptr* &WifiChip::createBridgedApIfaceInternal, _aidl_return); } +ndk::ScopedAStatus WifiChip::createApOrBridgedApIface( + IfaceConcurrencyType in_ifaceType, const std::vector& in_vendorData, + std::shared_ptr* _aidl_return) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, + &WifiChip::createApOrBridgedApIfaceInternal, _aidl_return, in_ifaceType, + in_vendorData); +} + ndk::ScopedAStatus WifiChip::getApIfaceNames(std::vector* _aidl_return) { return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, &WifiChip::getApIfaceNamesInternal, _aidl_return); @@ -651,7 +526,7 @@ ndk::ScopedAStatus WifiChip::setLatencyMode(IWifiChip::LatencyMode in_mode) { &WifiChip::setLatencyModeInternal, in_mode); } -binder_status_t WifiChip::dump(int fd, const char**, uint32_t) { +binder_status_t WifiChip::dump(int fd __unused, const char**, uint32_t) { { std::unique_lock lk(lock_t); for (const auto& item : ringbuffer_map_) { @@ -664,11 +539,6 @@ binder_status_t WifiChip::dump(int fd, const char**, uint32_t) { if (!writeRingbufferFilesInternal()) { LOG(ERROR) << "Error writing files to flash"; } - uint32_t n_error = cpioArchiveFilesInDir(fd, kTombstoneFolderPath); - if (n_error != 0) { - LOG(ERROR) << n_error << " errors occurred in cpio function"; - } - fsync(fd); return STATUS_OK; } @@ -736,6 +606,11 @@ ndk::ScopedAStatus WifiChip::setMloMode(const ChipMloMode in_mode) { &WifiChip::setMloModeInternal, in_mode); } +ndk::ScopedAStatus WifiChip::setVoipMode(const VoipMode in_mode) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, + &WifiChip::setVoipModeInternal, in_mode); +} + void WifiChip::invalidateAndRemoveAllIfaces() { invalidateAndClearBridgedApAll(); invalidateAndClearAll(ap_ifaces_); @@ -993,6 +868,18 @@ WifiChip::createBridgedApIfaceInternal() { return {iface, ndk::ScopedAStatus::ok()}; } +std::pair, ndk::ScopedAStatus> +WifiChip::createApOrBridgedApIfaceInternal( + IfaceConcurrencyType ifaceType, const std::vector& /* vendorData */) { + if (ifaceType == IfaceConcurrencyType::AP) { + return createApIfaceInternal(); + } else if (ifaceType == IfaceConcurrencyType::AP_BRIDGED) { + return createBridgedApIfaceInternal(); + } else { + return {nullptr, createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS)}; + } +} + std::pair, ndk::ScopedAStatus> WifiChip::getApIfaceNamesInternal() { if (ap_ifaces_.empty()) { return {std::vector(), ndk::ScopedAStatus::ok()}; @@ -2032,6 +1919,23 @@ ndk::ScopedAStatus WifiChip::setMloModeInternal(const WifiChip::ChipMloMode in_m return createWifiStatusFromLegacyError(legacy_hal_.lock()->setMloMode(mode)); } +ndk::ScopedAStatus WifiChip::setVoipModeInternal(const WifiChip::VoipMode in_mode) { + const auto ifname = getFirstActiveWlanIfaceName(); + wifi_voip_mode mode; + switch (in_mode) { + case WifiChip::VoipMode::VOICE: + mode = wifi_voip_mode::WIFI_VOIP_MODE_VOICE; + break; + case WifiChip::VoipMode::OFF: + mode = wifi_voip_mode::WIFI_VOIP_MODE_OFF; + break; + default: + PLOG(ERROR) << "Error: invalid mode: " << toString(in_mode); + return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS); + } + return createWifiStatusFromLegacyError(legacy_hal_.lock()->setVoipMode(ifname, mode)); +} + } // namespace wifi } // namespace hardware } // namespace android diff --git a/wifi/aidl/default/wifi_chip.h b/wifi/aidl/default/wifi_chip.h index 1a360320c9ec34fe1ea633ae4d714d98c224741b..ffd507f801370ae9921d9580388031ee4ddf258a 100644 --- a/wifi/aidl/default/wifi_chip.h +++ b/wifi/aidl/default/wifi_chip.h @@ -19,6 +19,7 @@ #include #include +#include #include #include @@ -96,6 +97,10 @@ class WifiChip : public BnWifiChip { ndk::ScopedAStatus requestFirmwareDebugDump(std::vector* _aidl_return) override; ndk::ScopedAStatus createApIface(std::shared_ptr* _aidl_return) override; ndk::ScopedAStatus createBridgedApIface(std::shared_ptr* _aidl_return) override; + ndk::ScopedAStatus createApOrBridgedApIface( + IfaceConcurrencyType in_ifaceType, + const std::vector& in_vendorData, + std::shared_ptr* _aidl_return) override; ndk::ScopedAStatus getApIfaceNames(std::vector* _aidl_return) override; ndk::ScopedAStatus getApIface(const std::string& in_ifname, std::shared_ptr* _aidl_return) override; @@ -153,6 +158,7 @@ class WifiChip : public BnWifiChip { int32_t in_channelCategoryEnableFlag) override; binder_status_t dump(int fd, const char** args, uint32_t numArgs) override; ndk::ScopedAStatus setMloMode(const ChipMloMode in_mode) override; + ndk::ScopedAStatus setVoipMode(const VoipMode in_mode) override; private: void invalidateAndRemoveAllIfaces(); @@ -176,6 +182,8 @@ class WifiChip : public BnWifiChip { ndk::ScopedAStatus createVirtualApInterface(const std::string& apVirtIf); std::pair, ndk::ScopedAStatus> createApIfaceInternal(); std::pair, ndk::ScopedAStatus> createBridgedApIfaceInternal(); + std::pair, ndk::ScopedAStatus> createApOrBridgedApIfaceInternal( + IfaceConcurrencyType ifaceType, const std::vector& vendorData); std::pair, ndk::ScopedAStatus> getApIfaceNamesInternal(); std::pair, ndk::ScopedAStatus> getApIfaceInternal( const std::string& ifname); @@ -262,6 +270,7 @@ class WifiChip : public BnWifiChip { getSupportedRadioCombinationsInternal(); std::pair getWifiChipCapabilitiesInternal(); ndk::ScopedAStatus setMloModeInternal(const ChipMloMode in_mode); + ndk::ScopedAStatus setVoipModeInternal(const VoipMode in_mode); void retrieveDynamicIfaceCombination(); void setWeakPtr(std::weak_ptr ptr); diff --git a/wifi/aidl/default/wifi_legacy_hal.cpp b/wifi/aidl/default/wifi_legacy_hal.cpp index 209670bc6984a9aa324e2c5102b16d7ff2c4e198..55d6f593143417ef2be70f1b4b692c8541486962 100644 --- a/wifi/aidl/default/wifi_legacy_hal.cpp +++ b/wifi/aidl/default/wifi_legacy_hal.cpp @@ -183,10 +183,13 @@ std::function on_rtt_results_internal_callback_v2; +std::function + on_rtt_results_internal_callback_v3; void invalidateRttResultsCallbacks() { on_rtt_results_internal_callback = nullptr; on_rtt_results_internal_callback_v2 = nullptr; + on_rtt_results_internal_callback_v3 = nullptr; }; void onAsyncRttResults(wifi_request_id id, unsigned num_results, wifi_rtt_result* rtt_results[]) { @@ -206,6 +209,15 @@ void onAsyncRttResultsV2(wifi_request_id id, unsigned num_results, } } +void onAsyncRttResultsV3(wifi_request_id id, unsigned num_results, + wifi_rtt_result_v3* rtt_results_v3[]) { + const auto lock = aidl_sync_util::acquireGlobalLock(); + if (on_rtt_results_internal_callback_v3) { + on_rtt_results_internal_callback_v3(id, num_results, rtt_results_v3); + invalidateRttResultsCallbacks(); + } +} + // Callbacks for the various NAN operations. // NOTE: These have very little conversions to perform before invoking the user // callbacks. @@ -439,11 +451,82 @@ void onAsyncChreNanRttState(chre_nan_rtt_state state) { // Callback to report cached scan results std::function on_cached_scan_results_internal_callback; void onSyncCachedScanResults(wifi_cached_scan_report* cache_report) { + const auto lock = aidl_sync_util::acquireGlobalLock(); if (on_cached_scan_results_internal_callback) { on_cached_scan_results_internal_callback(cache_report); } } +// Callback to be invoked for TWT failure +std::function + on_twt_failure_internal_callback; +void onAsyncTwtError(wifi_request_id id, wifi_twt_error_code error_code) { + const auto lock = aidl_sync_util::acquireGlobalLock(); + if (on_twt_failure_internal_callback) { + on_twt_failure_internal_callback(id, error_code); + } +} + +// Callback to be invoked for TWT session creation +std::function + on_twt_session_create_internal_callback; +void onAsyncTwtSessionCreate(wifi_request_id id, wifi_twt_session twt_session) { + const auto lock = aidl_sync_util::acquireGlobalLock(); + if (on_twt_session_create_internal_callback) { + on_twt_session_create_internal_callback(id, twt_session); + } +} + +// Callback to be invoked for TWT session update +std::function + on_twt_session_update_internal_callback; +void onAsyncTwtSessionUpdate(wifi_request_id id, wifi_twt_session twt_session) { + const auto lock = aidl_sync_util::acquireGlobalLock(); + if (on_twt_session_update_internal_callback) { + on_twt_session_update_internal_callback(id, twt_session); + } +} + +// Callback to be invoked for TWT session teardown +std::function + on_twt_session_teardown_internal_callback; +void onAsyncTwtSessionTeardown(wifi_request_id id, int twt_session_id, + wifi_twt_teardown_reason_code reason_code) { + const auto lock = aidl_sync_util::acquireGlobalLock(); + if (on_twt_session_teardown_internal_callback) { + on_twt_session_teardown_internal_callback(id, twt_session_id, reason_code); + } +} + +// Callback to be invoked for TWT session get stats +std::function + on_twt_session_stats_internal_callback; +void onAsyncTwtSessionStats(wifi_request_id id, int twt_session_id, wifi_twt_session_stats stats) { + const auto lock = aidl_sync_util::acquireGlobalLock(); + if (on_twt_session_stats_internal_callback) { + on_twt_session_stats_internal_callback(id, twt_session_id, stats); + } +} + +// Callback to be invoked for TWT session suspend +std::function on_twt_session_suspend_internal_callback; +void onAsyncTwtSessionSuspend(wifi_request_id id, int twt_session_id) { + const auto lock = aidl_sync_util::acquireGlobalLock(); + if (on_twt_session_suspend_internal_callback) { + on_twt_session_suspend_internal_callback(id, twt_session_id); + } +} + +// Callback to be invoked for TWT session resume +std::function on_twt_session_resume_internal_callback; +void onAsyncTwtSessionResume(wifi_request_id id, int twt_session_id) { + const auto lock = aidl_sync_util::acquireGlobalLock(); + if (on_twt_session_resume_internal_callback) { + on_twt_session_resume_internal_callback(id, twt_session_id); + } +} + // End of the free-standing "C" style callbacks. WifiLegacyHal::WifiLegacyHal(const std::weak_ptr<::android::wifi_system::InterfaceTool> iface_tool, @@ -1251,6 +1334,38 @@ wifi_error WifiLegacyHal::registerSubsystemRestartCallbackHandler( return status; } +wifi_error WifiLegacyHal::startRttRangeRequestV3( + const std::string& iface_name, wifi_request_id id, + const std::vector& rtt_configs, + const on_rtt_results_callback_v3& on_results_user_callback_v3) { + if (on_rtt_results_internal_callback_v3) { + return WIFI_ERROR_NOT_AVAILABLE; + } + + on_rtt_results_internal_callback_v3 = [on_results_user_callback_v3]( + wifi_request_id id, unsigned num_results, + wifi_rtt_result_v3* rtt_results_v3[]) { + if (num_results > 0 && !rtt_results_v3) { + LOG(ERROR) << "Unexpected nullptr in RTT v3 results"; + return; + } + std::vector rtt_results_vec_v3; + std::copy_if(rtt_results_v3, rtt_results_v3 + num_results, + back_inserter(rtt_results_vec_v3), + [](wifi_rtt_result_v3* rtt_result_v3) { return rtt_result_v3 != nullptr; }); + on_results_user_callback_v3(id, rtt_results_vec_v3); + }; + + std::vector rtt_configs_internal(rtt_configs); + wifi_error status = global_func_table_.wifi_rtt_range_request_v3( + id, getIfaceHandle(iface_name), rtt_configs.size(), rtt_configs_internal.data(), + {onAsyncRttResultsV3}); + if (status != WIFI_SUCCESS) { + invalidateRttResultsCallbacks(); + } + return status; +} + wifi_error WifiLegacyHal::startRttRangeRequest( const std::string& iface_name, wifi_request_id id, const std::vector& rtt_configs, @@ -1327,6 +1442,14 @@ std::pair WifiLegacyHal::getRttCapabilities( return {status, rtt_caps}; } +std::pair WifiLegacyHal::getRttCapabilitiesV3( + const std::string& iface_name) { + wifi_rtt_capabilities_v3 rtt_caps_v3; + wifi_error status = global_func_table_.wifi_get_rtt_capabilities_v3(getIfaceHandle(iface_name), + &rtt_caps_v3); + return {status, rtt_caps_v3}; +} + std::pair WifiLegacyHal::getRttResponderInfo( const std::string& iface_name) { wifi_rtt_responder rtt_responder; @@ -1736,6 +1859,103 @@ wifi_error WifiLegacyHal::setVoipMode(const std::string& iface_name, wifi_voip_m return global_func_table_.wifi_set_voip_mode(getIfaceHandle(iface_name), mode); } +std::pair WifiLegacyHal::twtGetCapabilities( + const std::string& ifaceName) { + wifi_twt_capabilities capabs = {}; + wifi_error status = + global_func_table_.wifi_twt_get_capabilities(getIfaceHandle(ifaceName), &capabs); + return {capabs, status}; +} + +wifi_error WifiLegacyHal::twtSessionSetup( + const std::string& ifaceName, uint32_t cmdId, const wifi_twt_request& request, + const on_twt_failure& on_twt_failure_user_callback, + const on_twt_session_create& on_twt_session_create_user_callback, + const on_twt_session_update& on_twt_session_update_user_callback, + const on_twt_session_teardown& on_twt_session_teardown_user_callback, + const on_twt_session_stats& on_twt_session_stats_user_callback, + const on_twt_session_suspend& on_twt_session_suspend_user_callback, + const on_twt_session_resume& on_twt_session_resume_user_callback) { + if (on_twt_failure_internal_callback || on_twt_session_create_internal_callback || + on_twt_session_update_internal_callback || on_twt_session_teardown_internal_callback || + on_twt_session_stats_internal_callback) { + return WIFI_ERROR_NOT_AVAILABLE; + } + + on_twt_failure_internal_callback = [on_twt_failure_user_callback]( + wifi_request_id id, wifi_twt_error_code error_code) { + on_twt_failure_user_callback(id, error_code); + }; + + on_twt_session_create_internal_callback = [on_twt_session_create_user_callback]( + wifi_request_id id, + wifi_twt_session twt_session) { + on_twt_session_create_user_callback(id, twt_session); + }; + + on_twt_session_update_internal_callback = [on_twt_session_update_user_callback]( + wifi_request_id id, + wifi_twt_session twt_session) { + on_twt_session_update_user_callback(id, twt_session); + }; + + on_twt_session_teardown_internal_callback = [on_twt_session_teardown_user_callback]( + wifi_request_id id, int session_id, + wifi_twt_teardown_reason_code reason_code) { + on_twt_session_teardown_user_callback(id, session_id, reason_code); + }; + + on_twt_session_stats_internal_callback = [on_twt_session_stats_user_callback]( + wifi_request_id id, int session_id, + wifi_twt_session_stats stats) { + on_twt_session_stats_user_callback(id, session_id, stats); + }; + + on_twt_session_suspend_internal_callback = [on_twt_session_suspend_user_callback]( + wifi_request_id id, int session_id) { + on_twt_session_suspend_user_callback(id, session_id); + }; + + on_twt_session_resume_internal_callback = [on_twt_session_resume_user_callback]( + wifi_request_id id, int session_id) { + on_twt_session_resume_user_callback(id, session_id); + }; + + return global_func_table_.wifi_twt_session_setup( + cmdId, getIfaceHandle(ifaceName), request, + {onAsyncTwtError, onAsyncTwtSessionCreate, onAsyncTwtSessionUpdate, + onAsyncTwtSessionTeardown, onAsyncTwtSessionStats, onAsyncTwtSessionSuspend, + onAsyncTwtSessionResume}); +} + +wifi_error WifiLegacyHal::twtSessionUpdate(const std::string& ifaceName, uint32_t cmdId, + uint32_t sessionId, const wifi_twt_request& request) { + return global_func_table_.wifi_twt_session_update(cmdId, getIfaceHandle(ifaceName), sessionId, + request); +} + +wifi_error WifiLegacyHal::twtSessionSuspend(const std::string& ifaceName, uint32_t cmdId, + uint32_t sessionId) { + return global_func_table_.wifi_twt_session_suspend(cmdId, getIfaceHandle(ifaceName), sessionId); +} + +wifi_error WifiLegacyHal::twtSessionResume(const std::string& ifaceName, uint32_t cmdId, + uint32_t sessionId) { + return global_func_table_.wifi_twt_session_resume(cmdId, getIfaceHandle(ifaceName), sessionId); +} + +wifi_error WifiLegacyHal::twtSessionTeardown(const std::string& ifaceName, uint32_t cmdId, + uint32_t sessionId) { + return global_func_table_.wifi_twt_session_teardown(cmdId, getIfaceHandle(ifaceName), + sessionId); +} + +wifi_error WifiLegacyHal::twtSessionGetStats(const std::string& ifaceName, uint32_t cmdId, + uint32_t sessionId) { + return global_func_table_.wifi_twt_session_get_stats(cmdId, getIfaceHandle(ifaceName), + sessionId); +} + wifi_error WifiLegacyHal::twtRegisterHandler(const std::string& iface_name, const TwtCallbackHandlers& user_callbacks) { on_twt_event_setup_response_callback = user_callbacks.on_setup_response; @@ -1858,13 +2078,16 @@ wifi_error WifiLegacyHal::enableWifiTxPowerLimits(const std::string& iface_name, return global_func_table_.wifi_enable_tx_power_limits(getIfaceHandle(iface_name), enable); } -wifi_error WifiLegacyHal::getWifiCachedScanResults( - const std::string& iface_name, const CachedScanResultsCallbackHandlers& handler) { - on_cached_scan_results_internal_callback = handler.on_cached_scan_results; - +wifi_error WifiLegacyHal::getWifiCachedScanResults(const std::string& iface_name, + WifiCachedScanReport& report) { + on_cached_scan_results_internal_callback = [&report](wifi_cached_scan_report* report_ptr) { + report.results.assign(report_ptr->results, report_ptr->results + report_ptr->result_cnt); + report.scanned_freqs.assign(report_ptr->scanned_freq_list, + report_ptr->scanned_freq_list + report_ptr->scanned_freq_num); + report.ts = report_ptr->ts; + }; wifi_error status = global_func_table_.wifi_get_cached_scan_results(getIfaceHandle(iface_name), {onSyncCachedScanResults}); - on_cached_scan_results_internal_callback = nullptr; return status; } @@ -1934,6 +2157,7 @@ void WifiLegacyHal::invalidate() { on_twt_event_info_frame_received_callback = nullptr; on_twt_event_device_notify_callback = nullptr; on_chre_nan_rtt_internal_callback = nullptr; + on_cached_scan_results_internal_callback = nullptr; } } // namespace legacy_hal diff --git a/wifi/aidl/default/wifi_legacy_hal.h b/wifi/aidl/default/wifi_legacy_hal.h index 5168a8bccf43bf0d9548c3fa1b6786d279db0566..121d1b5ed89f8c12fd3055ab0bd36c44b4ee0cfc 100644 --- a/wifi/aidl/default/wifi_legacy_hal.h +++ b/wifi/aidl/default/wifi_legacy_hal.h @@ -186,6 +186,7 @@ using ::NanTransmitFollowupRequest; using ::NanTxType; using ::NpkSecurityAssociation; using ::PASN; +using ::ROAMING_AGGRESSIVE; using ::ROAMING_DISABLE; using ::ROAMING_ENABLE; using ::RTT_PEER_AP; @@ -214,6 +215,8 @@ using ::RTT_STATUS_NO_WIFI; using ::RTT_STATUS_SUCCESS; using ::RTT_TYPE_1_SIDED; using ::RTT_TYPE_2_SIDED; +using ::RTT_TYPE_2_SIDED_11AZ_NTB; +using ::RTT_TYPE_2_SIDED_11MC; using ::RX_PKT_FATE_DRV_DROP_FILTER; using ::RX_PKT_FATE_DRV_DROP_INVALID; using ::RX_PKT_FATE_DRV_DROP_NOBUFS; @@ -256,6 +259,7 @@ using ::WIFI_BAND_ABG_WITH_DFS; using ::WIFI_BAND_BG; using ::WIFI_BAND_UNSPECIFIED; using ::wifi_cached_scan_report; +using ::wifi_cached_scan_result; using ::wifi_cached_scan_results; using ::WIFI_CHAN_WIDTH_10; using ::WIFI_CHAN_WIDTH_160; @@ -349,16 +353,20 @@ using ::WIFI_RTT_BW_5; using ::WIFI_RTT_BW_80; using ::WIFI_RTT_BW_UNSPECIFIED; using ::wifi_rtt_capabilities; +using ::wifi_rtt_capabilities_v3; using ::wifi_rtt_config; +using ::wifi_rtt_config_v3; using ::wifi_rtt_preamble; using ::WIFI_RTT_PREAMBLE_EHT; using ::WIFI_RTT_PREAMBLE_HE; using ::WIFI_RTT_PREAMBLE_HT; +using ::WIFI_RTT_PREAMBLE_INVALID; using ::WIFI_RTT_PREAMBLE_LEGACY; using ::WIFI_RTT_PREAMBLE_VHT; using ::wifi_rtt_responder; using ::wifi_rtt_result; using ::wifi_rtt_result_v2; +using ::wifi_rtt_result_v3; using ::wifi_rtt_status; using ::wifi_rtt_type; using ::wifi_rx_packet_fate; @@ -368,6 +376,13 @@ using ::wifi_scan_cmd_params; using ::WIFI_SCAN_FLAG_INTERRUPTED; using ::wifi_scan_result; using ::WIFI_SUCCESS; +using ::wifi_twt_capabilities; +using ::wifi_twt_error_code; +using ::wifi_twt_events; +using ::wifi_twt_request; +using ::wifi_twt_session; +using ::wifi_twt_session_stats; +using ::wifi_twt_teardown_reason_code; using ::wifi_tx_packet_fate; using ::wifi_tx_report; using ::wifi_usable_channel; @@ -422,6 +437,12 @@ struct LinkLayerMlStats { bool valid; }; +struct WifiCachedScanReport { + uint64_t ts; + std::vector scanned_freqs; + std::vector results; +}; + #pragma GCC diagnostic pop // The |WLAN_DRIVER_WAKE_REASON_CNT.cmd_event_wake_cnt| and @@ -485,6 +506,8 @@ using on_rtt_results_callback = std::function&)>; using on_rtt_results_callback_v2 = std::function&)>; +using on_rtt_results_callback_v3 = + std::function&)>; // Callback for ring buffer data. using on_ring_buffer_data_callback = std::function on_wifi_chre_nan_rtt_state; }; -// Cached Scan Results response and event callbacks struct. -struct CachedScanResultsCallbackHandlers { +using on_cached_scan_results_callback = std::function; + +struct CachedScanResultsCallbfackHandlers { // Callback for Cached Scan Results std::function on_cached_scan_results; }; +using on_twt_failure = std::function; +using on_twt_session_create = std::function; +using on_twt_session_update = std::function; +using on_twt_session_teardown = std::function; +using on_twt_session_stats = + std::function; +using on_twt_session_suspend = std::function; +using on_twt_session_resume = std::function; + /** * Class that encapsulates all legacy HAL interactions. * This class manages the lifetime of the event loop thread used by legacy HAL. @@ -659,9 +693,15 @@ class WifiLegacyHal { const std::vector& rtt_configs, const on_rtt_results_callback& on_results_callback, const on_rtt_results_callback_v2& on_results_callback_v2); + wifi_error startRttRangeRequestV3(const std::string& iface_name, wifi_request_id id, + const std::vector& rtt_configs, + const on_rtt_results_callback_v3& on_results_callback); + wifi_error cancelRttRangeRequest(const std::string& iface_name, wifi_request_id id, const std::vector>& mac_addrs); std::pair getRttCapabilities(const std::string& iface_name); + std::pair getRttCapabilitiesV3( + const std::string& iface_name); std::pair getRttResponderInfo(const std::string& iface_name); wifi_error enableRttResponder(const std::string& iface_name, wifi_request_id id, const wifi_channel_info& channel_hint, uint32_t max_duration_secs, @@ -738,19 +778,39 @@ class WifiLegacyHal { wifi_error setVoipMode(const std::string& iface_name, wifi_voip_mode mode); + // TWT functions + std::pair twtGetCapabilities(const std::string& ifaceName); + wifi_error twtSessionSetup(const std::string& ifaceName, uint32_t cmdId, + const wifi_twt_request& request, + const on_twt_failure& on_twt_failure_user_callback, + const on_twt_session_create& on_twt_session_create_user_callback, + const on_twt_session_update& on_twt_session_update_user_callback, + const on_twt_session_teardown& on_twt_session_teardown_user_callback, + const on_twt_session_stats& on_twt_session_stats_user_callback, + const on_twt_session_suspend& on_twt_session_suspend_user_callback, + const on_twt_session_resume& on_twt_session_resume_user_callback); + wifi_error twtSessionUpdate(const std::string& ifaceName, uint32_t cmdId, uint32_t sessionId, + const wifi_twt_request& request); + wifi_error twtSessionSuspend(const std::string& ifaceName, uint32_t cmdId, uint32_t sessionId); + wifi_error twtSessionResume(const std::string& ifaceName, uint32_t cmdId, uint32_t sessionId); + wifi_error twtSessionTeardown(const std::string& ifaceName, uint32_t cmdId, uint32_t sessionId); + wifi_error twtSessionGetStats(const std::string& ifaceName, uint32_t cmdId, uint32_t sessionId); + + // Note: Following TWT functions are deprecated + // Deprecated wifi_error twtRegisterHandler(const std::string& iface_name, const TwtCallbackHandlers& handler); - + // Deprecated by twtGetCapabilities std::pair twtGetCapability(const std::string& iface_name); - + // Deprecated by twtSessionSetup wifi_error twtSetupRequest(const std::string& iface_name, const TwtSetupRequest& msg); - + // Deprecated by twtSessionTeardown wifi_error twtTearDownRequest(const std::string& iface_name, const TwtTeardownRequest& msg); - + // Deprecated by twtSessionSuspend and twtSessionResume wifi_error twtInfoFrameRequest(const std::string& iface_name, const TwtInfoFrameRequest& msg); - + // Deprecated by twtSessionGetStats std::pair twtGetStats(const std::string& iface_name, uint8_t configId); - + // Deprecated wifi_error twtClearStats(const std::string& iface_name, uint8_t configId); wifi_error setScanMode(const std::string& iface_name, bool enable); @@ -776,7 +836,7 @@ class WifiLegacyHal { wifi_error enableWifiTxPowerLimits(const std::string& iface_name, bool enable); wifi_error getWifiCachedScanResults(const std::string& iface_name, - const CachedScanResultsCallbackHandlers& handler); + WifiCachedScanReport& report); std::pair getWifiChipCapabilities(); wifi_error enableStaChannelForPeerNetwork(uint32_t channelCategoryEnableFlag); wifi_error setMloMode(wifi_mlo_mode mode); diff --git a/wifi/aidl/default/wifi_legacy_hal_stubs.cpp b/wifi/aidl/default/wifi_legacy_hal_stubs.cpp index b5196c9af628d993e2972109dc92660e16e800df..3e4afd042765c1c6f8268d0e1725bebb3d0871d0 100644 --- a/wifi/aidl/default/wifi_legacy_hal_stubs.cpp +++ b/wifi/aidl/default/wifi_legacy_hal_stubs.cpp @@ -179,6 +179,15 @@ bool initHalFuncTableWithStubs(wifi_hal_fn* hal_fn) { populateStubFor(&hal_fn->wifi_set_scan_mode); populateStubFor(&hal_fn->wifi_set_mlo_mode); populateStubFor(&hal_fn->wifi_get_supported_iface_concurrency_matrix); + populateStubFor(&hal_fn->wifi_get_rtt_capabilities_v3); + populateStubFor(&hal_fn->wifi_rtt_range_request_v3); + populateStubFor(&hal_fn->wifi_twt_get_capabilities); + populateStubFor(&hal_fn->wifi_twt_session_setup); + populateStubFor(&hal_fn->wifi_twt_session_update); + populateStubFor(&hal_fn->wifi_twt_session_suspend); + populateStubFor(&hal_fn->wifi_twt_session_resume); + populateStubFor(&hal_fn->wifi_twt_session_teardown); + populateStubFor(&hal_fn->wifi_twt_session_get_stats); return true; } diff --git a/wifi/aidl/default/wifi_rtt_controller.cpp b/wifi/aidl/default/wifi_rtt_controller.cpp index a5f67689518b373920acb47278c0ac53687ce4d5..9dee45ca4a7c81731310682b60acc498b633de7a 100644 --- a/wifi/aidl/default/wifi_rtt_controller.cpp +++ b/wifi/aidl/default/wifi_rtt_controller.cpp @@ -136,11 +136,45 @@ ndk::ScopedAStatus WifiRttController::registerEventCallbackInternal( ndk::ScopedAStatus WifiRttController::rangeRequestInternal( int32_t cmd_id, const std::vector& rtt_configs) { + // Try 11mc & 11az ranging (v3) + std::vector legacy_configs_v3; + if (!aidl_struct_util::convertAidlVectorOfRttConfigToLegacyV3(rtt_configs, + &legacy_configs_v3)) { + return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS); + } + std::weak_ptr weak_ptr_this = weak_ptr_this_; + const auto& on_results_callback_v3 = + [weak_ptr_this](legacy_hal::wifi_request_id id, + const std::vector& results) { + const auto shared_ptr_this = weak_ptr_this.lock(); + if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { + LOG(ERROR) << "v3 Callback invoked on an invalid object"; + return; + } + std::vector aidl_results; + if (!aidl_struct_util::convertLegacyVectorOfRttResultV3ToAidl(results, + &aidl_results)) { + LOG(ERROR) << "Failed to convert rtt results v3 to AIDL structs"; + return; + } + for (const auto& callback : shared_ptr_this->getEventCallbacks()) { + if (!callback->onResults(id, aidl_results).isOk()) { + LOG(ERROR) << "Failed to invoke the v3 callback"; + } + } + }; + legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->startRttRangeRequestV3( + ifname_, cmd_id, legacy_configs_v3, on_results_callback_v3); + + if (legacy_status != legacy_hal::WIFI_ERROR_NOT_SUPPORTED) { + return createWifiStatusFromLegacyError(legacy_status); + } + + // Fallback to 11mc ranging. std::vector legacy_configs; if (!aidl_struct_util::convertAidlVectorOfRttConfigToLegacy(rtt_configs, &legacy_configs)) { return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS); } - std::weak_ptr weak_ptr_this = weak_ptr_this_; const auto& on_results_callback = [weak_ptr_this](legacy_hal::wifi_request_id id, const std::vector& results) { @@ -181,7 +215,7 @@ ndk::ScopedAStatus WifiRttController::rangeRequestInternal( } } }; - legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->startRttRangeRequest( + legacy_status = legacy_hal_.lock()->startRttRangeRequest( ifname_, cmd_id, legacy_configs, on_results_callback, on_results_callback_v2); return createWifiStatusFromLegacyError(legacy_status); } @@ -201,13 +235,29 @@ ndk::ScopedAStatus WifiRttController::rangeCancelInternal(int32_t cmd_id, std::pair WifiRttController::getCapabilitiesInternal() { legacy_hal::wifi_error legacy_status; - legacy_hal::wifi_rtt_capabilities legacy_caps; - std::tie(legacy_status, legacy_caps) = legacy_hal_.lock()->getRttCapabilities(ifname_); + legacy_hal::wifi_rtt_capabilities_v3 legacy_caps_v3; + std::tie(legacy_status, legacy_caps_v3) = legacy_hal_.lock()->getRttCapabilitiesV3(ifname_); + // Try v3 API first, if it is not supported fallback. + if (legacy_status == legacy_hal::WIFI_ERROR_NOT_SUPPORTED) { + legacy_hal::wifi_rtt_capabilities legacy_caps; + std::tie(legacy_status, legacy_caps) = legacy_hal_.lock()->getRttCapabilities(ifname_); + if (legacy_status != legacy_hal::WIFI_SUCCESS) { + return {RttCapabilities{}, createWifiStatusFromLegacyError(legacy_status)}; + } + + RttCapabilities aidl_caps; + if (!aidl_struct_util::convertLegacyRttCapabilitiesToAidl(legacy_caps, &aidl_caps)) { + return {RttCapabilities{}, createWifiStatus(WifiStatusCode::ERROR_UNKNOWN)}; + } + return {aidl_caps, ndk::ScopedAStatus::ok()}; + } + if (legacy_status != legacy_hal::WIFI_SUCCESS) { return {RttCapabilities{}, createWifiStatusFromLegacyError(legacy_status)}; } + RttCapabilities aidl_caps; - if (!aidl_struct_util::convertLegacyRttCapabilitiesToAidl(legacy_caps, &aidl_caps)) { + if (!aidl_struct_util::convertLegacyRttCapabilitiesV3ToAidl(legacy_caps_v3, &aidl_caps)) { return {RttCapabilities{}, createWifiStatus(WifiStatusCode::ERROR_UNKNOWN)}; } return {aidl_caps, ndk::ScopedAStatus::ok()}; diff --git a/wifi/aidl/default/wifi_sta_iface.cpp b/wifi/aidl/default/wifi_sta_iface.cpp index 800813f1667d5f12818195bd410f15a6ffe9132c..f0509dc19eb76e9e6c462396d06c10a529b2fbe4 100644 --- a/wifi/aidl/default/wifi_sta_iface.cpp +++ b/wifi/aidl/default/wifi_sta_iface.cpp @@ -219,6 +219,49 @@ ndk::ScopedAStatus WifiStaIface::setDtimMultiplier(int32_t in_multiplier) { &WifiStaIface::setDtimMultiplierInternal, in_multiplier); } +ndk::ScopedAStatus WifiStaIface::getCachedScanData(CachedScanData* _aidl_return) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiStaIface::getCachedScanDataInternal, _aidl_return); +} + +ndk::ScopedAStatus WifiStaIface::twtGetCapabilities(TwtCapabilities* _aidl_return) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiStaIface::twtGetCapabilitiesInternal, _aidl_return); +} + +ndk::ScopedAStatus WifiStaIface::twtSessionSetup(int32_t in_cmdId, + const TwtRequest& in_twtRequest) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiStaIface::twtSessionSetupInternal, in_cmdId, in_twtRequest); +} + +ndk::ScopedAStatus WifiStaIface::twtSessionUpdate(int32_t in_cmdId, int32_t in_sessionId, + const TwtRequest& in_twtRequest) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiStaIface::twtSessionUpdateInternal, in_cmdId, in_sessionId, + in_twtRequest); +} + +ndk::ScopedAStatus WifiStaIface::twtSessionSuspend(int32_t in_cmdId, int32_t in_sessionId) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiStaIface::twtSessionSuspendInternal, in_cmdId, in_sessionId); +} + +ndk::ScopedAStatus WifiStaIface::twtSessionResume(int32_t in_cmdId, int32_t in_sessionId) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiStaIface::twtSessionResumeInternal, in_cmdId, in_sessionId); +} + +ndk::ScopedAStatus WifiStaIface::twtSessionTeardown(int32_t in_cmdId, int32_t in_sessionId) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiStaIface::twtSessionTeardownInternal, in_cmdId, in_sessionId); +} + +ndk::ScopedAStatus WifiStaIface::twtSessionGetStats(int32_t in_cmdId, int32_t in_sessionId) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiStaIface::twtSessionGetStatsInternal, in_cmdId, in_sessionId); +} + std::pair WifiStaIface::getNameInternal() { return {ifname_, ndk::ScopedAStatus::ok()}; } @@ -540,6 +583,209 @@ ndk::ScopedAStatus WifiStaIface::setDtimMultiplierInternal(const int multiplier) return createWifiStatusFromLegacyError(legacy_status); } +std::pair WifiStaIface::getCachedScanDataInternal() { + legacy_hal::WifiCachedScanReport cached_scan_report; + legacy_hal::wifi_error legacy_status = + legacy_hal_.lock()->getWifiCachedScanResults(ifname_, cached_scan_report); + if (legacy_status != legacy_hal::WIFI_SUCCESS) { + return {CachedScanData{}, createWifiStatusFromLegacyError(legacy_status)}; + } + CachedScanData aidl_scan_data; + if (!aidl_struct_util::convertCachedScanReportToAidl(cached_scan_report, &aidl_scan_data)) { + return {CachedScanData{}, createWifiStatus(WifiStatusCode::ERROR_UNKNOWN)}; + } + + return {aidl_scan_data, ndk::ScopedAStatus::ok()}; +} + +std::pair WifiStaIface::twtGetCapabilitiesInternal() { + legacy_hal::wifi_twt_capabilities legacyHaltwtCapabilities; + legacy_hal::wifi_error legacy_status; + std::tie(legacyHaltwtCapabilities, legacy_status) = + legacy_hal_.lock()->twtGetCapabilities(ifname_); + if (legacy_status != legacy_hal::WIFI_SUCCESS) { + return {TwtCapabilities{}, createWifiStatusFromLegacyError(legacy_status)}; + } + TwtCapabilities aidlTwtCapabilities; + if (!aidl_struct_util::convertTwtCapabilitiesToAidl(legacyHaltwtCapabilities, + &aidlTwtCapabilities)) { + return {TwtCapabilities{}, createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS)}; + } + return {aidlTwtCapabilities, ndk::ScopedAStatus::ok()}; +} + +ndk::ScopedAStatus WifiStaIface::twtSessionSetupInternal(int32_t cmdId, + const TwtRequest& aidlTwtRequest) { + legacy_hal::wifi_twt_request legacyHalTwtRequest; + if (!aidl_struct_util::convertAidlTwtRequestToLegacy(aidlTwtRequest, &legacyHalTwtRequest)) { + return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS); + } + std::weak_ptr weak_ptr_this = weak_ptr_this_; + + // onTwtFailure callback + const auto& on_twt_failure = [weak_ptr_this](legacy_hal::wifi_request_id id, + legacy_hal::wifi_twt_error_code error_code) { + const auto shared_ptr_this = weak_ptr_this.lock(); + IWifiStaIfaceEventCallback::TwtErrorCode aidl_error_code = + aidl_struct_util::convertLegacyHalTwtErrorCodeToAidl(error_code); + if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { + LOG(ERROR) << "Callback invoked on an invalid object"; + return; + } + for (const auto& callback : shared_ptr_this->getEventCallbacks()) { + if (!callback->onTwtFailure(id, aidl_error_code).isOk()) { + LOG(ERROR) << "Failed to invoke onTwtFailure callback"; + } + } + }; + // onTwtSessionCreate callback + const auto& on_twt_session_create = [weak_ptr_this](legacy_hal::wifi_request_id id, + legacy_hal::wifi_twt_session twt_session) { + const auto shared_ptr_this = weak_ptr_this.lock(); + TwtSession aidl_twt_session; + if (!aidl_struct_util::convertLegacyHalTwtSessionToAidl(twt_session, &aidl_twt_session)) { + LOG(ERROR) << "convertLegacyHalTwtSessionToAidl failed"; + return; + } + + if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { + LOG(ERROR) << "Callback invoked on an invalid object"; + return; + } + for (const auto& callback : shared_ptr_this->getEventCallbacks()) { + if (!callback->onTwtSessionCreate(id, aidl_twt_session).isOk()) { + LOG(ERROR) << "Failed to invoke onTwtSessionCreate callback"; + } + } + }; + // onTwtSessionUpdate callback + const auto& on_twt_session_update = [weak_ptr_this](legacy_hal::wifi_request_id id, + legacy_hal::wifi_twt_session twt_session) { + const auto shared_ptr_this = weak_ptr_this.lock(); + TwtSession aidl_twt_session; + if (!aidl_struct_util::convertLegacyHalTwtSessionToAidl(twt_session, &aidl_twt_session)) { + LOG(ERROR) << "convertLegacyHalTwtSessionToAidl failed"; + return; + } + + if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { + LOG(ERROR) << "Callback invoked on an invalid object"; + return; + } + for (const auto& callback : shared_ptr_this->getEventCallbacks()) { + if (!callback->onTwtSessionUpdate(id, aidl_twt_session).isOk()) { + LOG(ERROR) << "Failed to invoke onTwtSessionUpdate callback"; + } + } + }; + // onTwtSessionTeardown callback + const auto& on_twt_session_teardown = + [weak_ptr_this](legacy_hal::wifi_request_id id, int session_id, + legacy_hal::wifi_twt_teardown_reason_code reason_code) { + const auto shared_ptr_this = weak_ptr_this.lock(); + IWifiStaIfaceEventCallback::TwtTeardownReasonCode aidl_reason_code = + aidl_struct_util::convertLegacyHalTwtReasonCodeToAidl(reason_code); + if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { + LOG(ERROR) << "Callback invoked on an invalid object"; + return; + } + for (const auto& callback : shared_ptr_this->getEventCallbacks()) { + if (!callback->onTwtSessionTeardown(id, session_id, aidl_reason_code).isOk()) { + LOG(ERROR) << "Failed to invoke onTwtSessionTeardown callback"; + } + } + }; + // onTwtSessionStats callback + const auto& on_twt_session_stats = [weak_ptr_this](legacy_hal::wifi_request_id id, + int session_id, + legacy_hal::wifi_twt_session_stats stats) { + const auto shared_ptr_this = weak_ptr_this.lock(); + TwtSessionStats aidl_session_stats; + if (!aidl_struct_util::convertLegacyHalTwtSessionStatsToAidl(stats, &aidl_session_stats)) { + LOG(ERROR) << "convertLegacyHalTwtSessionStatsToAidl failed"; + return; + } + if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { + LOG(ERROR) << "Callback invoked on an invalid object"; + return; + } + for (const auto& callback : shared_ptr_this->getEventCallbacks()) { + if (!callback->onTwtSessionStats(id, session_id, aidl_session_stats).isOk()) { + LOG(ERROR) << "Failed to invoke onTwtSessionStats callback"; + } + } + }; + // onTwtSessionSuspend callback + const auto& on_twt_session_suspend = [weak_ptr_this](legacy_hal::wifi_request_id id, + int session_id) { + const auto shared_ptr_this = weak_ptr_this.lock(); + if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { + LOG(ERROR) << "Callback invoked on an invalid object"; + return; + } + for (const auto& callback : shared_ptr_this->getEventCallbacks()) { + if (!callback->onTwtSessionSuspend(id, session_id).isOk()) { + LOG(ERROR) << "Failed to invoke onTwtSessionSuspend callback"; + } + } + }; + // onTwtSessionResume callback + const auto& on_twt_session_resume = [weak_ptr_this](legacy_hal::wifi_request_id id, + int session_id) { + const auto shared_ptr_this = weak_ptr_this.lock(); + if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { + LOG(ERROR) << "Callback invoked on an invalid object"; + return; + } + for (const auto& callback : shared_ptr_this->getEventCallbacks()) { + if (!callback->onTwtSessionResume(id, session_id).isOk()) { + LOG(ERROR) << "Failed to invoke onTwtSessionResume callback"; + } + } + }; + + legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->twtSessionSetup( + ifname_, cmdId, legacyHalTwtRequest, on_twt_failure, on_twt_session_create, + on_twt_session_update, on_twt_session_teardown, on_twt_session_stats, + on_twt_session_suspend, on_twt_session_resume); + return createWifiStatusFromLegacyError(legacy_status); +} + +ndk::ScopedAStatus WifiStaIface::twtSessionUpdateInternal(int32_t cmdId, int32_t sessionId, + const TwtRequest& aidlTwtRequest) { + legacy_hal::wifi_twt_request legacyHalTwtRequest; + if (!aidl_struct_util::convertAidlTwtRequestToLegacy(aidlTwtRequest, &legacyHalTwtRequest)) { + return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS); + } + legacy_hal::wifi_error legacy_status = + legacy_hal_.lock()->twtSessionUpdate(ifname_, cmdId, sessionId, legacyHalTwtRequest); + return createWifiStatusFromLegacyError(legacy_status); +} + +ndk::ScopedAStatus WifiStaIface::twtSessionSuspendInternal(int32_t cmdId, int32_t sessionId) { + legacy_hal::wifi_error legacy_status = + legacy_hal_.lock()->twtSessionSuspend(ifname_, cmdId, sessionId); + return createWifiStatusFromLegacyError(legacy_status); +} + +ndk::ScopedAStatus WifiStaIface::twtSessionResumeInternal(int32_t cmdId, int32_t sessionId) { + legacy_hal::wifi_error legacy_status = + legacy_hal_.lock()->twtSessionResume(ifname_, cmdId, sessionId); + return createWifiStatusFromLegacyError(legacy_status); +} + +ndk::ScopedAStatus WifiStaIface::twtSessionTeardownInternal(int32_t cmdId, int32_t sessionId) { + legacy_hal::wifi_error legacy_status = + legacy_hal_.lock()->twtSessionTeardown(ifname_, cmdId, sessionId); + return createWifiStatusFromLegacyError(legacy_status); +} + +ndk::ScopedAStatus WifiStaIface::twtSessionGetStatsInternal(int32_t cmdId, int32_t sessionId) { + legacy_hal::wifi_error legacy_status = + legacy_hal_.lock()->twtSessionGetStats(ifname_, cmdId, sessionId); + return createWifiStatusFromLegacyError(legacy_status); +} + } // namespace wifi } // namespace hardware } // namespace android diff --git a/wifi/aidl/default/wifi_sta_iface.h b/wifi/aidl/default/wifi_sta_iface.h index 3d7ec4d4b2531dc66d5b163c1be4d2d8e2e97b90..eb8f745475b9e3eb605db5dba0d87bf80f16bf60 100644 --- a/wifi/aidl/default/wifi_sta_iface.h +++ b/wifi/aidl/default/wifi_sta_iface.h @@ -90,6 +90,15 @@ class WifiStaIface : public BnWifiStaIface { ndk::ScopedAStatus getFactoryMacAddress(std::array* _aidl_return) override; ndk::ScopedAStatus setScanMode(bool in_enable) override; ndk::ScopedAStatus setDtimMultiplier(int32_t in_multiplier) override; + ndk::ScopedAStatus getCachedScanData(CachedScanData* _aidl_return) override; + ndk::ScopedAStatus twtGetCapabilities(TwtCapabilities* _aidl_return) override; + ndk::ScopedAStatus twtSessionSetup(int in_cmdId, const TwtRequest& in_twtRequest) override; + ndk::ScopedAStatus twtSessionUpdate(int in_cmdId, int32_t in_sessionId, + const TwtRequest& in_twtRequest) override; + ndk::ScopedAStatus twtSessionSuspend(int in_cmdId, int32_t in_sessionId) override; + ndk::ScopedAStatus twtSessionResume(int in_cmdId, int32_t in_sessionId) override; + ndk::ScopedAStatus twtSessionTeardown(int in_cmdId, int32_t in_sessionId) override; + ndk::ScopedAStatus twtSessionGetStats(int in_cmdId, int32_t in_sessionId) override; private: // Corresponding worker functions for the AIDL methods. @@ -130,6 +139,15 @@ class WifiStaIface : public BnWifiStaIface { std::pair, ndk::ScopedAStatus> getFactoryMacAddressInternal(); ndk::ScopedAStatus setScanModeInternal(bool enable); ndk::ScopedAStatus setDtimMultiplierInternal(const int multiplier); + std::pair getCachedScanDataInternal(); + std::pair twtGetCapabilitiesInternal(); + ndk::ScopedAStatus twtSessionSetupInternal(int cmdId, const TwtRequest& twtRequest); + ndk::ScopedAStatus twtSessionUpdateInternal(int cmdId, int32_t sessionId, + const TwtRequest& twtRequest); + ndk::ScopedAStatus twtSessionSuspendInternal(int cmdId, int32_t sessionId); + ndk::ScopedAStatus twtSessionResumeInternal(int cmdId, int32_t sessionId); + ndk::ScopedAStatus twtSessionTeardownInternal(int cmdId, int32_t sessionId); + ndk::ScopedAStatus twtSessionGetStatsInternal(int cmdId, int32_t sessionId); void setWeakPtr(std::weak_ptr ptr); diff --git a/wifi/aidl/vts/functional/Android.bp b/wifi/aidl/vts/functional/Android.bp index 1277182493513c5e4b12638375367cf5d1e28c69..6896110610bbca242b1b0c081bbe33b975842285 100644 --- a/wifi/aidl/vts/functional/Android.bp +++ b/wifi/aidl/vts/functional/Android.bp @@ -39,7 +39,8 @@ cc_test { ], static_libs: [ "VtsHalWifiTargetTestUtil", - "android.hardware.wifi-V1-ndk", + "android.hardware.wifi.common-V1-ndk", + "android.hardware.wifi-V2-ndk", "libwifi-system-iface", ], test_suites: [ @@ -64,7 +65,8 @@ cc_test { ], static_libs: [ "VtsHalWifiTargetTestUtil", - "android.hardware.wifi-V1-ndk", + "android.hardware.wifi.common-V1-ndk", + "android.hardware.wifi-V2-ndk", "libwifi-system-iface", ], test_suites: [ @@ -89,7 +91,8 @@ cc_test { ], static_libs: [ "VtsHalWifiTargetTestUtil", - "android.hardware.wifi-V1-ndk", + "android.hardware.wifi.common-V1-ndk", + "android.hardware.wifi-V2-ndk", "libwifi-system-iface", ], test_suites: [ @@ -114,7 +117,8 @@ cc_test { ], static_libs: [ "VtsHalWifiTargetTestUtil", - "android.hardware.wifi-V1-ndk", + "android.hardware.wifi.common-V1-ndk", + "android.hardware.wifi-V2-ndk", "libwifi-system-iface", ], test_suites: [ @@ -139,7 +143,8 @@ cc_test { ], static_libs: [ "VtsHalWifiTargetTestUtil", - "android.hardware.wifi-V1-ndk", + "android.hardware.wifi.common-V1-ndk", + "android.hardware.wifi-V2-ndk", "libwifi-system-iface", ], test_suites: [ @@ -163,7 +168,8 @@ cc_library_static { "libnativehelper", ], static_libs: [ - "android.hardware.wifi-V1-ndk", + "android.hardware.wifi.common-V1-ndk", + "android.hardware.wifi-V2-ndk", "libwifi-system-iface", ], } diff --git a/wifi/aidl/vts/functional/wifi_aidl_test_utils.cpp b/wifi/aidl/vts/functional/wifi_aidl_test_utils.cpp index ca3c4b74f1ec94ccc01edd98dd6b6c671546acae..986e3a857b62494ac7832acce6c9bae0706c13f3 100644 --- a/wifi/aidl/vts/functional/wifi_aidl_test_utils.cpp +++ b/wifi/aidl/vts/functional/wifi_aidl_test_utils.cpp @@ -197,9 +197,26 @@ std::shared_ptr getBridgedWifiApIface(const char* instance_name) { bool configureChipToSupportConcurrencyType(const std::shared_ptr& wifi_chip, IfaceConcurrencyType type, int* configured_mode_id) { + if (!wifi_chip.get()) { + return false; + } return configureChipToSupportConcurrencyTypeInternal(wifi_chip, type, configured_mode_id); } +bool doesChipSupportConcurrencyType(const std::shared_ptr& wifi_chip, + IfaceConcurrencyType type) { + if (!wifi_chip.get()) { + return false; + } + std::vector chip_modes; + auto status = wifi_chip->getAvailableModes(&chip_modes); + if (!status.isOk()) { + return false; + } + int mode_id; + return findAnyModeSupportingConcurrencyType(type, chip_modes, &mode_id); +} + void stopWifiService(const char* instance_name) { std::shared_ptr wifi = getWifi(instance_name); if (wifi != nullptr) { @@ -208,6 +225,9 @@ void stopWifiService(const char* instance_name) { } int32_t getChipFeatureSet(const std::shared_ptr& wifi_chip) { + if (!wifi_chip.get()) { + return 0; + } int32_t features = 0; if (wifi_chip->getFeatureSet(&features).isOk()) { return features; diff --git a/wifi/aidl/vts/functional/wifi_aidl_test_utils.h b/wifi/aidl/vts/functional/wifi_aidl_test_utils.h index 0d70c3b55709c67fff28278611404a8599418531..921d6899265beb5a1987c2c760b8410555ac720e 100644 --- a/wifi/aidl/vts/functional/wifi_aidl_test_utils.h +++ b/wifi/aidl/vts/functional/wifi_aidl_test_utils.h @@ -42,6 +42,9 @@ std::shared_ptr getBridgedWifiApIface(std::shared_ptr w // Configure the chip in a mode to support the creation of the provided iface type. bool configureChipToSupportConcurrencyType(const std::shared_ptr& wifi_chip, IfaceConcurrencyType type, int* configured_mode_id); +// Check whether the chip supports the creation of the provided iface type. +bool doesChipSupportConcurrencyType(const std::shared_ptr& wifi_chip, + IfaceConcurrencyType type); // Used to trigger IWifi.stop() at the end of every test. void stopWifiService(const char* instance_name); int32_t getChipFeatureSet(const std::shared_ptr& wifi_chip); diff --git a/wifi/aidl/vts/functional/wifi_chip_aidl_test.cpp b/wifi/aidl/vts/functional/wifi_chip_aidl_test.cpp index bbd27f95e34dfc72cfabbe315c8a7235fb0c9db0..a1b9ce1654d28c447d6223ee1b09eee927f23e5d 100644 --- a/wifi/aidl/vts/functional/wifi_chip_aidl_test.cpp +++ b/wifi/aidl/vts/functional/wifi_chip_aidl_test.cpp @@ -63,6 +63,10 @@ class WifiChipAidlTest : public testing::TestWithParam { return mode_id; } + bool isConcurrencyTypeSupported(IfaceConcurrencyType type) { + return doesChipSupportConcurrencyType(wifi_chip_, type); + } + std::shared_ptr configureChipForStaAndGetIface() { std::shared_ptr iface; configureChipForConcurrencyType(IfaceConcurrencyType::STA); @@ -532,6 +536,9 @@ TEST_P(WifiChipAidlTest, CreateStaIface) { * CreateApIface */ TEST_P(WifiChipAidlTest, CreateApIface) { + if (!isConcurrencyTypeSupported(IfaceConcurrencyType::AP)) { + GTEST_SKIP() << "AP is not supported"; + } configureChipForApAndGetIface(); } @@ -549,6 +556,9 @@ TEST_P(WifiChipAidlTest, CreateNanIface) { * CreateP2pIface */ TEST_P(WifiChipAidlTest, CreateP2pIface) { + if (!isConcurrencyTypeSupported(IfaceConcurrencyType::P2P)) { + GTEST_SKIP() << "P2P is not supported"; + } configureChipForP2pAndGetIface(); } @@ -583,6 +593,9 @@ TEST_P(WifiChipAidlTest, GetStaIfaceNames) { * GetP2pIfaceNames */ TEST_P(WifiChipAidlTest, GetP2pIfaceNames) { + if (!isConcurrencyTypeSupported(IfaceConcurrencyType::P2P)) { + GTEST_SKIP() << "P2P is not supported"; + } configureChipForConcurrencyType(IfaceConcurrencyType::P2P); std::vector iface_names; @@ -607,6 +620,9 @@ TEST_P(WifiChipAidlTest, GetP2pIfaceNames) { * GetApIfaceNames */ TEST_P(WifiChipAidlTest, GetApIfaceNames) { + if (!isConcurrencyTypeSupported(IfaceConcurrencyType::AP)) { + GTEST_SKIP() << "AP is not supported"; + } configureChipForConcurrencyType(IfaceConcurrencyType::AP); std::vector iface_names; @@ -679,6 +695,9 @@ TEST_P(WifiChipAidlTest, GetStaIface) { * GetP2pIface */ TEST_P(WifiChipAidlTest, GetP2pIface) { + if (!isConcurrencyTypeSupported(IfaceConcurrencyType::P2P)) { + GTEST_SKIP() << "P2P is not supported"; + } std::shared_ptr iface = configureChipForP2pAndGetIface(); std::string iface_name = getP2pIfaceName(iface); @@ -697,6 +716,9 @@ TEST_P(WifiChipAidlTest, GetP2pIface) { * GetApIface */ TEST_P(WifiChipAidlTest, GetApIface) { + if (!isConcurrencyTypeSupported(IfaceConcurrencyType::AP)) { + GTEST_SKIP() << "AP is not supported"; + } std::shared_ptr iface = configureChipForApAndGetIface(); std::string iface_name = getApIfaceName(iface); @@ -755,6 +777,9 @@ TEST_P(WifiChipAidlTest, RemoveStaIface) { * RemoveP2pIface */ TEST_P(WifiChipAidlTest, RemoveP2pIface) { + if (!isConcurrencyTypeSupported(IfaceConcurrencyType::P2P)) { + GTEST_SKIP() << "P2P is not supported"; + } std::shared_ptr iface = configureChipForP2pAndGetIface(); std::string iface_name = getP2pIfaceName(iface); @@ -771,6 +796,9 @@ TEST_P(WifiChipAidlTest, RemoveP2pIface) { * RemoveApIface */ TEST_P(WifiChipAidlTest, RemoveApIface) { + if (!isConcurrencyTypeSupported(IfaceConcurrencyType::AP)) { + GTEST_SKIP() << "AP is not supported"; + } std::shared_ptr iface = configureChipForApAndGetIface(); std::string iface_name = getApIfaceName(iface); @@ -844,6 +872,36 @@ TEST_P(WifiChipAidlTest, CreateBridgedApIfaceAndremoveIfaceInstanceFromBridgedAp EXPECT_EQ(instances_after_remove.size(), 1); } +/* + * SetVoipMode_off + * Tests the setVoipMode() API with VoIP mode OFF. + */ +TEST_P(WifiChipAidlTest, SetVoipMode_off) { + configureChipForConcurrencyType(IfaceConcurrencyType::STA); + int32_t features = getChipFeatureSet(wifi_chip_); + if (features & static_cast(IWifiChip::FeatureSetMask::SET_VOIP_MODE)) { + auto status = wifi_chip_->setVoipMode(IWifiChip::VoipMode::OFF); + EXPECT_TRUE(status.isOk()); + } else { + GTEST_SKIP() << "setVoipMode() is not supported by vendor."; + } +} + +/* + * SetVoipMode_voice + * Tests the setVoipMode() API with VoIP mode VOICE. + */ +TEST_P(WifiChipAidlTest, SetVoipMode_voice) { + configureChipForConcurrencyType(IfaceConcurrencyType::STA); + int32_t features = getChipFeatureSet(wifi_chip_); + if (features & static_cast(IWifiChip::FeatureSetMask::SET_VOIP_MODE)) { + auto status = wifi_chip_->setVoipMode(IWifiChip::VoipMode::VOICE); + EXPECT_TRUE(status.isOk()); + } else { + GTEST_SKIP() << "setVoipMode() is not supported by vendor."; + } +} + GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(WifiChipAidlTest); INSTANTIATE_TEST_SUITE_P(WifiTest, WifiChipAidlTest, testing::ValuesIn(android::getAidlHalInstanceNames(IWifi::descriptor)), diff --git a/wifi/common/aidl/Android.bp b/wifi/common/aidl/Android.bp new file mode 100644 index 0000000000000000000000000000000000000000..1913451fd7c04b36d9ca83f2b006b6ccd8c79e4d --- /dev/null +++ b/wifi/common/aidl/Android.bp @@ -0,0 +1,47 @@ +// Copyright (C) 2023 The Android Open Source Project +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + +aidl_interface { + name: "android.hardware.wifi.common", + vendor_available: true, + srcs: [ + "android/hardware/wifi/common/*.aidl", + ], + headers: [ + "PersistableBundle_aidl", + ], + stability: "vintf", + backend: { + java: { + sdk_version: "module_current", + apex_available: [ + "//apex_available:platform", + "com.android.wifi", + ], + min_sdk_version: "30", + }, + cpp: { + enabled: false, + }, + }, +} diff --git a/wifi/common/aidl/aidl_api/android.hardware.wifi.common/current/android/hardware/wifi/common/OuiKeyedData.aidl b/wifi/common/aidl/aidl_api/android.hardware.wifi.common/current/android/hardware/wifi/common/OuiKeyedData.aidl new file mode 100644 index 0000000000000000000000000000000000000000..640a1f69d9fb92fe4db101a68765516ccffea6ab --- /dev/null +++ b/wifi/common/aidl/aidl_api/android.hardware.wifi.common/current/android/hardware/wifi/common/OuiKeyedData.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/////////////////////////////////////////////////////////////////////////////// +// THIS 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 -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.wifi.common; +@VintfStability +parcelable OuiKeyedData { + int oui; + android.os.PersistableBundle vendorData; +} diff --git a/wifi/common/aidl/android/hardware/wifi/common/OuiKeyedData.aidl b/wifi/common/aidl/android/hardware/wifi/common/OuiKeyedData.aidl new file mode 100644 index 0000000000000000000000000000000000000000..4e6a99fef1caad2a5171edd27343f728ae5cb33d --- /dev/null +++ b/wifi/common/aidl/android/hardware/wifi/common/OuiKeyedData.aidl @@ -0,0 +1,35 @@ +/* + * Copyright (C) 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.hardware.wifi.common; + +import android.os.PersistableBundle; + +/** + * Data for OUI-based configuration. + */ +@VintfStability +parcelable OuiKeyedData { + /** + * OUI : 24-bit organizationally unique identifier to identify the vendor/OEM. + * See https://standards-oui.ieee.org/ for more information. + */ + int oui; + /** + * Vendor data. Expected fields should be defined by the vendor. + */ + PersistableBundle vendorData; +} diff --git a/wifi/hostapd/aidl/Android.bp b/wifi/hostapd/aidl/Android.bp index 54895c17b84c92b5b08315a1a1781b3f1c20edd7..cdc94bb0361efce3de1a00244fc74dee074e5415 100644 --- a/wifi/hostapd/aidl/Android.bp +++ b/wifi/hostapd/aidl/Android.bp @@ -27,6 +27,9 @@ aidl_interface { srcs: [ "android/hardware/wifi/hostapd/*.aidl", ], + imports: [ + "android.hardware.wifi.common-V1", + ], stability: "vintf", backend: { java: { @@ -40,6 +43,9 @@ aidl_interface { ndk: { gen_trace: true, }, + cpp: { + enabled: false, + }, }, versions_with_info: [ { @@ -47,5 +53,4 @@ aidl_interface { imports: [], }, ], - } diff --git a/wifi/hostapd/aidl/aidl_api/android.hardware.wifi.hostapd/current/android/hardware/wifi/hostapd/ApInfo.aidl b/wifi/hostapd/aidl/aidl_api/android.hardware.wifi.hostapd/current/android/hardware/wifi/hostapd/ApInfo.aidl index ca20f377be9c51edd7f023bc35d70564535db1a7..1a66105b8f8373a0c6a567bc686699623711aa09 100644 --- a/wifi/hostapd/aidl/aidl_api/android.hardware.wifi.hostapd/current/android/hardware/wifi/hostapd/ApInfo.aidl +++ b/wifi/hostapd/aidl/aidl_api/android.hardware.wifi.hostapd/current/android/hardware/wifi/hostapd/ApInfo.aidl @@ -40,4 +40,5 @@ parcelable ApInfo { android.hardware.wifi.hostapd.ChannelBandwidth channelBandwidth; android.hardware.wifi.hostapd.Generation generation; byte[] apIfaceInstanceMacAddress; + @nullable android.hardware.wifi.common.OuiKeyedData[] vendorData; } 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 0c88a398a3e1909a7eaae146c4d23eeb92afa681..64367bbe70e54f65046b66607513aec46bf7a603 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 @@ -37,4 +37,5 @@ parcelable IfaceParams { String name; android.hardware.wifi.hostapd.HwModeParams hwModeParams; android.hardware.wifi.hostapd.ChannelParams[] channelParams; + @nullable android.hardware.wifi.common.OuiKeyedData[] vendorData; } diff --git a/wifi/hostapd/aidl/android/hardware/wifi/hostapd/ApInfo.aidl b/wifi/hostapd/aidl/android/hardware/wifi/hostapd/ApInfo.aidl index a6fe63b50aa770606ee3b49c0b6ada97676f610a..f2b2ee68e5a14a01c3882a39de1f5b9eae58cd7d 100644 --- a/wifi/hostapd/aidl/android/hardware/wifi/hostapd/ApInfo.aidl +++ b/wifi/hostapd/aidl/android/hardware/wifi/hostapd/ApInfo.aidl @@ -16,6 +16,7 @@ package android.hardware.wifi.hostapd; +import android.hardware.wifi.common.OuiKeyedData; import android.hardware.wifi.hostapd.ChannelBandwidth; import android.hardware.wifi.hostapd.Generation; @@ -57,4 +58,9 @@ parcelable ApInfo { * MAC Address of the apIfaceInstance. */ byte[] apIfaceInstanceMacAddress; + + /** + * Optional vendor-specific information. + */ + @nullable OuiKeyedData[] vendorData; } diff --git a/wifi/hostapd/aidl/android/hardware/wifi/hostapd/IfaceParams.aidl b/wifi/hostapd/aidl/android/hardware/wifi/hostapd/IfaceParams.aidl index a8abec3c1399078b8ab28981c4ab0ff6bd02754a..3f8ee39c7453f44aa2589ed4058b4d6b7ea5b7e0 100644 --- a/wifi/hostapd/aidl/android/hardware/wifi/hostapd/IfaceParams.aidl +++ b/wifi/hostapd/aidl/android/hardware/wifi/hostapd/IfaceParams.aidl @@ -16,6 +16,7 @@ package android.hardware.wifi.hostapd; +import android.hardware.wifi.common.OuiKeyedData; import android.hardware.wifi.hostapd.ChannelParams; import android.hardware.wifi.hostapd.HwModeParams; @@ -36,4 +37,8 @@ parcelable IfaceParams { * The list of the channel params for the dual interfaces. */ ChannelParams[] channelParams; + /** + * Optional vendor-specific configuration parameters. + */ + @nullable OuiKeyedData[] vendorData; } diff --git a/wifi/hostapd/aidl/vts/functional/Android.bp b/wifi/hostapd/aidl/vts/functional/Android.bp index ff35056076a3ee16727071c83052766d15f17e30..87eee824a0eb75d3a3c2016dd0420b74fbfdd6bd 100644 --- a/wifi/hostapd/aidl/vts/functional/Android.bp +++ b/wifi/hostapd/aidl/vts/functional/Android.bp @@ -36,7 +36,8 @@ cc_test { "android.hardware.wifi@1.4", "android.hardware.wifi@1.5", "android.hardware.wifi@1.6", - "android.hardware.wifi-V1-ndk", + "android.hardware.wifi.common-V1-ndk", + "android.hardware.wifi-V2-ndk", "libwifi-system", "libwifi-system-iface", "VtsHalWifiTargetTestUtil", diff --git a/wifi/supplicant/aidl/Android.bp b/wifi/supplicant/aidl/Android.bp index ac5a952addf95b42998a04a113d3cc435db9974f..632927d714de8c63a7ffba94bf9592c188cfc8b2 100644 --- a/wifi/supplicant/aidl/Android.bp +++ b/wifi/supplicant/aidl/Android.bp @@ -27,6 +27,9 @@ aidl_interface { srcs: [ "android/hardware/wifi/supplicant/*.aidl", ], + imports: [ + "android.hardware.wifi.common-V1", + ], stability: "vintf", backend: { java: { @@ -45,6 +48,9 @@ aidl_interface { ndk: { gen_trace: true, }, + cpp: { + enabled: false, + }, }, versions_with_info: [ { @@ -57,6 +63,5 @@ aidl_interface { }, ], - frozen: true, - + frozen: false, } diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/AuthAlgMask.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/AuthAlgMask.aidl index 9cd178d7ba2599eac6691c1a3eb72d244f48a86c..44210185cf73bf03e5c31c711710baa714c7bce0 100644 --- a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/AuthAlgMask.aidl +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/AuthAlgMask.aidl @@ -34,8 +34,8 @@ package android.hardware.wifi.supplicant; @Backing(type="int") @VintfStability enum AuthAlgMask { - OPEN = 1, - SHARED = 2, - LEAP = 4, - SAE = 16, + OPEN = (1 << 0) /* 1 */, + SHARED = (1 << 1) /* 2 */, + LEAP = (1 << 2) /* 4 */, + SAE = (1 << 4) /* 16 */, } diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/AuxiliarySupplicantEventCode.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/AuxiliarySupplicantEventCode.aidl index 471cfff906d097125dce4b6959c8e30d0056c206..a339a9272f62d1c001ed225e40b92417176e287e 100644 --- a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/AuxiliarySupplicantEventCode.aidl +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/AuxiliarySupplicantEventCode.aidl @@ -34,7 +34,7 @@ package android.hardware.wifi.supplicant; @Backing(type="int") @VintfStability enum AuxiliarySupplicantEventCode { - EAP_METHOD_SELECTED = 0, - SSID_TEMP_DISABLED = 1, - OPEN_SSL_FAILURE = 2, + EAP_METHOD_SELECTED, + SSID_TEMP_DISABLED, + OPEN_SSL_FAILURE, } diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/BssTmDataFlagsMask.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/BssTmDataFlagsMask.aidl index f215f0557feeecb636897023fc54f85c52996f6a..6f0045c82ce07dd3c35728b1e8a98d75ce79329d 100644 --- a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/BssTmDataFlagsMask.aidl +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/BssTmDataFlagsMask.aidl @@ -34,12 +34,12 @@ package android.hardware.wifi.supplicant; @Backing(type="int") @VintfStability enum BssTmDataFlagsMask { - WNM_MODE_PREFERRED_CANDIDATE_LIST_INCLUDED = 1, - WNM_MODE_ABRIDGED = 2, - WNM_MODE_DISASSOCIATION_IMMINENT = 4, - WNM_MODE_BSS_TERMINATION_INCLUDED = 8, - WNM_MODE_ESS_DISASSOCIATION_IMMINENT = 16, - MBO_TRANSITION_REASON_CODE_INCLUDED = 32, - MBO_ASSOC_RETRY_DELAY_INCLUDED = 64, - MBO_CELLULAR_DATA_CONNECTION_PREFERENCE_INCLUDED = 128, + WNM_MODE_PREFERRED_CANDIDATE_LIST_INCLUDED = (1 << 0) /* 1 */, + WNM_MODE_ABRIDGED = (1 << 1) /* 2 */, + WNM_MODE_DISASSOCIATION_IMMINENT = (1 << 2) /* 4 */, + WNM_MODE_BSS_TERMINATION_INCLUDED = (1 << 3) /* 8 */, + WNM_MODE_ESS_DISASSOCIATION_IMMINENT = (1 << 4) /* 16 */, + MBO_TRANSITION_REASON_CODE_INCLUDED = (1 << 5) /* 32 */, + MBO_ASSOC_RETRY_DELAY_INCLUDED = (1 << 6) /* 64 */, + MBO_CELLULAR_DATA_CONNECTION_PREFERENCE_INCLUDED = (1 << 7) /* 128 */, } diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ConnectionCapabilities.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ConnectionCapabilities.aidl index 553cbc8e2509369a910826053fe373e6fecc4703..a0dd32fee66493631bc138ca307490b20425b273 100644 --- a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ConnectionCapabilities.aidl +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ConnectionCapabilities.aidl @@ -40,4 +40,5 @@ parcelable ConnectionCapabilities { int maxNumberRxSpatialStreams; android.hardware.wifi.supplicant.LegacyMode legacyMode; boolean apTidToLinkMapNegotiationSupported; + @nullable android.hardware.wifi.common.OuiKeyedData[] vendorData; } diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/DppAkm.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/DppAkm.aidl index df2aef8c11d86211f688c8b1e99b3f2073f40905..730843d2ec07b0852ee868ad94e211fb1924ffe7 100644 --- a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/DppAkm.aidl +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/DppAkm.aidl @@ -34,8 +34,8 @@ package android.hardware.wifi.supplicant; @Backing(type="int") @VintfStability enum DppAkm { - PSK = 0, - PSK_SAE = 1, - SAE = 2, - DPP = 3, + PSK, + PSK_SAE, + SAE, + DPP, } diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/DppCurve.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/DppCurve.aidl index e69da443999a5ce59115a41a36332a3962d64f3e..14cb49f681bf9d169c34a338cf8c3ff6ddbd9fb7 100644 --- a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/DppCurve.aidl +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/DppCurve.aidl @@ -34,10 +34,10 @@ package android.hardware.wifi.supplicant; @Backing(type="int") @VintfStability enum DppCurve { - PRIME256V1 = 0, - SECP384R1 = 1, - SECP521R1 = 2, - BRAINPOOLP256R1 = 3, - BRAINPOOLP384R1 = 4, - BRAINPOOLP512R1 = 5, + PRIME256V1, + SECP384R1, + SECP521R1, + BRAINPOOLP256R1, + BRAINPOOLP384R1, + BRAINPOOLP512R1, } diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/DppEventType.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/DppEventType.aidl index 9e394fc5df9e5d830c9ea8c8a6ac472812df4b68..47c8cc0e3534b57fb8b598bb6533204cc4d4acec 100644 --- a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/DppEventType.aidl +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/DppEventType.aidl @@ -34,6 +34,6 @@ package android.hardware.wifi.supplicant; @Backing(type="int") @VintfStability enum DppEventType { - CONFIGURATION_SENT = 0, - CONFIGURATION_APPLIED = 1, + CONFIGURATION_SENT, + CONFIGURATION_APPLIED, } diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/DppFailureCode.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/DppFailureCode.aidl index 7e7c806733c0e1fc3c59f78b7f90e12e5743d428..89fbc4bab198e04c15e7cb143549d7df984f234d 100644 --- a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/DppFailureCode.aidl +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/DppFailureCode.aidl @@ -34,16 +34,16 @@ package android.hardware.wifi.supplicant; @Backing(type="int") @VintfStability enum DppFailureCode { - INVALID_URI = 0, - AUTHENTICATION = 1, - NOT_COMPATIBLE = 2, - CONFIGURATION = 3, - BUSY = 4, - TIMEOUT = 5, - FAILURE = 6, - NOT_SUPPORTED = 7, - CONFIGURATION_REJECTED = 8, - CANNOT_FIND_NETWORK = 9, - ENROLLEE_AUTHENTICATION = 10, - URI_GENERATION = 11, + INVALID_URI, + AUTHENTICATION, + NOT_COMPATIBLE, + CONFIGURATION, + BUSY, + TIMEOUT, + FAILURE, + NOT_SUPPORTED, + CONFIGURATION_REJECTED, + CANNOT_FIND_NETWORK, + ENROLLEE_AUTHENTICATION, + URI_GENERATION, } diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/DppNetRole.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/DppNetRole.aidl index c6d35226753a29d01fb5608d897e927172ef8c34..77a910b251ec4de4b13fb29d869924a693289845 100644 --- a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/DppNetRole.aidl +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/DppNetRole.aidl @@ -34,6 +34,6 @@ package android.hardware.wifi.supplicant; @Backing(type="int") @VintfStability enum DppNetRole { - STA = 0, - AP = 1, + STA, + AP, } diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/DppProgressCode.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/DppProgressCode.aidl index f0618a5a6de44d85fbdc70236f2fa2883afafa8b..ea244de3c2ab6dff16b5f6aa512850d3fef2912a 100644 --- a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/DppProgressCode.aidl +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/DppProgressCode.aidl @@ -34,8 +34,8 @@ package android.hardware.wifi.supplicant; @Backing(type="int") @VintfStability enum DppProgressCode { - AUTHENTICATION_SUCCESS = 0, - RESPONSE_PENDING = 1, - CONFIGURATION_SENT_WAITING_RESPONSE = 2, - CONFIGURATION_ACCEPTED = 3, + AUTHENTICATION_SUCCESS, + RESPONSE_PENDING, + CONFIGURATION_SENT_WAITING_RESPONSE, + CONFIGURATION_ACCEPTED, } diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/DppStatusErrorCode.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/DppStatusErrorCode.aidl index d72633b569745faf55a06c3be5fdb1f675afde7d..21f07dded55532708734c20633b96cda221eb3d1 100644 --- a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/DppStatusErrorCode.aidl +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/DppStatusErrorCode.aidl @@ -34,7 +34,7 @@ package android.hardware.wifi.supplicant; @Backing(type="int") @VintfStability enum DppStatusErrorCode { - UNKNOWN = -1, + UNKNOWN = (-1) /* -1 */, SUCCESS = 0, NOT_COMPATIBLE = 1, AUTH_FAILURE = 2, diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/GroupCipherMask.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/GroupCipherMask.aidl index f2da92532a84470ab8bca1007eaa30975b7cfd65..d22d3d0582e7b7ecb0e67c87765fe3f0aeaa606d 100644 --- a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/GroupCipherMask.aidl +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/GroupCipherMask.aidl @@ -34,12 +34,12 @@ package android.hardware.wifi.supplicant; @Backing(type="int") @VintfStability enum GroupCipherMask { - WEP40 = 2, - WEP104 = 4, - TKIP = 8, - CCMP = 16, - GTK_NOT_USED = 16384, - GCMP_256 = 256, - SMS4 = 128, - GCMP_128 = 64, + WEP40 = (1 << 1) /* 2 */, + WEP104 = (1 << 2) /* 4 */, + TKIP = (1 << 3) /* 8 */, + CCMP = (1 << 4) /* 16 */, + GTK_NOT_USED = (1 << 14) /* 16384 */, + GCMP_256 = (1 << 8) /* 256 */, + SMS4 = (1 << 7) /* 128 */, + GCMP_128 = (1 << 6) /* 64 */, } diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/GroupMgmtCipherMask.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/GroupMgmtCipherMask.aidl index c24d6cc7442fa72913e72579904bd2108496db59..23bb04fe2f74dc68d4fea104575325c111a6d454 100644 --- a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/GroupMgmtCipherMask.aidl +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/GroupMgmtCipherMask.aidl @@ -34,7 +34,7 @@ package android.hardware.wifi.supplicant; @Backing(type="int") @VintfStability enum GroupMgmtCipherMask { - BIP_GMAC_128 = 2048, - BIP_GMAC_256 = 4096, - BIP_CMAC_256 = 8192, + BIP_GMAC_128 = (1 << 11) /* 2048 */, + BIP_GMAC_256 = (1 << 12) /* 4096 */, + BIP_CMAC_256 = (1 << 13) /* 8192 */, } diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ISupplicantP2pIface.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ISupplicantP2pIface.aidl index 19e67284207d4d848d46423c8518b19d2fa2148e..0729646c9a1e734bb80962e60389391f50c6488d 100644 --- a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ISupplicantP2pIface.aidl +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ISupplicantP2pIface.aidl @@ -43,10 +43,16 @@ interface ISupplicantP2pIface { void cancelServiceDiscovery(in long identifier); void cancelWps(in String groupIfName); void configureExtListen(in int periodInMillis, in int intervalInMillis); + /** + * @deprecated This method is deprecated from AIDL v3, newer HALs should use connectWithParams. + */ String connect(in byte[] peerAddress, in android.hardware.wifi.supplicant.WpsProvisionMethod provisionMethod, in String preSelectedPin, in boolean joinExistingGroup, in boolean persistent, in int goIntent); byte[] createNfcHandoverRequestMessage(); byte[] createNfcHandoverSelectMessage(); void enableWfd(in boolean enable); + /** + * @deprecated This method is deprecated from AIDL v3, newer HALs should use findWithParams. + */ void find(in int timeoutInSec); void flush(); void flushServices(); @@ -93,8 +99,16 @@ interface ISupplicantP2pIface { String startWpsPinDisplay(in String groupIfName, in byte[] bssid); void startWpsPinKeypad(in String groupIfName, in String pin); void stopFind(); + /** + * @deprecated This method is deprecated from AIDL v3, newer HALs should use findWithParams. + */ void findOnSocialChannels(in int timeoutInSec); + /** + * @deprecated This method is deprecated from AIDL v3, newer HALs should use findWithParams. + */ void findOnSpecificFrequency(in int freqInHz, in int timeoutInSec); void setVendorElements(in android.hardware.wifi.supplicant.P2pFrameTypeMask frameTypeMask, in byte[] vendorElemBytes); void configureEapolIpAddressAllocationParams(in int ipAddressGo, in int ipAddressMask, in int ipAddressStart, in int ipAddressEnd); + String connectWithParams(in android.hardware.wifi.supplicant.P2pConnectInfo connectInfo); + void findWithParams(in android.hardware.wifi.supplicant.P2pDiscoveryInfo discoveryInfo); } diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ISupplicantP2pIfaceCallback.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ISupplicantP2pIfaceCallback.aidl index da3ca52897c320f40a20c508e07b28dd4983cb40..851e85107b6f2edeb060802f953624166dc34dfb 100644 --- a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ISupplicantP2pIfaceCallback.aidl +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ISupplicantP2pIfaceCallback.aidl @@ -34,6 +34,9 @@ package android.hardware.wifi.supplicant; @VintfStability interface ISupplicantP2pIfaceCallback { + /** + * @deprecated This callback is deprecated from AIDL v2, newer HAL should call onDeviceFoundWithParams. + */ oneway void onDeviceFound(in byte[] srcAddress, in byte[] p2pDeviceAddress, in byte[] primaryDeviceType, in String deviceName, in android.hardware.wifi.supplicant.WpsConfigMethods configMethods, in byte deviceCapabilities, in android.hardware.wifi.supplicant.P2pGroupCapabilityMask groupCapabilities, in byte[] wfdDeviceInfo); oneway void onDeviceLost(in byte[] p2pDeviceAddress); oneway void onFindStopped(); @@ -45,12 +48,28 @@ interface ISupplicantP2pIfaceCallback { oneway void onGroupStarted(in String groupIfname, in boolean isGroupOwner, in byte[] ssid, in int frequency, in byte[] psk, in String passphrase, in byte[] goDeviceAddress, in boolean isPersistent); oneway void onInvitationReceived(in byte[] srcAddress, in byte[] goDeviceAddress, in byte[] bssid, in int persistentNetworkId, in int operatingFrequency); oneway void onInvitationResult(in byte[] bssid, in android.hardware.wifi.supplicant.P2pStatusCode status); + /** + * @deprecated This callback is deprecated from AIDL v3, newer HAL should call onProvisionDiscoveryCompletedEvent. + */ oneway void onProvisionDiscoveryCompleted(in byte[] p2pDeviceAddress, in boolean isRequest, in android.hardware.wifi.supplicant.P2pProvDiscStatusCode status, in android.hardware.wifi.supplicant.WpsConfigMethods configMethods, in String generatedPin); oneway void onR2DeviceFound(in byte[] srcAddress, in byte[] p2pDeviceAddress, in byte[] primaryDeviceType, in String deviceName, in android.hardware.wifi.supplicant.WpsConfigMethods configMethods, in byte deviceCapabilities, in android.hardware.wifi.supplicant.P2pGroupCapabilityMask groupCapabilities, in byte[] wfdDeviceInfo, in byte[] wfdR2DeviceInfo); oneway void onServiceDiscoveryResponse(in byte[] srcAddress, in char updateIndicator, in byte[] tlvs); + /** + * @deprecated This callback is deprecated from AIDL v3, newer HAL should call onPeerClientJoined() + */ oneway void onStaAuthorized(in byte[] srcAddress, in byte[] p2pDeviceAddress); + /** + * @deprecated This callback is deprecated from AIDL v3, newer HAL should call onPeerClientDisconnected() + */ oneway void onStaDeauthorized(in byte[] srcAddress, in byte[] p2pDeviceAddress); oneway void onGroupFrequencyChanged(in String groupIfname, in int frequency); + /** + * @deprecated This callback is deprecated from AIDL v3, newer HAL should call onDeviceFoundWithParams. + */ oneway void onDeviceFoundWithVendorElements(in byte[] srcAddress, in byte[] p2pDeviceAddress, in byte[] primaryDeviceType, in String deviceName, in android.hardware.wifi.supplicant.WpsConfigMethods configMethods, in byte deviceCapabilities, in android.hardware.wifi.supplicant.P2pGroupCapabilityMask groupCapabilities, in byte[] wfdDeviceInfo, in byte[] wfdR2DeviceInfo, in byte[] vendorElemBytes); oneway void onGroupStartedWithParams(in android.hardware.wifi.supplicant.P2pGroupStartedEventParams groupStartedEventParams); + oneway void onPeerClientJoined(in android.hardware.wifi.supplicant.P2pPeerClientJoinedEventParams clientJoinedEventParams); + oneway void onPeerClientDisconnected(in android.hardware.wifi.supplicant.P2pPeerClientDisconnectedEventParams clientDisconnectedEventParams); + oneway void onProvisionDiscoveryCompletedEvent(in android.hardware.wifi.supplicant.P2pProvisionDiscoveryCompletedEventParams provisionDiscoveryCompletedEventParams); + oneway void onDeviceFoundWithParams(in android.hardware.wifi.supplicant.P2pDeviceFoundEventParams deviceFoundEventParams); } diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ISupplicantStaIface.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ISupplicantStaIface.aidl index 1616b260039221bf220df34a936a58a5ce7f522a..917668e9ab03c9909558239537b4e18eed63cc0f 100644 --- a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ISupplicantStaIface.aidl +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ISupplicantStaIface.aidl @@ -54,6 +54,9 @@ interface ISupplicantStaIface { android.hardware.wifi.supplicant.IfaceType getType(); android.hardware.wifi.supplicant.WpaDriverCapabilitiesMask getWpaDriverCapabilities(); void initiateAnqpQuery(in byte[] macAddress, in android.hardware.wifi.supplicant.AnqpInfoId[] infoElements, in android.hardware.wifi.supplicant.Hs20AnqpSubtypes[] subTypes); + /** + * @deprecated No longer in use. + */ void initiateHs20IconQuery(in byte[] macAddress, in String fileName); void initiateTdlsDiscover(in byte[] macAddress); void initiateTdlsSetup(in byte[] macAddress); @@ -98,5 +101,7 @@ interface ISupplicantStaIface { android.hardware.wifi.supplicant.SignalPollResult[] getSignalPollResults(); android.hardware.wifi.supplicant.QosPolicyScsRequestStatus[] addQosPolicyRequestForScs(in android.hardware.wifi.supplicant.QosPolicyScsData[] qosPolicyData); android.hardware.wifi.supplicant.QosPolicyScsRequestStatus[] removeQosPolicyForScs(in byte[] scsPolicyIds); + void configureMscs(in android.hardware.wifi.supplicant.MscsParams params); + void disableMscs(); const int MAX_POLICIES_PER_QOS_SCS_REQUEST = 16; } diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ISupplicantStaIfaceCallback.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ISupplicantStaIfaceCallback.aidl index 1c232237ea6f912e7a040eaaff41f2afc381e0ee..898c2d4dd72dfccd0d392bded0facf336b77073d 100644 --- a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ISupplicantStaIfaceCallback.aidl +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ISupplicantStaIfaceCallback.aidl @@ -53,6 +53,9 @@ interface ISupplicantStaIfaceCallback { oneway void onExtRadioWorkStart(in int id); oneway void onExtRadioWorkTimeout(in int id); oneway void onHs20DeauthImminentNotice(in byte[] bssid, in int reasonCode, in int reAuthDelayInSec, in String url); + /** + * @deprecated No longer in use. + */ oneway void onHs20IconQueryDone(in byte[] bssid, in String fileName, in byte[] data); oneway void onHs20SubscriptionRemediation(in byte[] bssid, in android.hardware.wifi.supplicant.OsuMethod osuMethod, in String url); oneway void onHs20TermsAndConditionsAcceptanceRequestedNotification(in byte[] bssid, in String url); diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ISupplicantStaNetwork.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ISupplicantStaNetwork.aidl index bfc05a4ad81a71a5e31f4e11e0f8d077f90fdd23..488037f3b4d53ff7204c1b39eaf48c7c92762042 100644 --- a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ISupplicantStaNetwork.aidl +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ISupplicantStaNetwork.aidl @@ -129,6 +129,8 @@ interface ISupplicantStaNetwork { void setRoamingConsortiumSelection(in byte[] selectedRcoi); void setMinimumTlsVersionEapPhase1Param(android.hardware.wifi.supplicant.TlsVersion tlsVersion); void setStrictConservativePeerMode(in boolean enable); + void disableEht(); + void setVendorData(in android.hardware.wifi.common.OuiKeyedData[] vendorData); const int SSID_MAX_LEN_IN_BYTES = 32; const int PSK_PASSPHRASE_MIN_LEN_IN_BYTES = 8; const int PSK_PASSPHRASE_MAX_LEN_IN_BYTES = 63; diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/IfaceType.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/IfaceType.aidl index 557dbd76564b952f592911ff308e028445b22672..e11c2f7ec6711501266aa375c9859a621b0a8861 100644 --- a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/IfaceType.aidl +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/IfaceType.aidl @@ -34,6 +34,6 @@ package android.hardware.wifi.supplicant; @Backing(type="int") @VintfStability enum IfaceType { - STA = 0, - P2P = 1, + STA, + P2P, } diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/IpVersion.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/IpVersion.aidl index f571b44eb21b68448b8f8222ad62ede9faca0139..958031437cb3ebd6a9076c7cb3a3ae153c18df5f 100644 --- a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/IpVersion.aidl +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/IpVersion.aidl @@ -34,6 +34,6 @@ package android.hardware.wifi.supplicant; @Backing(type="byte") @VintfStability enum IpVersion { - VERSION_4 = 0, - VERSION_6 = 1, + VERSION_4, + VERSION_6, } diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/KeyMgmtMask.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/KeyMgmtMask.aidl index 7228480f569b3c474e7d11272aaea8c6964ea58d..35d51bc5660d7de461432c8202cf2eb8a749adde 100644 --- a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/KeyMgmtMask.aidl +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/KeyMgmtMask.aidl @@ -34,21 +34,21 @@ package android.hardware.wifi.supplicant; @Backing(type="int") @VintfStability enum KeyMgmtMask { - WPA_EAP = 1, - WPA_PSK = 2, - NONE = 4, - IEEE8021X = 8, - FT_EAP = 32, - FT_PSK = 64, - OSEN = 32768, - WPA_EAP_SHA256 = 128, - WPA_PSK_SHA256 = 256, - SAE = 1024, - SUITE_B_192 = 131072, - OWE = 4194304, - DPP = 8388608, - WAPI_PSK = 4096, - WAPI_CERT = 8192, - FILS_SHA256 = 262144, - FILS_SHA384 = 524288, + WPA_EAP = (1 << 0) /* 1 */, + WPA_PSK = (1 << 1) /* 2 */, + NONE = (1 << 2) /* 4 */, + IEEE8021X = (1 << 3) /* 8 */, + FT_EAP = (1 << 5) /* 32 */, + FT_PSK = (1 << 6) /* 64 */, + OSEN = (1 << 15) /* 32768 */, + WPA_EAP_SHA256 = (1 << 7) /* 128 */, + WPA_PSK_SHA256 = (1 << 8) /* 256 */, + SAE = (1 << 10) /* 1024 */, + SUITE_B_192 = (1 << 17) /* 131072 */, + OWE = (1 << 22) /* 4194304 */, + DPP = (1 << 23) /* 8388608 */, + WAPI_PSK = (1 << 12) /* 4096 */, + WAPI_CERT = (1 << 13) /* 8192 */, + FILS_SHA256 = (1 << 18) /* 262144 */, + FILS_SHA384 = (1 << 19) /* 524288 */, } diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/MscsParams.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/MscsParams.aidl new file mode 100644 index 0000000000000000000000000000000000000000..aeed4080de21f306bc04ca45d8edd4f51a5bd478 --- /dev/null +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/MscsParams.aidl @@ -0,0 +1,52 @@ +/* + * Copyright (C) 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/////////////////////////////////////////////////////////////////////////////// +// THIS 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 -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.wifi.supplicant; +@VintfStability +parcelable MscsParams { + byte upBitmap; + byte upLimit; + int streamTimeoutUs; + byte frameClassifierMask; + @Backing(type="int") @VintfStability + enum FrameClassifierFields { + IP_VERSION = (1 << 0) /* 1 */, + SRC_IP_ADDR = (1 << 1) /* 2 */, + DST_IP_ADDR = (1 << 2) /* 4 */, + SRC_PORT = (1 << 3) /* 8 */, + DST_PORT = (1 << 4) /* 16 */, + DSCP = (1 << 5) /* 32 */, + PROTOCOL_NEXT_HDR = (1 << 6) /* 64 */, + FLOW_LABEL = (1 << 7) /* 128 */, + } +} diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/MsduDeliveryInfo.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/MsduDeliveryInfo.aidl new file mode 100644 index 0000000000000000000000000000000000000000..792e08d2cd234de07276cd87500e89e077d98256 --- /dev/null +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/MsduDeliveryInfo.aidl @@ -0,0 +1,51 @@ +/* + * Copyright (C) 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/////////////////////////////////////////////////////////////////////////////// +// THIS 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 -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.wifi.supplicant; +@VintfStability +parcelable MsduDeliveryInfo { + android.hardware.wifi.supplicant.MsduDeliveryInfo.DeliveryRatio deliveryRatio; + byte countExponent; + @Backing(type="byte") @VintfStability + enum DeliveryRatio { + RATIO_95 = 1, + RATIO_96 = 2, + RATIO_97 = 3, + RATIO_98 = 4, + RATIO_99 = 5, + RATIO_99_9 = 6, + RATIO_99_99 = 7, + RATIO_99_999 = 8, + RATIO_99_9999 = 9, + } +} diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/OcspType.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/OcspType.aidl index 89de811b04302c5b5bc67122f7011a3629b921c3..d5ed08453783282918d6978450ba04ec4a3aedef 100644 --- a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/OcspType.aidl +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/OcspType.aidl @@ -34,8 +34,8 @@ package android.hardware.wifi.supplicant; @Backing(type="int") @VintfStability enum OcspType { - NONE = 0, - REQUEST_CERT_STATUS = 1, - REQUIRE_CERT_STATUS = 2, - REQUIRE_ALL_CERTS_STATUS = 3, + NONE, + REQUEST_CERT_STATUS, + REQUIRE_CERT_STATUS, + REQUIRE_ALL_CERTS_STATUS, } diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/P2pConnectInfo.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/P2pConnectInfo.aidl new file mode 100644 index 0000000000000000000000000000000000000000..f4662de122dbd8553e5cca2a61917d160f464665 --- /dev/null +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/P2pConnectInfo.aidl @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/////////////////////////////////////////////////////////////////////////////// +// THIS 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 -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.wifi.supplicant; +@VintfStability +parcelable P2pConnectInfo { + byte[6] peerAddress; + android.hardware.wifi.supplicant.WpsProvisionMethod provisionMethod; + String preSelectedPin; + boolean joinExistingGroup; + boolean persistent; + int goIntent; + @nullable android.hardware.wifi.common.OuiKeyedData[] vendorData; +} diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/P2pDeviceFoundEventParams.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/P2pDeviceFoundEventParams.aidl new file mode 100644 index 0000000000000000000000000000000000000000..ee8e6dc186b800efc7ed4f3bb589c3e2b522ca02 --- /dev/null +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/P2pDeviceFoundEventParams.aidl @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/////////////////////////////////////////////////////////////////////////////// +// THIS 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 -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.wifi.supplicant; +@VintfStability +parcelable P2pDeviceFoundEventParams { + byte[6] srcAddress; + byte[6] p2pDeviceAddress; + byte[] primaryDeviceType; + String deviceName; + int configMethods; + byte deviceCapabilities; + int groupCapabilities; + byte[] wfdDeviceInfo; + byte[] wfdR2DeviceInfo; + byte[] vendorElemBytes; + @nullable android.hardware.wifi.common.OuiKeyedData[] vendorData; +} diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/P2pDiscoveryInfo.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/P2pDiscoveryInfo.aidl new file mode 100644 index 0000000000000000000000000000000000000000..5b7dd3f043cd10833ce90d6485fcdfc8fe471a1c --- /dev/null +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/P2pDiscoveryInfo.aidl @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/////////////////////////////////////////////////////////////////////////////// +// THIS 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 -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.wifi.supplicant; +@VintfStability +parcelable P2pDiscoveryInfo { + android.hardware.wifi.supplicant.P2pScanType scanType; + int frequencyMhz; + int timeoutInSec; + @nullable android.hardware.wifi.common.OuiKeyedData[] vendorData; +} diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/P2pFrameTypeMask.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/P2pFrameTypeMask.aidl index 6e1b957941e3074548a032020906d8f7524e0854..3c6f8ed5edd71f2e43f33a7ad2b53e6fc16a4838 100644 --- a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/P2pFrameTypeMask.aidl +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/P2pFrameTypeMask.aidl @@ -34,17 +34,17 @@ package android.hardware.wifi.supplicant; @Backing(type="int") @VintfStability enum P2pFrameTypeMask { - P2P_FRAME_PROBE_REQ_P2P = 1, - P2P_FRAME_PROBE_RESP_P2P = 2, - P2P_FRAME_PROBE_RESP_P2P_GO = 4, - P2P_FRAME_BEACON_P2P_GO = 8, - P2P_FRAME_P2P_PD_REQ = 16, - P2P_FRAME_P2P_PD_RESP = 32, - P2P_FRAME_P2P_GO_NEG_REQ = 64, - P2P_FRAME_P2P_GO_NEG_RESP = 128, - P2P_FRAME_P2P_GO_NEG_CONF = 256, - P2P_FRAME_P2P_INV_REQ = 512, - P2P_FRAME_P2P_INV_RESP = 1024, - P2P_FRAME_P2P_ASSOC_REQ = 2048, - P2P_FRAME_P2P_ASSOC_RESP = 4096, + P2P_FRAME_PROBE_REQ_P2P = (1 << 0) /* 1 */, + P2P_FRAME_PROBE_RESP_P2P = (1 << 1) /* 2 */, + P2P_FRAME_PROBE_RESP_P2P_GO = (1 << 2) /* 4 */, + P2P_FRAME_BEACON_P2P_GO = (1 << 3) /* 8 */, + P2P_FRAME_P2P_PD_REQ = (1 << 4) /* 16 */, + P2P_FRAME_P2P_PD_RESP = (1 << 5) /* 32 */, + P2P_FRAME_P2P_GO_NEG_REQ = (1 << 6) /* 64 */, + P2P_FRAME_P2P_GO_NEG_RESP = (1 << 7) /* 128 */, + P2P_FRAME_P2P_GO_NEG_CONF = (1 << 8) /* 256 */, + P2P_FRAME_P2P_INV_REQ = (1 << 9) /* 512 */, + P2P_FRAME_P2P_INV_RESP = (1 << 10) /* 1024 */, + P2P_FRAME_P2P_ASSOC_REQ = (1 << 11) /* 2048 */, + P2P_FRAME_P2P_ASSOC_RESP = (1 << 12) /* 4096 */, } diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/P2pGroupCapabilityMask.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/P2pGroupCapabilityMask.aidl index ffee12c1bc60971abefd27a8f1dfbe6cf687a9ba..e47713182e5bf2f6b9dcc758a558d4e4df924643 100644 --- a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/P2pGroupCapabilityMask.aidl +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/P2pGroupCapabilityMask.aidl @@ -34,11 +34,11 @@ package android.hardware.wifi.supplicant; @Backing(type="int") @VintfStability enum P2pGroupCapabilityMask { - GROUP_OWNER = 1, - PERSISTENT_GROUP = 2, - GROUP_LIMIT = 4, - INTRA_BSS_DIST = 8, - CROSS_CONN = 16, - PERSISTENT_RECONN = 32, - GROUP_FORMATION = 64, + GROUP_OWNER = (1 << 0) /* 1 */, + PERSISTENT_GROUP = (1 << 1) /* 2 */, + GROUP_LIMIT = (1 << 2) /* 4 */, + INTRA_BSS_DIST = (1 << 3) /* 8 */, + CROSS_CONN = (1 << 4) /* 16 */, + PERSISTENT_RECONN = (1 << 5) /* 32 */, + GROUP_FORMATION = (1 << 6) /* 64 */, } diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/P2pGroupStartedEventParams.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/P2pGroupStartedEventParams.aidl index 5465a86b135e64899cdb3e618c30f544e3246044..e19ae4460d53c43a383ddf3070d558cc3766accd 100644 --- a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/P2pGroupStartedEventParams.aidl +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/P2pGroupStartedEventParams.aidl @@ -45,4 +45,5 @@ parcelable P2pGroupStartedEventParams { byte[6] goInterfaceAddress; boolean isP2pClientEapolIpAddressInfoPresent; android.hardware.wifi.supplicant.P2pClientEapolIpAddressInfo p2pClientIpInfo; + @nullable android.hardware.wifi.common.OuiKeyedData[] vendorData; } diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/P2pPeerClientDisconnectedEventParams.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/P2pPeerClientDisconnectedEventParams.aidl new file mode 100644 index 0000000000000000000000000000000000000000..5c7c393b4b0f8520df18340ef3f07942c0771d58 --- /dev/null +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/P2pPeerClientDisconnectedEventParams.aidl @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/////////////////////////////////////////////////////////////////////////////// +// THIS 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 -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.wifi.supplicant; +@VintfStability +parcelable P2pPeerClientDisconnectedEventParams { + String groupInterfaceName; + byte[6] clientInterfaceAddress; + byte[6] clientDeviceAddress; + @nullable android.hardware.wifi.common.OuiKeyedData[] vendorData; +} diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/P2pPeerClientJoinedEventParams.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/P2pPeerClientJoinedEventParams.aidl new file mode 100644 index 0000000000000000000000000000000000000000..40c8ff6d8a4e54c29934b361f7d07df8b5a68a08 --- /dev/null +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/P2pPeerClientJoinedEventParams.aidl @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/////////////////////////////////////////////////////////////////////////////// +// THIS 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 -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.wifi.supplicant; +@VintfStability +parcelable P2pPeerClientJoinedEventParams { + String groupInterfaceName; + byte[6] clientInterfaceAddress; + byte[6] clientDeviceAddress; + int clientIpAddress; + @nullable android.hardware.wifi.common.OuiKeyedData[] vendorData; +} diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/P2pProvisionDiscoveryCompletedEventParams.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/P2pProvisionDiscoveryCompletedEventParams.aidl new file mode 100644 index 0000000000000000000000000000000000000000..0ff06536b3469b9b8fc80669824f33163f389bfc --- /dev/null +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/P2pProvisionDiscoveryCompletedEventParams.aidl @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/////////////////////////////////////////////////////////////////////////////// +// THIS 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 -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.wifi.supplicant; +@VintfStability +parcelable P2pProvisionDiscoveryCompletedEventParams { + byte[6] p2pDeviceAddress; + boolean isRequest; + android.hardware.wifi.supplicant.P2pProvDiscStatusCode status; + android.hardware.wifi.supplicant.WpsConfigMethods configMethods; + String generatedPin; + String groupInterfaceName; + @nullable android.hardware.wifi.common.OuiKeyedData[] vendorData; +} diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/P2pScanType.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/P2pScanType.aidl new file mode 100644 index 0000000000000000000000000000000000000000..ff3efd20639d75b67d96cf676b000b73f647a95e --- /dev/null +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/P2pScanType.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/////////////////////////////////////////////////////////////////////////////// +// THIS 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 -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.wifi.supplicant; +@Backing(type="int") @VintfStability +enum P2pScanType { + FULL, + SOCIAL, + SPECIFIC_FREQ, +} diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/PairwiseCipherMask.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/PairwiseCipherMask.aidl index d9b00e1261dea55580acf7e34f6793f2dafac0c0..a4c7b6065be00418c690c8c143253feb06686722 100644 --- a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/PairwiseCipherMask.aidl +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/PairwiseCipherMask.aidl @@ -34,10 +34,10 @@ package android.hardware.wifi.supplicant; @Backing(type="int") @VintfStability enum PairwiseCipherMask { - NONE = 1, - TKIP = 8, - CCMP = 16, - GCMP_128 = 64, - SMS4 = 128, - GCMP_256 = 256, + NONE = (1 << 0) /* 1 */, + TKIP = (1 << 3) /* 8 */, + CCMP = (1 << 4) /* 16 */, + GCMP_128 = (1 << 6) /* 64 */, + SMS4 = (1 << 7) /* 128 */, + GCMP_256 = (1 << 8) /* 256 */, } diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ProtoMask.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ProtoMask.aidl index de9242835ea13bb8b2accbb59f74eb0a41faca59..ba79025fa1158e778871ad9ff8214bb73daff16d 100644 --- a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ProtoMask.aidl +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ProtoMask.aidl @@ -34,8 +34,8 @@ package android.hardware.wifi.supplicant; @Backing(type="int") @VintfStability enum ProtoMask { - WPA = 1, - RSN = 2, - WAPI = 4, - OSEN = 8, + WPA = (1 << 0) /* 1 */, + RSN = (1 << 1) /* 2 */, + WAPI = (1 << 2) /* 4 */, + OSEN = (1 << 3) /* 8 */, } diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/QosCharacteristics.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/QosCharacteristics.aidl new file mode 100644 index 0000000000000000000000000000000000000000..dacac8c49a1acb7799c3dcd03144d1fd6b5f2a8c --- /dev/null +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/QosCharacteristics.aidl @@ -0,0 +1,59 @@ +/* + * Copyright (C) 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/////////////////////////////////////////////////////////////////////////////// +// THIS 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 -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.wifi.supplicant; +@VintfStability +parcelable QosCharacteristics { + int minServiceIntervalUs; + int maxServiceIntervalUs; + int minDataRateKbps; + int delayBoundUs; + int optionalFieldMask; + char maxMsduSizeOctets; + int serviceStartTimeUs; + byte serviceStartTimeLinkId; + int meanDataRateKbps; + int burstSizeOctets; + char msduLifetimeMs; + android.hardware.wifi.supplicant.MsduDeliveryInfo msduDeliveryInfo; + @Backing(type="int") @VintfStability + enum QosCharacteristicsMask { + MAX_MSDU_SIZE = (1 << 0) /* 1 */, + SERVICE_START_TIME = (1 << 1) /* 2 */, + SERVICE_START_TIME_LINK_ID = (1 << 2) /* 4 */, + MEAN_DATA_RATE = (1 << 3) /* 8 */, + BURST_SIZE = (1 << 4) /* 16 */, + MSDU_LIFETIME = (1 << 5) /* 32 */, + MSDU_DELIVERY_INFO = (1 << 6) /* 64 */, + } +} diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/QosPolicyClassifierParamsMask.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/QosPolicyClassifierParamsMask.aidl index 9c0c0b65fb90765d6c8af2a1eb44e0728a5a7567..fda5e3ef673d035ac09a45537533871bbb7d30db 100644 --- a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/QosPolicyClassifierParamsMask.aidl +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/QosPolicyClassifierParamsMask.aidl @@ -34,12 +34,12 @@ package android.hardware.wifi.supplicant; @Backing(type="int") @VintfStability enum QosPolicyClassifierParamsMask { - SRC_IP = 1, - DST_IP = 2, - SRC_PORT = 4, - DST_PORT_RANGE = 8, - PROTOCOL_NEXT_HEADER = 16, - FLOW_LABEL = 32, - DOMAIN_NAME = 64, - DSCP = 128, + SRC_IP = (1 << 0) /* 1 */, + DST_IP = (1 << 1) /* 2 */, + SRC_PORT = (1 << 2) /* 4 */, + DST_PORT_RANGE = (1 << 3) /* 8 */, + PROTOCOL_NEXT_HEADER = (1 << 4) /* 16 */, + FLOW_LABEL = (1 << 5) /* 32 */, + DOMAIN_NAME = (1 << 6) /* 64 */, + DSCP = (1 << 7) /* 128 */, } diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/QosPolicyRequestType.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/QosPolicyRequestType.aidl index 4c1e4fad5b3ffdb8d3a80e2b0b6efeced82973c1..fd4e787d9e2e1b0508dcf50a70a0391f7b12f30b 100644 --- a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/QosPolicyRequestType.aidl +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/QosPolicyRequestType.aidl @@ -34,6 +34,6 @@ package android.hardware.wifi.supplicant; @Backing(type="byte") @VintfStability enum QosPolicyRequestType { - QOS_POLICY_ADD = 0, - QOS_POLICY_REMOVE = 1, + QOS_POLICY_ADD, + QOS_POLICY_REMOVE, } diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/QosPolicyScsData.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/QosPolicyScsData.aidl index 4e5e8ae9614213a547428951e900c1ac246329e6..20be616fbb986327d6847fa5e82fe4c91e309074 100644 --- a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/QosPolicyScsData.aidl +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/QosPolicyScsData.aidl @@ -22,4 +22,11 @@ parcelable QosPolicyScsData { byte policyId; byte userPriority; android.hardware.wifi.supplicant.QosPolicyClassifierParams classifierParams; + android.hardware.wifi.supplicant.QosPolicyScsData.LinkDirection direction; + @nullable android.hardware.wifi.supplicant.QosCharacteristics QosCharacteristics; + @Backing(type="byte") @VintfStability + enum LinkDirection { + DOWNLINK, + UPLINK, + } } diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/QosPolicyScsRequestStatusCode.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/QosPolicyScsRequestStatusCode.aidl index 4d815665d7e56054439c32db00f0e0427a459e90..8e0467f75a004a19ce618829308a67b4667024b1 100644 --- a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/QosPolicyScsRequestStatusCode.aidl +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/QosPolicyScsRequestStatusCode.aidl @@ -19,8 +19,8 @@ package android.hardware.wifi.supplicant; @Backing(type="int") @VintfStability enum QosPolicyScsRequestStatusCode { - SENT = 0, - ALREADY_ACTIVE = 1, - NOT_EXIST = 2, - INVALID = 3, + SENT, + ALREADY_ACTIVE, + NOT_EXIST, + INVALID, } diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/QosPolicyScsResponseStatusCode.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/QosPolicyScsResponseStatusCode.aidl index 693d3e0ac03dc292689fdd29c40b75e05c422240..5d460c69c57cb54e8f60bde0fb33ad7309eb11aa 100644 --- a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/QosPolicyScsResponseStatusCode.aidl +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/QosPolicyScsResponseStatusCode.aidl @@ -19,13 +19,13 @@ package android.hardware.wifi.supplicant; @Backing(type="int") @VintfStability enum QosPolicyScsResponseStatusCode { - SUCCESS = 0, - TCLAS_REQUEST_DECLINED = 1, - TCLAS_NOT_SUPPORTED_BY_AP = 2, - TCLAS_INSUFFICIENT_RESOURCES = 3, - TCLAS_RESOURCES_EXHAUSTED = 4, - TCLAS_PROCESSING_TERMINATED_INSUFFICIENT_QOS = 5, - TCLAS_PROCESSING_TERMINATED_POLICY_CONFLICT = 6, - TCLAS_PROCESSING_TERMINATED = 7, - TIMEOUT = 8, + SUCCESS, + TCLAS_REQUEST_DECLINED, + TCLAS_NOT_SUPPORTED_BY_AP, + TCLAS_INSUFFICIENT_RESOURCES, + TCLAS_RESOURCES_EXHAUSTED, + TCLAS_PROCESSING_TERMINATED_INSUFFICIENT_QOS, + TCLAS_PROCESSING_TERMINATED_POLICY_CONFLICT, + TCLAS_PROCESSING_TERMINATED, + TIMEOUT, } diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/QosPolicyStatusCode.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/QosPolicyStatusCode.aidl index 4d40edcc17bf9c3c5367488dbe1ced4aa0ee736b..92286325c8374b1a390c0d4aa06df4c40031262c 100644 --- a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/QosPolicyStatusCode.aidl +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/QosPolicyStatusCode.aidl @@ -34,8 +34,8 @@ package android.hardware.wifi.supplicant; @Backing(type="byte") @VintfStability enum QosPolicyStatusCode { - QOS_POLICY_SUCCESS = 0, - QOS_POLICY_REQUEST_DECLINED = 1, - QOS_POLICY_CLASSIFIER_NOT_SUPPORTED = 2, - QOS_POLICY_INSUFFICIENT_RESOURCES = 3, + QOS_POLICY_SUCCESS, + QOS_POLICY_REQUEST_DECLINED, + QOS_POLICY_CLASSIFIER_NOT_SUPPORTED, + QOS_POLICY_INSUFFICIENT_RESOURCES, } diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/SaeH2eMode.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/SaeH2eMode.aidl index 978c3375f7d257d993e846fc33a3dce8809d4117..4730d72c0437eb61b01f0515ff7ab16db32a5b11 100644 --- a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/SaeH2eMode.aidl +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/SaeH2eMode.aidl @@ -34,7 +34,7 @@ package android.hardware.wifi.supplicant; @Backing(type="byte") @VintfStability enum SaeH2eMode { - DISABLED = 0, - H2E_OPTIONAL = 1, - H2E_MANDATORY = 2, + DISABLED, + H2E_OPTIONAL, + H2E_MANDATORY, } diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/SupplicantStatusCode.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/SupplicantStatusCode.aidl index d84ff953001fec0a315b1fb7625be8aee3e16eb8..d7ff7982b54cb8d87dff3a8579004a1c9d8dd472 100644 --- a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/SupplicantStatusCode.aidl +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/SupplicantStatusCode.aidl @@ -34,16 +34,16 @@ package android.hardware.wifi.supplicant; @Backing(type="int") @VintfStability enum SupplicantStatusCode { - SUCCESS = 0, - FAILURE_UNKNOWN = 1, - FAILURE_ARGS_INVALID = 2, - FAILURE_IFACE_INVALID = 3, - FAILURE_IFACE_UNKNOWN = 4, - FAILURE_IFACE_EXISTS = 5, - FAILURE_IFACE_DISABLED = 6, - FAILURE_IFACE_NOT_DISCONNECTED = 7, - FAILURE_NETWORK_INVALID = 8, - FAILURE_NETWORK_UNKNOWN = 9, - FAILURE_UNSUPPORTED = 10, - FAILURE_ONGOING_REQUEST = 11, + SUCCESS, + FAILURE_UNKNOWN, + FAILURE_ARGS_INVALID, + FAILURE_IFACE_INVALID, + FAILURE_IFACE_UNKNOWN, + FAILURE_IFACE_EXISTS, + FAILURE_IFACE_DISABLED, + FAILURE_IFACE_NOT_DISCONNECTED, + FAILURE_NETWORK_INVALID, + FAILURE_NETWORK_UNKNOWN, + FAILURE_UNSUPPORTED, + FAILURE_ONGOING_REQUEST, } diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/TlsVersion.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/TlsVersion.aidl index 22a374fecec9f2d6a4e81e514a3519308c9962a2..b31826a1989ed775a057002a746d7a3c964d255e 100644 --- a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/TlsVersion.aidl +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/TlsVersion.aidl @@ -34,8 +34,8 @@ package android.hardware.wifi.supplicant; @Backing(type="int") @VintfStability enum TlsVersion { - TLS_V1_0 = 0, - TLS_V1_1 = 1, - TLS_V1_2 = 2, - TLS_V1_3 = 3, + TLS_V1_0, + TLS_V1_1, + TLS_V1_2, + TLS_V1_3, } diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/TransitionDisableIndication.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/TransitionDisableIndication.aidl index 7c6321782abc25f5f52019ebbb1c3729474fa6cc..f1d7370c76eabf5a1f63e4446300843ae61842ec 100644 --- a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/TransitionDisableIndication.aidl +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/TransitionDisableIndication.aidl @@ -34,8 +34,8 @@ package android.hardware.wifi.supplicant; @Backing(type="int") @VintfStability enum TransitionDisableIndication { - USE_WPA3_PERSONAL = 1, - USE_SAE_PK = 2, - USE_WPA3_ENTERPRISE = 4, - USE_ENHANCED_OPEN = 8, + USE_WPA3_PERSONAL = (1 << 0) /* 1 */, + USE_SAE_PK = (1 << 1) /* 2 */, + USE_WPA3_ENTERPRISE = (1 << 2) /* 4 */, + USE_ENHANCED_OPEN = (1 << 3) /* 8 */, } diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/WpaDriverCapabilitiesMask.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/WpaDriverCapabilitiesMask.aidl index 32e15104875c380096f7712afb754fed19fdb9da..330f2aa267eede742c399c4bfea05702440b4d52 100644 --- a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/WpaDriverCapabilitiesMask.aidl +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/WpaDriverCapabilitiesMask.aidl @@ -34,11 +34,11 @@ package android.hardware.wifi.supplicant; @Backing(type="int") @VintfStability enum WpaDriverCapabilitiesMask { - MBO = 1, - OCE = 2, - SAE_PK = 4, - WFD_R2 = 8, - TRUST_ON_FIRST_USE = 16, - SET_TLS_MINIMUM_VERSION = 32, - TLS_V1_3 = 64, + MBO = (1 << 0) /* 1 */, + OCE = (1 << 1) /* 2 */, + SAE_PK = (1 << 2) /* 4 */, + WFD_R2 = (1 << 3) /* 8 */, + TRUST_ON_FIRST_USE = (1 << 4) /* 16 */, + SET_TLS_MINIMUM_VERSION = (1 << 5) /* 32 */, + TLS_V1_3 = (1 << 6) /* 64 */, } diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/WpsConfigMethods.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/WpsConfigMethods.aidl index c98c479b4aa38b45f65f0168d18e97a7c54be199..b9ea211bb4db735431abcc310735a0238765e19f 100644 --- a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/WpsConfigMethods.aidl +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/WpsConfigMethods.aidl @@ -34,18 +34,18 @@ package android.hardware.wifi.supplicant; @Backing(type="int") @VintfStability enum WpsConfigMethods { - USBA = 1, - ETHERNET = 2, - LABEL = 4, - DISPLAY = 8, - EXT_NFC_TOKEN = 16, - INT_NFC_TOKEN = 32, - NFC_INTERFACE = 64, - PUSHBUTTON = 128, - KEYPAD = 256, - VIRT_PUSHBUTTON = 640, - PHY_PUSHBUTTON = 1152, - P2PS = 4096, - VIRT_DISPLAY = 8200, - PHY_DISPLAY = 16392, + USBA = 0x0001, + ETHERNET = 0x0002, + LABEL = 0x0004, + DISPLAY = 0x0008, + EXT_NFC_TOKEN = 0x0010, + INT_NFC_TOKEN = 0x0020, + NFC_INTERFACE = 0x0040, + PUSHBUTTON = 0x0080, + KEYPAD = 0x0100, + VIRT_PUSHBUTTON = 0x0280, + PHY_PUSHBUTTON = 0x0480, + P2PS = 0x1000, + VIRT_DISPLAY = 0x2008, + PHY_DISPLAY = 0x4008, } diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/WpsDevPasswordId.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/WpsDevPasswordId.aidl index 975f1ab3fbe01dab3f575bd95ffc9b2ffb017dd4..9a20187b6e8c06293ffbe33d1ece471f9c2a9ae9 100644 --- a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/WpsDevPasswordId.aidl +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/WpsDevPasswordId.aidl @@ -34,12 +34,12 @@ package android.hardware.wifi.supplicant; @Backing(type="int") @VintfStability enum WpsDevPasswordId { - DEFAULT = 0, - USER_SPECIFIED = 1, - MACHINE_SPECIFIED = 2, - REKEY = 3, - PUSHBUTTON = 4, - REGISTRAR_SPECIFIED = 5, - NFC_CONNECTION_HANDOVER = 7, - P2PS_DEFAULT = 8, + DEFAULT = 0x0000, + USER_SPECIFIED = 0x0001, + MACHINE_SPECIFIED = 0x0002, + REKEY = 0x0003, + PUSHBUTTON = 0x0004, + REGISTRAR_SPECIFIED = 0x0005, + NFC_CONNECTION_HANDOVER = 0x0007, + P2PS_DEFAULT = 0x0008, } diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/WpsProvisionMethod.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/WpsProvisionMethod.aidl index f6dba234d4d48b6ce36443c6d537c2df48d5b6ec..177d218db3801bfb71b4264dd522e03d3f1c7dd0 100644 --- a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/WpsProvisionMethod.aidl +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/WpsProvisionMethod.aidl @@ -34,7 +34,7 @@ package android.hardware.wifi.supplicant; @Backing(type="int") @VintfStability enum WpsProvisionMethod { - PBC = 0, - DISPLAY = 1, - KEYPAD = 2, + PBC, + DISPLAY, + KEYPAD, } diff --git a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ConnectionCapabilities.aidl b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ConnectionCapabilities.aidl index 4921a672b3bd0a35287f6fc9aaba53b84344fc3a..64a515f7fe40c3a632d7973e4dae71a284d270d7 100644 --- a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ConnectionCapabilities.aidl +++ b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ConnectionCapabilities.aidl @@ -16,6 +16,7 @@ package android.hardware.wifi.supplicant; +import android.hardware.wifi.common.OuiKeyedData; import android.hardware.wifi.supplicant.LegacyMode; import android.hardware.wifi.supplicant.WifiTechnology; @@ -48,4 +49,9 @@ parcelable ConnectionCapabilities { * Indicates the AP support for TID-to-link mapping negotiation. */ boolean apTidToLinkMapNegotiationSupported; + /** + * Additional vendor-specific data. Null value indicates + * that no vendor data is provided. + */ + @nullable OuiKeyedData[] vendorData; } diff --git a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantP2pIface.aidl b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantP2pIface.aidl index e58422c8ea28021988285991c37d28debde316fd..983ed154a4df83fc71c43ae988eba3f232dcf1e7 100644 --- a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantP2pIface.aidl +++ b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantP2pIface.aidl @@ -16,11 +16,14 @@ package android.hardware.wifi.supplicant; +import android.hardware.wifi.common.OuiKeyedData; import android.hardware.wifi.supplicant.FreqRange; import android.hardware.wifi.supplicant.ISupplicantP2pIfaceCallback; import android.hardware.wifi.supplicant.ISupplicantP2pNetwork; import android.hardware.wifi.supplicant.IfaceType; import android.hardware.wifi.supplicant.MiracastMode; +import android.hardware.wifi.supplicant.P2pConnectInfo; +import android.hardware.wifi.supplicant.P2pDiscoveryInfo; import android.hardware.wifi.supplicant.P2pFrameTypeMask; import android.hardware.wifi.supplicant.P2pGroupCapabilityMask; import android.hardware.wifi.supplicant.WpsConfigMethods; @@ -176,6 +179,9 @@ interface ISupplicantP2pIface { * Start P2P group formation with a discovered P2P peer. This includes * optional group owner negotiation, group interface setup, provisioning, * and establishing data connection. + *

      + * @deprecated This method is deprecated from AIDL v3, newer HALs should use + * connectWithParams. * * @param peerAddress MAC address of the device to connect to. * @param provisionMethod Provisioning method to use. @@ -236,6 +242,9 @@ interface ISupplicantP2pIface { /** * Initiate a P2P service discovery with an optional timeout. + *

      + * @deprecated This method is deprecated from AIDL v3, newer HALs should use + * findWithParams. * * @param timeoutInSec Max time to be spent is performing discovery. * Set to 0 to indefinitely continue discovery until an explicit @@ -782,8 +791,9 @@ interface ISupplicantP2pIface { /** * Initiate a P2P device discovery only on social channels. - * - * Full P2P discovery is performed through |ISupplicantP2pIface.find| method. + *

      + * @deprecated This method is deprecated from AIDL v3, newer HALs should use + * findWithParams. * * @param timeoutInSec The maximum amount of time that should be spent in performing device * discovery. @@ -798,8 +808,9 @@ interface ISupplicantP2pIface { /** * Initiate a P2P device discovery on a specific frequency. - * - * Full P2P discovery is performed through |ISupplicantP2pIface.find| method. + *

      + * @deprecated This method is deprecated from AIDL v3, newer HALs should use + * findWithParams. * * @param freqInHz the frequency to be scanned. * @param timeoutInSec Max time to be spent is performing discovery. @@ -845,4 +856,30 @@ interface ISupplicantP2pIface { */ void configureEapolIpAddressAllocationParams( in int ipAddressGo, in int ipAddressMask, in int ipAddressStart, in int ipAddressEnd); + + /** + * Start P2P group formation with a discovered P2P peer. This includes + * optional group owner negotiation, group interface setup, provisioning, + * and establishing data connection. + * + * @param connectInfo Parameters associated with this connection request. + * @return Pin generated, if |provisionMethod| uses one of the + * generated |PIN*| methods. + * @throws ServiceSpecificException with one of the following values: + * |SupplicantStatusCode.FAILURE_ARGS_INVALID|, + * |SupplicantStatusCode.FAILURE_UNKNOWN|, + * |SupplicantStatusCode.FAILURE_IFACE_INVALID| + */ + String connectWithParams(in P2pConnectInfo connectInfo); + + /** + * Initiate a P2P service discovery with an optional timeout. + * + * @param discoveryInfo Parameters associated with this discovery request. + * @throws ServiceSpecificException with one of the following values: + * |SupplicantStatusCode.FAILURE_UNKNOWN|, + * |SupplicantStatusCode.FAILURE_IFACE_INVALID| + * |SupplicantStatusCode.FAILURE_IFACE_DISABLED| + */ + void findWithParams(in P2pDiscoveryInfo discoveryInfo); } diff --git a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantP2pIfaceCallback.aidl b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantP2pIfaceCallback.aidl index 9d6fa678b8662ff0ef420f8208fba106737ef2a8..11cd86793393cecb8a5bbf70d03ef4cc7279d15e 100644 --- a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantP2pIfaceCallback.aidl +++ b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantP2pIfaceCallback.aidl @@ -16,9 +16,13 @@ package android.hardware.wifi.supplicant; +import android.hardware.wifi.supplicant.P2pDeviceFoundEventParams; import android.hardware.wifi.supplicant.P2pGroupCapabilityMask; import android.hardware.wifi.supplicant.P2pGroupStartedEventParams; +import android.hardware.wifi.supplicant.P2pPeerClientDisconnectedEventParams; +import android.hardware.wifi.supplicant.P2pPeerClientJoinedEventParams; import android.hardware.wifi.supplicant.P2pProvDiscStatusCode; +import android.hardware.wifi.supplicant.P2pProvisionDiscoveryCompletedEventParams; import android.hardware.wifi.supplicant.P2pStatusCode; import android.hardware.wifi.supplicant.WpsConfigMethods; import android.hardware.wifi.supplicant.WpsDevPasswordId; @@ -35,6 +39,9 @@ import android.hardware.wifi.supplicant.WpsDevPasswordId; oneway interface ISupplicantP2pIfaceCallback { /** * Used to indicate that a P2P device has been found. + *

      + * @deprecated This callback is deprecated from AIDL v2, newer HAL should call + * onDeviceFoundWithParams. * * @param srcAddress MAC address of the device found. This must either * be the P2P device address or the P2P interface address. @@ -142,6 +149,9 @@ oneway interface ISupplicantP2pIfaceCallback { /** * Used to indicate the completion of a P2P provision discovery request. + *

      + * @deprecated This callback is deprecated from AIDL v3, newer HAL should call + * onProvisionDiscoveryCompletedEvent. * * @param p2pDeviceAddress P2P device address. * @param isRequest Whether we received or sent the provision discovery. @@ -192,6 +202,9 @@ oneway interface ISupplicantP2pIfaceCallback { /** * Used to indicate when a STA device is connected to this device. + *

      + * @deprecated This callback is deprecated from AIDL v3, newer HAL should call + * onPeerClientJoined() * * @param srcAddress MAC address of the device that was authorized. * @param p2pDeviceAddress P2P device address. @@ -200,6 +213,9 @@ oneway interface ISupplicantP2pIfaceCallback { /** * Used to indicate when a STA device is disconnected from this device. + *

      + * @deprecated This callback is deprecated from AIDL v3, newer HAL should call + * onPeerClientDisconnected() * * @param srcAddress MAC address of the device that was deauthorized. * @param p2pDeviceAddress P2P device address. @@ -216,6 +232,9 @@ oneway interface ISupplicantP2pIfaceCallback { /** * Used to indicate that a P2P device has been found. + *

      + * @deprecated This callback is deprecated from AIDL v3, newer HAL should call + * onDeviceFoundWithParams. * * @param srcAddress MAC address of the device found. This must either * be the P2P device address for a peer which is not in a group, @@ -251,4 +270,36 @@ oneway interface ISupplicantP2pIfaceCallback { * @param groupStartedEventParams Parameters describing the P2P group. */ void onGroupStartedWithParams(in P2pGroupStartedEventParams groupStartedEventParams); + + /** + * Used to indicate that a P2P client has joined this device group owner. + * + * @param clientJoinedEventParams Parameters associated with peer client joined event. + */ + void onPeerClientJoined(in P2pPeerClientJoinedEventParams clientJoinedEventParams); + + /** + * Used to indicate that a P2P client has disconnected from this device group owner. + * + * @param clientDisconnectedEventParams Parameters associated with peer client disconnected + * event. + */ + void onPeerClientDisconnected( + in P2pPeerClientDisconnectedEventParams clientDisconnectedEventParams); + + /** + * Used to indicate the completion of a P2P provision discovery request. + * + * @param provisionDiscoveryCompletedEventParams Parameters associated with + * P2P provision discovery frame notification. + */ + void onProvisionDiscoveryCompletedEvent( + in P2pProvisionDiscoveryCompletedEventParams provisionDiscoveryCompletedEventParams); + + /** + * Used to indicate that a P2P device has been found. + * + * @param deviceFoundEventParams Parameters associated with the device found event. + */ + void onDeviceFoundWithParams(in P2pDeviceFoundEventParams deviceFoundEventParams); } diff --git a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantStaIface.aidl b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantStaIface.aidl index 06ab8fb2181d057e617e4040683a899b7553efba..fb1673efc3c878ff852793f07883b343d7520774 100644 --- a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantStaIface.aidl +++ b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantStaIface.aidl @@ -29,6 +29,7 @@ import android.hardware.wifi.supplicant.ISupplicantStaNetwork; import android.hardware.wifi.supplicant.IfaceType; import android.hardware.wifi.supplicant.KeyMgmtMask; import android.hardware.wifi.supplicant.MloLinksInfo; +import android.hardware.wifi.supplicant.MscsParams; import android.hardware.wifi.supplicant.QosPolicyScsData; import android.hardware.wifi.supplicant.QosPolicyScsRequestStatus; import android.hardware.wifi.supplicant.QosPolicyStatus; @@ -304,6 +305,8 @@ interface ISupplicantStaIface { * The icon data fetched must be returned in the * |ISupplicantStaIfaceCallback.onHs20IconQueryDone| callback. * + * @deprecated No longer in use. + * * @param macAddress MAC address of the access point. * @param fileName Name of the file to request from the access point. * @throws ServiceSpecificException with one of the following values: @@ -850,4 +853,28 @@ interface ISupplicantStaIface { * being processed. Supplicant will only handle one request at a time. */ QosPolicyScsRequestStatus[] removeQosPolicyForScs(in byte[] scsPolicyIds); + + /** + * Enable Mirrored Stream Classification Service (MSCS) and configure using + * the provided configuration values. + * + * If MSCS has already been enabled/configured, this will overwrite the + * existing configuration. + * + * @param params |MscsParams| object containing the configuration. + * @throws ServiceSpecificException with one of the following values: + * |SupplicantStatusCode.FAILURE_ARGS_INVALID| if the configuration is invalid. + * |SupplicantStatusCode.FAILURE_UNKNOWN| if the configuration could not be set. + */ + void configureMscs(in MscsParams params); + + /** + * Disable Mirrored Stream Classification Service (MSCS). + * + * If MSCS is enabled/configured, this will send a remove request to the AP. + * + * @throws ServiceSpecificException with one of the following values: + * |SupplicantStatusCode.FAILURE_UNKNOWN| + */ + void disableMscs(); } diff --git a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantStaIfaceCallback.aidl b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantStaIfaceCallback.aidl index 17a220ddf5e0325eb1d0ab0754ab04bbe3371fa7..58893ebf669f1d75c1550347dd29d2bcd40ca60f 100644 --- a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantStaIfaceCallback.aidl +++ b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantStaIfaceCallback.aidl @@ -198,6 +198,8 @@ oneway interface ISupplicantStaIfaceCallback { /** * Used to indicate the result of Hotspot 2.0 Icon query. * + * @deprecated No longer in use. + * * @param bssid BSSID of the access point. * @param fileName Name of the file that was requested. * @param data Icon data fetched from the access point. diff --git a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantStaNetwork.aidl b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantStaNetwork.aidl index 750cf721e4e6c032d0ff1d436414509dd474633f..fc7babfb11f5a7d158fae8815540795ab2bfb79c 100644 --- a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantStaNetwork.aidl +++ b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantStaNetwork.aidl @@ -16,6 +16,7 @@ package android.hardware.wifi.supplicant; +import android.hardware.wifi.common.OuiKeyedData; import android.hardware.wifi.supplicant.AuthAlgMask; import android.hardware.wifi.supplicant.DppConnectionKeys; import android.hardware.wifi.supplicant.EapMethod; @@ -1141,4 +1142,27 @@ interface ISupplicantStaNetwork { * |SupplicantStatusCode.FAILURE_NETWORK_INVALID| */ void setStrictConservativePeerMode(in boolean enable); + + /** + * Disables Extremely High Throughput (EHT) mode, aka Wi-Fi 7 support, for the network. When + * EHT is disabled, the device ceases to transmit EHT related Information Elements (IEs), + * including multi-link IEs and EHT capability, in subsequent messages such as (Re)Association + * requests to the Access Point (AP). + * + * @throws ServiceSpecificException with one of the following values: + * |SupplicantStatusCode.FAILURE_UNKNOWN|, + * |SupplicantStatusCode.FAILURE_NETWORK_INVALID| + */ + void disableEht(); + + /** + * Set additional vendor-provided configuration data. + * + * @param vendorData List of |OuiKeyedData| containing the vendor-provided + * configuration data. + * @throws ServiceSpecificException with one of the following values: + * |SupplicantStatusCode.FAILURE_UNKNOWN|, + * |SupplicantStatusCode.FAILURE_NETWORK_INVALID| + */ + void setVendorData(in OuiKeyedData[] vendorData); } diff --git a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/MscsParams.aidl b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/MscsParams.aidl new file mode 100644 index 0000000000000000000000000000000000000000..b1731ac429d0644edbf2e4716efbf06f6c38baa2 --- /dev/null +++ b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/MscsParams.aidl @@ -0,0 +1,66 @@ +/* + * Copyright (C) 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.hardware.wifi.supplicant; + +/** + * Mirrored Stream Classification Service (MSCS) parameters. + * Refer to section 3.1 of the Wi-Fi QoS Management Specification v3.0. + */ +@VintfStability +parcelable MscsParams { + /** + * Bitmap indicating which User Priorities should be classified using MSCS. + * The least significant bit corresponds to UP 0, and the most significant + * bit to UP 7. Setting a bit to 1 indicates that UP should be used. + */ + byte upBitmap; + + /** + * Maximum user priority that can be assigned using the MSCS service. + * Value must be between 0 and 7 (inclusive). + */ + byte upLimit; + + /** + * Stream timeout in μs. Must be equivalent to 60 sec or less. + */ + int streamTimeoutUs; + + /** + * Bitmask of available fields for a Type 4 TCLAS frame classifier. + * See Figures 9-309 and 9-310 in the IEEE Std 802.11-2020 Standard. + */ + @VintfStability + @Backing(type="int") + enum FrameClassifierFields { + IP_VERSION = 1 << 0, + SRC_IP_ADDR = 1 << 1, + DST_IP_ADDR = 1 << 2, + SRC_PORT = 1 << 3, + DST_PORT = 1 << 4, + DSCP = 1 << 5, + /** Indicates Protocol if using IPv4, or Next Header if using IPv6. */ + PROTOCOL_NEXT_HDR = 1 << 6, + /** Only applicable if using IPv6. */ + FLOW_LABEL = 1 << 7, + } + + /** + * Bitmask of |FrameClassifierFields| for a Type 4 TCLAS frame classifier. + */ + byte frameClassifierMask; +} diff --git a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/MsduDeliveryInfo.aidl b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/MsduDeliveryInfo.aidl new file mode 100644 index 0000000000000000000000000000000000000000..8065f63b8547cec8218c76dea30e834202046ecb --- /dev/null +++ b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/MsduDeliveryInfo.aidl @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.hardware.wifi.supplicant; + +/** + * MSDU delivery information. + * See Section 9.4.2.316 of the IEEE P802.11be/D4.0 Standard. + */ +@VintfStability +parcelable MsduDeliveryInfo { + /** + * Enums for the |deliveryRatio| field. + * See Table 9-404t of the IEEE P802.11be/D4.0 Standard. + */ + @VintfStability + @Backing(type="byte") + enum DeliveryRatio { + RATIO_95 = 1, // 95% + RATIO_96 = 2, // 96% + RATIO_97 = 3, // 97% + RATIO_98 = 4, // 98% + RATIO_99 = 5, // 99% + RATIO_99_9 = 6, // 99.9% + RATIO_99_99 = 7, // 99.99% + RATIO_99_999 = 8, // 99.999% + RATIO_99_9999 = 9, // 99.9999% + } + + /** + * Percentage of the MSDUs that are expected to be delivered successfully. + */ + DeliveryRatio deliveryRatio; + + /** + * Exponent from which the number of incoming MSDUs is computed. The number of incoming + * MSDUs is 10^countExponent, and is used to determine the MSDU delivery ratio. + * Must be a number between 0 and 15 (inclusive). + */ + byte countExponent; +} diff --git a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/P2pConnectInfo.aidl b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/P2pConnectInfo.aidl new file mode 100644 index 0000000000000000000000000000000000000000..f09b476392ad2abb9c20b34cff04b849ed636de6 --- /dev/null +++ b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/P2pConnectInfo.aidl @@ -0,0 +1,68 @@ +/* + * Copyright (C) 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.hardware.wifi.supplicant; + +import android.hardware.wifi.common.OuiKeyedData; +import android.hardware.wifi.supplicant.WpsProvisionMethod; + +/** + * Request parameters used for |ISupplicantP2pIface.connectWithParams| + */ +@VintfStability +parcelable P2pConnectInfo { + /** + * MAC address of the device to connect to. + */ + byte[6] peerAddress; + + /** + * Provisioning method to use. + */ + WpsProvisionMethod provisionMethod; + + /** + * Pin to be used, if |provisionMethod| uses one of the + * preselected |PIN*| methods. + */ + String preSelectedPin; + + /** + * Indicates that this is a command to join an existing group as a client. + * This means that the group owner negotiation step can be skipped. + * This must send a Provision Discovery Request message to the + * target group owner before associating for WPS provisioning. + */ + boolean joinExistingGroup; + + /** + * Used to request a persistent group to be formed. + */ + boolean persistent; + + /** + * Used to override the default Intent for this group owner + * negotiation (Values from 1-15). Refer to section 4.1.6 in + * Wi-Fi Peer-to-Peer (P2P) Technical Specification Version 1.7. + */ + int goIntent; + + /** + * Optional vendor-specific parameters. Null value indicates + * that no vendor data is provided. + */ + @nullable OuiKeyedData[] vendorData; +} diff --git a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/P2pDeviceFoundEventParams.aidl b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/P2pDeviceFoundEventParams.aidl new file mode 100644 index 0000000000000000000000000000000000000000..15917b6419cd3bd91364cbefb4ea07e92b699e0f --- /dev/null +++ b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/P2pDeviceFoundEventParams.aidl @@ -0,0 +1,92 @@ +/* + * Copyright (C) 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.hardware.wifi.supplicant; + +import android.hardware.wifi.common.OuiKeyedData; + +/** + * Parameters passed as a part of a P2P Device found event. + */ +@VintfStability +parcelable P2pDeviceFoundEventParams { + /** + * MAC address of the device found. This must either be the P2P device address + * for a peer which is not in a group, or the P2P interface address for + * a peer which is a Group Owner. + */ + byte[6] srcAddress; + + /** + * P2P device address. + */ + byte[6] p2pDeviceAddress; + + /** + * Type of device. Refer to section B.1 of the Wifi P2P Technical + * specification v1.2. + */ + byte[] primaryDeviceType; + + /** + * Name of the device. + */ + String deviceName; + + /** + * Mask of |WpsConfigMethods| indicating the WPS configuration methods + * supported by the device. + */ + int configMethods; + + /** + * Refer to section 4.1.4 of the Wifi P2P Technical specification v1.2. + */ + byte deviceCapabilities; + + /** + * Mask of |P2pGroupCapabilityMask| indicating the group capabilities. + * Refer to section 4.1.4 of the Wifi P2P Technical specification v1.2. + */ + int groupCapabilities; + + /** + * WFD device info as described in section 5.1.2 of the WFD technical + * specification v1.0.0. + */ + byte[] wfdDeviceInfo; + + /** + * WFD R2 device info as described in section 5.1.12 of WFD technical + * specification v2.1. + */ + byte[] wfdR2DeviceInfo; + + /** + * Vendor-specific information element bytes. The format of an + * information element is EID (1 byte) + Length (1 Byte) + Payload which is + * defined in Section 9.4.4 TLV encodings of 802.11-2016 IEEE Standard for + * Information technology. The length indicates the size of the payload. + * Multiple information elements may be appended within the byte array. + */ + byte[] vendorElemBytes; + + /** + * Optional vendor-specific data. + * Null value indicates that no vendor data is provided. + */ + @nullable OuiKeyedData[] vendorData; +} diff --git a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/P2pDiscoveryInfo.aidl b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/P2pDiscoveryInfo.aidl new file mode 100644 index 0000000000000000000000000000000000000000..ddb8a3d6408857228c1fd107b0e41dbf8c308cb2 --- /dev/null +++ b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/P2pDiscoveryInfo.aidl @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.hardware.wifi.supplicant; + +import android.hardware.wifi.common.OuiKeyedData; +import android.hardware.wifi.supplicant.P2pScanType; + +/** + * Request parameters used for |ISupplicantP2pIface.findWithParams| + */ +@VintfStability +parcelable P2pDiscoveryInfo { + /** + * P2P scan type. + */ + P2pScanType scanType; + + /** + * Frequency to scan in MHz. Only valid the scan type is |P2pScanType.SPECIFIC_FREQ| + */ + int frequencyMhz; + + /** + * Max time, in seconds, to be spent in performing discovery. + * Set to 0 to indefinitely continue discovery until an explicit + * |stopFind| is sent. + */ + int timeoutInSec; + + /** + * Optional vendor-specific parameters. Null value indicates + * that no vendor data is provided. + */ + @nullable OuiKeyedData[] vendorData; +} diff --git a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/P2pGroupStartedEventParams.aidl b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/P2pGroupStartedEventParams.aidl index 96f1e1679327ceaa6144d1685121414cf38980c4..9db7a1eedae0888399d7c5a59cb61475289edb2c 100644 --- a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/P2pGroupStartedEventParams.aidl +++ b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/P2pGroupStartedEventParams.aidl @@ -16,6 +16,7 @@ package android.hardware.wifi.supplicant; +import android.hardware.wifi.common.OuiKeyedData; import android.hardware.wifi.supplicant.P2pClientEapolIpAddressInfo; /** @@ -63,4 +64,10 @@ parcelable P2pGroupStartedEventParams { * The value is undefined if isP2pClientEapolIpAddressInfoPresent is false. */ P2pClientEapolIpAddressInfo p2pClientIpInfo; + + /** + * Optional vendor-specific parameters. Null value indicates + * that no vendor data is provided. + */ + @nullable OuiKeyedData[] vendorData; } diff --git a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/P2pPeerClientDisconnectedEventParams.aidl b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/P2pPeerClientDisconnectedEventParams.aidl new file mode 100644 index 0000000000000000000000000000000000000000..6e3350f6214949cd6a014f3515c2bd073883836f --- /dev/null +++ b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/P2pPeerClientDisconnectedEventParams.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.hardware.wifi.supplicant; + +import android.hardware.wifi.common.OuiKeyedData; + +/** + * Parameters passed as a part of P2P peer client disconnected event. + */ +@VintfStability +parcelable P2pPeerClientDisconnectedEventParams { + /** Interface name of this device group owner. (For ex: p2p-p2p0-1) */ + String groupInterfaceName; + + /** P2P group interface MAC address of the client that disconnected. */ + byte[6] clientInterfaceAddress; + + /** P2P device interface MAC address of the client that disconnected. */ + byte[6] clientDeviceAddress; + + /** + * Optional vendor-specific parameters. Null value indicates + * that no vendor data is provided. + */ + @nullable OuiKeyedData[] vendorData; +} diff --git a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/P2pPeerClientJoinedEventParams.aidl b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/P2pPeerClientJoinedEventParams.aidl new file mode 100644 index 0000000000000000000000000000000000000000..4f46d705a06dc0d3c055b96c893fc2dbaad5b99b --- /dev/null +++ b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/P2pPeerClientJoinedEventParams.aidl @@ -0,0 +1,50 @@ +/* + * Copyright (C) 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.hardware.wifi.supplicant; + +import android.hardware.wifi.common.OuiKeyedData; + +/** + * Parameters passed as a part of P2P peer client joined event. + */ +@VintfStability +parcelable P2pPeerClientJoinedEventParams { + /** Interface name of this device group owner. (For ex: p2p-p2p0-1) */ + String groupInterfaceName; + + /** P2P group interface MAC address of the client that joined. */ + byte[6] clientInterfaceAddress; + + /** P2P device interface MAC address of the client that joined. */ + byte[6] clientDeviceAddress; + + /** + * The P2P Client IPV4 address allocated via EAPOL exchange. + * The higher-order address bytes are in the lower-order int bytes + * (e.g. 1.2.3.4 is represented as 0x04030201). + * Refer Wi-Fi P2P Technical Specification v1.7 - Section 4.2.8 + * "IP Address Allocation in EAPOL-Key Frames (4-Way Handshake)" for more details. + * The value is set to zero if the IP address is not allocated via EAPOL exchange. + */ + int clientIpAddress; + + /** + * Optional vendor-specific parameters. Null value indicates + * that no vendor data is provided. + */ + @nullable OuiKeyedData[] vendorData; +} diff --git a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/P2pProvisionDiscoveryCompletedEventParams.aidl b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/P2pProvisionDiscoveryCompletedEventParams.aidl new file mode 100644 index 0000000000000000000000000000000000000000..b559216611a3c51147469f4b7754e109f5e6a06d --- /dev/null +++ b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/P2pProvisionDiscoveryCompletedEventParams.aidl @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.hardware.wifi.supplicant; + +import android.hardware.wifi.common.OuiKeyedData; +import android.hardware.wifi.supplicant.P2pProvDiscStatusCode; +import android.hardware.wifi.supplicant.WpsConfigMethods; + +/** + * Parameters passed as a part of P2P provision discovery frame notification. + */ +@VintfStability +parcelable P2pProvisionDiscoveryCompletedEventParams { + /** + * P2P device interface MAC address of the device who sent the request or responded to our + * request. + */ + byte[6] p2pDeviceAddress; + /** True if this is a request, false if this is a response. */ + boolean isRequest; + /** Status of the provision discovery */ + P2pProvDiscStatusCode status; + /** Mask of WPS configuration methods supported */ + WpsConfigMethods configMethods; + /** 8-digit pin generated */ + String generatedPin; + /** + * Interface name of this device group owner. (For ex: p2p-p2p0-1) + * This field is filled only when the provision discovery request is received + * with P2P Group ID attribute. i.e., when the peer device is joining this + * device operating P2P group. + * Refer to WFA Wi-Fi_Direct_Specification_v1.9 section 3.2.1 for more details. + */ + String groupInterfaceName; + /** + * Optional vendor-specific parameters. Null value indicates + * that no vendor data is provided. + */ + @nullable OuiKeyedData[] vendorData; +} diff --git a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/P2pScanType.aidl b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/P2pScanType.aidl new file mode 100644 index 0000000000000000000000000000000000000000..1ab14c40efb5ec666d92703e3667df23ba39129a --- /dev/null +++ b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/P2pScanType.aidl @@ -0,0 +1,37 @@ +/* + * Copyright (C) 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.hardware.wifi.supplicant; + +/** + * Scan types used in P2P. + */ +@VintfStability +@Backing(type="int") +enum P2pScanType { + /** + * All channels. + */ + FULL, + /** + * Social channels. + */ + SOCIAL, + /** + * Specific channel. + */ + SPECIFIC_FREQ, +} diff --git a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/QosCharacteristics.aidl b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/QosCharacteristics.aidl new file mode 100644 index 0000000000000000000000000000000000000000..be5ef91356edc37abba45ed1e06a517b53bd8547 --- /dev/null +++ b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/QosCharacteristics.aidl @@ -0,0 +1,120 @@ +/* + * Copyright (C) 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.hardware.wifi.supplicant; + +import android.hardware.wifi.supplicant.MsduDeliveryInfo; + +/** + * Additional QoS parameters as defined in Section 9.4.2.316 + * of the IEEE P802.11be/D4.0 Standard. + */ +@VintfStability +parcelable QosCharacteristics { + /** + * Unsigned integer specifying the minimum interval (in microseconds) between the start of + * two consecutive service periods (SPs) that are allocated for frame exchanges. + * The value must be non-zero. + */ + int minServiceIntervalUs; + + /** + * Unsigned integer specifying the maximum interval (in microseconds) between the start of two + * consecutive SPs that are allocated for frame exchanges. The value must be non-zero. + */ + int maxServiceIntervalUs; + + /** + * Unsigned integer specifying the lowest data rate (in kilobits/sec) + * for the transport of MSDUs or A-MSDUs belonging to the traffic flow. + * The value must be non-zero. + */ + int minDataRateKbps; + + /** + * Unsigned integer specifying the maximum amount of time (in microseconds) + * targeted to transport an MSDU or A-MSDU belonging to the traffic flow. + * The value must be non-zero. + */ + int delayBoundUs; + + /** + * Enum values indicating which optional fields are provided. + * See Figure 9-1001au of the IEEE P802.11be/D4.0 Standard. + */ + @VintfStability + @Backing(type="int") + enum QosCharacteristicsMask { + MAX_MSDU_SIZE = 1 << 0, + SERVICE_START_TIME = 1 << 1, + SERVICE_START_TIME_LINK_ID = 1 << 2, + MEAN_DATA_RATE = 1 << 3, + BURST_SIZE = 1 << 4, + MSDU_LIFETIME = 1 << 5, + MSDU_DELIVERY_INFO = 1 << 6, + } + + /** + * Mask of |QosCharacteristicsMask| indicating which optional fields are provided. + */ + int optionalFieldMask; + + /** + * Unsigned 16-bit value specifying the maximum size (in octets) of an MSDU + * belonging to the traffic flow. The value must be non-zero if provided. + */ + char maxMsduSizeOctets; + + /** + * Unsigned integer specifying the anticipated time (in microseconds) when + * the traffic starts for the associated TID. + */ + int serviceStartTimeUs; + + /** + * The four LSBs indicate the link identifier that corresponds to the link for which the + * TSF timer is used to indicate the Service Start Time. The four MSBs should not be used. + * This field is present if |serviceStartTimeUs| is included and is not present otherwise. + */ + byte serviceStartTimeLinkId; + + /** + * Unsigned integer indicating the data rate specified (in kilobits/sec) for transport of MSDUs + * or A-MSDUs belonging to the traffic flow. The value must be non-zero if provided. + */ + int meanDataRateKbps; + + /** + * Unsigned integer specififying the maximum burst (in octets) of the MSDUs or A-MSDUs + * belonging to the traffic flow that arrive at the MAC SAP within any time duration equal + * to the value specified in the |delayBound| field. The value must be non-zero if provided. + */ + int burstSizeOctets; + + /** + * Unsigned 16-bit integer specifying the maximum amount of time (in milliseconds) since the + * arrival of the MSDU at the MAC data service interface beyond which the MSDU is not useful + * even if received by the receiver. The amount of time specified in this field is larger than + * or equal to the amount of time specified in the |delayBound| field, if present. The value + * must be non-zero if provided. + */ + char msduLifetimeMs; + + /** + * MSDU delivery information. See |MsduDeliveryInfo| for more details. + */ + MsduDeliveryInfo msduDeliveryInfo; +} diff --git a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/QosPolicyScsData.aidl b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/QosPolicyScsData.aidl index 86a4dac216ae21054d2bfbb114e369fc97b0cb44..76f5a9a832dbda020719d1724cdbe031ff005b03 100644 --- a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/QosPolicyScsData.aidl +++ b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/QosPolicyScsData.aidl @@ -1,5 +1,6 @@ package android.hardware.wifi.supplicant; +import android.hardware.wifi.supplicant.QosCharacteristics; import android.hardware.wifi.supplicant.QosPolicyClassifierParams; /** @@ -21,4 +22,24 @@ parcelable QosPolicyScsData { * QoS policy SCS classifier type information. */ QosPolicyClassifierParams classifierParams; + + /** + * Enum values for the |direction| field. + */ + @VintfStability + @Backing(type="byte") + enum LinkDirection { + DOWNLINK, + UPLINK, // Only applies to trigger-based traffic (Wi-Fi 6+) + } + + /** + * Direction of data described by this element. + */ + LinkDirection direction; + + /** + * Additional parameters available in QoS R3. + */ + @nullable QosCharacteristics QosCharacteristics; } diff --git a/wifi/supplicant/aidl/vts/functional/Android.bp b/wifi/supplicant/aidl/vts/functional/Android.bp index f7c619ab51b6c6d41f6b275db4ee442935bc936d..96c13e701fc79e17e3e6ce0ddd3defe4e1f1373f 100644 --- a/wifi/supplicant/aidl/vts/functional/Android.bp +++ b/wifi/supplicant/aidl/vts/functional/Android.bp @@ -42,15 +42,17 @@ cc_test { "android.hardware.wifi@1.3", "android.hardware.wifi@1.4", "android.hardware.wifi@1.5", + "android.hardware.wifi.common-V1-ndk", "android.hardware.wifi.supplicant@1.0", "android.hardware.wifi.supplicant@1.1", - "android.hardware.wifi.supplicant-V2-ndk", + "android.hardware.wifi.supplicant-V3-ndk", "libwifi-system", "libwifi-system-iface", "VtsHalWifiV1_0TargetTestUtil", "VtsHalWifiV1_5TargetTestUtil", "VtsHalWifiSupplicantV1_0TargetTestUtil", - "android.hardware.wifi-V1-ndk", + "android.hardware.wifi.common-V1-ndk", + "android.hardware.wifi-V2-ndk", "VtsHalWifiTargetTestUtil", ], test_suites: [ @@ -78,15 +80,17 @@ cc_test { "android.hardware.wifi@1.3", "android.hardware.wifi@1.4", "android.hardware.wifi@1.5", + "android.hardware.wifi.common-V1-ndk", "android.hardware.wifi.supplicant@1.0", "android.hardware.wifi.supplicant@1.1", - "android.hardware.wifi.supplicant-V2-ndk", + "android.hardware.wifi.supplicant-V3-ndk", "libwifi-system", "libwifi-system-iface", "VtsHalWifiV1_0TargetTestUtil", "VtsHalWifiV1_5TargetTestUtil", "VtsHalWifiSupplicantV1_0TargetTestUtil", - "android.hardware.wifi-V1-ndk", + "android.hardware.wifi.common-V1-ndk", + "android.hardware.wifi-V2-ndk", "VtsHalWifiTargetTestUtil", ], test_suites: [ @@ -114,15 +118,17 @@ cc_test { "android.hardware.wifi@1.3", "android.hardware.wifi@1.4", "android.hardware.wifi@1.5", + "android.hardware.wifi.common-V1-ndk", "android.hardware.wifi.supplicant@1.0", "android.hardware.wifi.supplicant@1.1", - "android.hardware.wifi.supplicant-V2-ndk", + "android.hardware.wifi.supplicant-V3-ndk", "libwifi-system", "libwifi-system-iface", "VtsHalWifiV1_0TargetTestUtil", "VtsHalWifiV1_5TargetTestUtil", "VtsHalWifiSupplicantV1_0TargetTestUtil", - "android.hardware.wifi-V1-ndk", + "android.hardware.wifi.common-V1-ndk", + "android.hardware.wifi-V2-ndk", "VtsHalWifiTargetTestUtil", ], test_suites: [ diff --git a/wifi/supplicant/aidl/vts/functional/supplicant_p2p_iface_aidl_test.cpp b/wifi/supplicant/aidl/vts/functional/supplicant_p2p_iface_aidl_test.cpp index a260408c8cb217236f34edc57eeb26c00a7d78da..3f96414a0e11c2754282d41fd6a761fa494e44d7 100644 --- a/wifi/supplicant/aidl/vts/functional/supplicant_p2p_iface_aidl_test.cpp +++ b/wifi/supplicant/aidl/vts/functional/supplicant_p2p_iface_aidl_test.cpp @@ -35,10 +35,14 @@ using aidl::android::hardware::wifi::supplicant::IfaceType; using aidl::android::hardware::wifi::supplicant::ISupplicant; using aidl::android::hardware::wifi::supplicant::ISupplicantP2pIface; using aidl::android::hardware::wifi::supplicant::MiracastMode; +using aidl::android::hardware::wifi::supplicant::P2pDeviceFoundEventParams; using aidl::android::hardware::wifi::supplicant::P2pFrameTypeMask; using aidl::android::hardware::wifi::supplicant::P2pGroupCapabilityMask; using aidl::android::hardware::wifi::supplicant::P2pGroupStartedEventParams; +using aidl::android::hardware::wifi::supplicant::P2pPeerClientDisconnectedEventParams; +using aidl::android::hardware::wifi::supplicant::P2pPeerClientJoinedEventParams; using aidl::android::hardware::wifi::supplicant::P2pProvDiscStatusCode; +using aidl::android::hardware::wifi::supplicant::P2pProvisionDiscoveryCompletedEventParams; using aidl::android::hardware::wifi::supplicant::P2pStatusCode; using aidl::android::hardware::wifi::supplicant::SupplicantStatusCode; using aidl::android::hardware::wifi::supplicant::WpsConfigMethods; @@ -182,6 +186,24 @@ class SupplicantP2pIfaceCallback : public BnSupplicantP2pIfaceCallback { const P2pGroupStartedEventParams& /* groupStartedEventParams */) override { return ndk::ScopedAStatus::ok(); } + ::ndk::ScopedAStatus onPeerClientJoined( + const P2pPeerClientJoinedEventParams& /* clientJoinedEventParams */) override { + return ndk::ScopedAStatus::ok(); + } + ::ndk::ScopedAStatus onPeerClientDisconnected( + const P2pPeerClientDisconnectedEventParams& /* clientDisconnectedEventParams */) + override { + return ndk::ScopedAStatus::ok(); + } + ::ndk::ScopedAStatus onProvisionDiscoveryCompletedEvent( + const P2pProvisionDiscoveryCompletedEventParams& + /* provisionDiscoveryCompletedEventParams */) override { + return ndk::ScopedAStatus::ok(); + } + ::ndk::ScopedAStatus onDeviceFoundWithParams( + const P2pDeviceFoundEventParams& /* deviceFoundEventParams */) override { + return ndk::ScopedAStatus::ok(); + } }; class SupplicantP2pIfaceAidlTest : public testing::TestWithParam { diff --git a/wifi/supplicant/aidl/vts/functional/supplicant_sta_network_aidl_test.cpp b/wifi/supplicant/aidl/vts/functional/supplicant_sta_network_aidl_test.cpp index 973b56a98db59e7c6c40dee977bdfd42bc55a8e8..757414195ea7e0c79dcd660b9cfcdb2ccb2db60b 100644 --- a/wifi/supplicant/aidl/vts/functional/supplicant_sta_network_aidl_test.cpp +++ b/wifi/supplicant/aidl/vts/functional/supplicant_sta_network_aidl_test.cpp @@ -822,6 +822,13 @@ TEST_P(SupplicantStaNetworkAidlTest, SetMinimumTlsVersionEapPhase1Param) { tlsV13Supported); } +/* + * disableEht + */ +TEST_P(SupplicantStaNetworkAidlTest, DisableEht) { + EXPECT_TRUE(sta_network_->disableEht().isOk()); +} + GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(SupplicantStaNetworkAidlTest); INSTANTIATE_TEST_SUITE_P(Supplicant, SupplicantStaNetworkAidlTest, testing::ValuesIn(android::getAidlHalInstanceNames(