Merge "Revert "Add bootcontrol HAL APEX"" into main
diff --git a/audio/aidl/default/EffectThread.cpp b/audio/aidl/default/EffectThread.cpp
index cd2ba53..47ba9f4 100644
--- a/audio/aidl/default/EffectThread.cpp
+++ b/audio/aidl/default/EffectThread.cpp
@@ -48,6 +48,8 @@
mPriority = priority;
{
std::lock_guard lg(mThreadMutex);
+ mStop = true;
+ mExit = false;
mThreadContext = std::move(context);
auto statusMQ = mThreadContext->getStatusFmq();
EventFlag* efGroup = nullptr;
diff --git a/audio/aidl/default/Module.cpp b/audio/aidl/default/Module.cpp
index 3117134..819b3c5 100644
--- a/audio/aidl/default/Module.cpp
+++ b/audio/aidl/default/Module.cpp
@@ -1277,6 +1277,12 @@
mmapSources.insert(port.id);
}
}
+ if (mmapSources.empty() && mmapSinks.empty()) {
+ AudioMMapPolicyInfo never;
+ never.mmapPolicy = AudioMMapPolicy::NEVER;
+ _aidl_return->push_back(never);
+ return ndk::ScopedAStatus::ok();
+ }
for (const auto& route : getConfig().routes) {
if (mmapSinks.count(route.sinkPortId) != 0) {
// The sink is a mix port, add the sources if they are device ports.
diff --git a/audio/aidl/default/alsa/ModuleAlsa.cpp b/audio/aidl/default/alsa/ModuleAlsa.cpp
index 8e75d56..8512631 100644
--- a/audio/aidl/default/alsa/ModuleAlsa.cpp
+++ b/audio/aidl/default/alsa/ModuleAlsa.cpp
@@ -39,13 +39,14 @@
if (!deviceProfile.has_value()) {
return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT);
}
- auto profile = alsa::readAlsaDeviceInfo(*deviceProfile);
- if (!profile.has_value()) {
+ auto proxy = alsa::readAlsaDeviceInfo(*deviceProfile);
+ if (proxy.get() == nullptr) {
return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_STATE);
}
- std::vector<AudioChannelLayout> channels = alsa::getChannelMasksFromProfile(&profile.value());
- std::vector<int> sampleRates = alsa::getSampleRatesFromProfile(&profile.value());
+ alsa_device_profile* profile = proxy.getProfile();
+ std::vector<AudioChannelLayout> channels = alsa::getChannelMasksFromProfile(profile);
+ std::vector<int> sampleRates = alsa::getSampleRatesFromProfile(profile);
for (size_t i = 0; i < std::min(MAX_PROFILE_FORMATS, AUDIO_PORT_MAX_AUDIO_PROFILES) &&
profile->formats[i] != PCM_FORMAT_INVALID;
diff --git a/audio/aidl/default/alsa/StreamAlsa.cpp b/audio/aidl/default/alsa/StreamAlsa.cpp
index 0605d6f..403b94b 100644
--- a/audio/aidl/default/alsa/StreamAlsa.cpp
+++ b/audio/aidl/default/alsa/StreamAlsa.cpp
@@ -83,7 +83,7 @@
proxy = alsa::openProxyForAttachedDevice(
device, const_cast<struct pcm_config*>(&mConfig.value()), mBufferSizeFrames);
}
- if (!proxy) {
+ if (proxy.get() == nullptr) {
return ::android::NO_INIT;
}
alsaDeviceProxies.push_back(std::move(proxy));
diff --git a/audio/aidl/default/alsa/Utils.cpp b/audio/aidl/default/alsa/Utils.cpp
index 9dcd024..c08836c 100644
--- a/audio/aidl/default/alsa/Utils.cpp
+++ b/audio/aidl/default/alsa/Utils.cpp
@@ -37,6 +37,23 @@
namespace aidl::android::hardware::audio::core::alsa {
+DeviceProxy::DeviceProxy() : mProfile(nullptr), mProxy(nullptr, alsaProxyDeleter) {}
+
+DeviceProxy::DeviceProxy(const DeviceProfile& deviceProfile)
+ : mProfile(new alsa_device_profile), mProxy(new alsa_device_proxy, alsaProxyDeleter) {
+ profile_init(mProfile.get(), deviceProfile.direction);
+ mProfile->card = deviceProfile.card;
+ mProfile->device = deviceProfile.device;
+ memset(mProxy.get(), 0, sizeof(alsa_device_proxy));
+}
+
+void DeviceProxy::alsaProxyDeleter(alsa_device_proxy* proxy) {
+ if (proxy != nullptr) {
+ proxy_close(proxy);
+ delete proxy;
+ }
+}
+
namespace {
using AudioChannelCountToMaskMap = std::map<unsigned int, AudioChannelLayout>;
@@ -261,39 +278,24 @@
return sampleRates;
}
-DeviceProxy makeDeviceProxy() {
- DeviceProxy proxy(new alsa_device_proxy, [](alsa_device_proxy* proxy) {
- if (proxy != nullptr) {
- proxy_close(proxy);
- delete proxy;
- }
- });
- memset(proxy.get(), 0, sizeof(alsa_device_proxy));
- return proxy;
-}
-
DeviceProxy openProxyForAttachedDevice(const DeviceProfile& deviceProfile,
struct pcm_config* pcmConfig, size_t bufferFrameCount) {
if (deviceProfile.isExternal) {
LOG(FATAL) << __func__ << ": called for an external device, address=" << deviceProfile;
}
- alsa_device_profile profile;
- profile_init(&profile, deviceProfile.direction);
- profile.card = deviceProfile.card;
- profile.device = deviceProfile.device;
- if (!profile_fill_builtin_device_info(&profile, pcmConfig, bufferFrameCount)) {
+ DeviceProxy proxy(deviceProfile);
+ if (!profile_fill_builtin_device_info(proxy.getProfile(), pcmConfig, bufferFrameCount)) {
LOG(FATAL) << __func__ << ": failed to init for built-in device, address=" << deviceProfile;
}
- auto proxy = makeDeviceProxy();
- if (int err = proxy_prepare_from_default_config(proxy.get(), &profile); err != 0) {
+ if (int err = proxy_prepare_from_default_config(proxy.get(), proxy.getProfile()); err != 0) {
LOG(FATAL) << __func__ << ": fail to prepare for device address=" << deviceProfile
<< " error=" << err;
- return nullptr;
+ return DeviceProxy();
}
if (int err = proxy_open(proxy.get()); err != 0) {
LOG(ERROR) << __func__ << ": failed to open device, address=" << deviceProfile
<< " error=" << err;
- return nullptr;
+ return DeviceProxy();
}
return proxy;
}
@@ -303,42 +305,36 @@
if (!deviceProfile.isExternal) {
LOG(FATAL) << __func__ << ": called for an attached device, address=" << deviceProfile;
}
- auto profile = readAlsaDeviceInfo(deviceProfile);
- if (!profile.has_value()) {
- LOG(ERROR) << __func__ << ": unable to read device info, device address=" << deviceProfile;
- return nullptr;
+ auto proxy = readAlsaDeviceInfo(deviceProfile);
+ if (proxy.get() == nullptr) {
+ return proxy;
}
- auto proxy = makeDeviceProxy();
- if (int err = proxy_prepare(proxy.get(), &profile.value(), pcmConfig, requireExactMatch);
+ if (int err = proxy_prepare(proxy.get(), proxy.getProfile(), pcmConfig, requireExactMatch);
err != 0) {
LOG(ERROR) << __func__ << ": fail to prepare for device address=" << deviceProfile
<< " error=" << err;
- return nullptr;
+ return DeviceProxy();
}
if (int err = proxy_open(proxy.get()); err != 0) {
LOG(ERROR) << __func__ << ": failed to open device, address=" << deviceProfile
<< " error=" << err;
- return nullptr;
+ return DeviceProxy();
}
return proxy;
}
-std::optional<alsa_device_profile> readAlsaDeviceInfo(const DeviceProfile& deviceProfile) {
- alsa_device_profile profile;
- profile_init(&profile, deviceProfile.direction);
- profile.card = deviceProfile.card;
- profile.device = deviceProfile.device;
- if (!profile_read_device_info(&profile)) {
- LOG(ERROR) << __func__ << ": failed to read device info, card=" << profile.card
- << ", device=" << profile.device;
- return std::nullopt;
+DeviceProxy readAlsaDeviceInfo(const DeviceProfile& deviceProfile) {
+ DeviceProxy proxy(deviceProfile);
+ if (!profile_read_device_info(proxy.getProfile())) {
+ LOG(ERROR) << __func__ << ": unable to read device info, device address=" << deviceProfile;
+ return DeviceProxy();
}
- return profile;
+ return proxy;
}
void resetTransferredFrames(DeviceProxy& proxy, uint64_t frames) {
- if (proxy != nullptr) {
- proxy->transferred = frames;
+ if (proxy.get() != nullptr) {
+ proxy.get()->transferred = frames;
}
}
diff --git a/audio/aidl/default/alsa/Utils.h b/audio/aidl/default/alsa/Utils.h
index 37414b3..980f685 100644
--- a/audio/aidl/default/alsa/Utils.h
+++ b/audio/aidl/default/alsa/Utils.h
@@ -43,8 +43,21 @@
bool isExternal;
};
std::ostream& operator<<(std::ostream& os, const DeviceProfile& device);
-using DeviceProxyDeleter = std::function<void(alsa_device_proxy*)>;
-using DeviceProxy = std::unique_ptr<alsa_device_proxy, DeviceProxyDeleter>;
+
+class DeviceProxy {
+ public:
+ DeviceProxy(); // Constructs a "null" proxy.
+ explicit DeviceProxy(const DeviceProfile& deviceProfile);
+ alsa_device_profile* getProfile() { return mProfile.get(); }
+ alsa_device_proxy* get() { return mProxy.get(); }
+
+ private:
+ static void alsaProxyDeleter(alsa_device_proxy* proxy);
+ using AlsaProxy = std::unique_ptr<alsa_device_proxy, decltype(alsaProxyDeleter)*>;
+
+ std::unique_ptr<alsa_device_profile> mProfile;
+ AlsaProxy mProxy;
+};
::aidl::android::media::audio::common::AudioChannelLayout getChannelLayoutMaskFromChannelCount(
unsigned int channelCount, int isInput);
@@ -60,12 +73,11 @@
const ::aidl::android::media::audio::common::AudioPort& audioPort);
std::optional<struct pcm_config> getPcmConfig(const StreamContext& context, bool isInput);
std::vector<int> getSampleRatesFromProfile(const alsa_device_profile* profile);
-DeviceProxy makeDeviceProxy();
DeviceProxy openProxyForAttachedDevice(const DeviceProfile& deviceProfile,
struct pcm_config* pcmConfig, size_t bufferFrameCount);
DeviceProxy openProxyForExternalDevice(const DeviceProfile& deviceProfile,
struct pcm_config* pcmConfig, bool requireExactMatch);
-std::optional<alsa_device_profile> readAlsaDeviceInfo(const DeviceProfile& deviceProfile);
+DeviceProxy readAlsaDeviceInfo(const DeviceProfile& deviceProfile);
void resetTransferredFrames(DeviceProxy& proxy, uint64_t frames);
::aidl::android::media::audio::common::AudioFormatDescription
diff --git a/audio/aidl/vts/TestUtils.h b/audio/aidl/vts/TestUtils.h
index 10c2fc6..b559669 100644
--- a/audio/aidl/vts/TestUtils.h
+++ b/audio/aidl/vts/TestUtils.h
@@ -78,9 +78,9 @@
EXPECT_PRED_FORMAT2(::android::hardware::audio::common::testing::detail::assertResult, \
expected, ret)
-#define SKIP_TEST_IF_DATA_UNSUPPORTED(flags) \
- ({ \
- if ((flags).hwAcceleratorMode == Flags::HardwareAccelerator::TUNNEL || (flags).bypass) { \
- GTEST_SKIP() << "Skip data path for offload"; \
- } \
+#define SKIP_TEST_IF_DATA_UNSUPPORTED(flags) \
+ ({ \
+ if ((flags).hwAcceleratorMode == Flags::HardwareAccelerator::TUNNEL || (flags).bypass) { \
+ GTEST_SKIP() << "Skip data path for offload"; \
+ } \
})
\ No newline at end of file
diff --git a/audio/aidl/vts/VtsHalAudioCoreModuleTargetTest.cpp b/audio/aidl/vts/VtsHalAudioCoreModuleTargetTest.cpp
index cd765d2..0d929a8 100644
--- a/audio/aidl/vts/VtsHalAudioCoreModuleTargetTest.cpp
+++ b/audio/aidl/vts/VtsHalAudioCoreModuleTargetTest.cpp
@@ -87,6 +87,7 @@
using aidl::android::media::audio::common::AudioFormatType;
using aidl::android::media::audio::common::AudioIoFlags;
using aidl::android::media::audio::common::AudioLatencyMode;
+using aidl::android::media::audio::common::AudioMMapPolicy;
using aidl::android::media::audio::common::AudioMMapPolicyInfo;
using aidl::android::media::audio::common::AudioMMapPolicyType;
using aidl::android::media::audio::common::AudioMode;
@@ -2133,7 +2134,13 @@
std::vector<AudioMMapPolicyInfo> policyInfos;
EXPECT_IS_OK(module->getMmapPolicyInfos(mmapPolicyType, &policyInfos))
<< toString(mmapPolicyType);
- EXPECT_EQ(isMmapSupported, !policyInfos.empty());
+ const bool isMMapSupportedByPolicyInfos =
+ std::find_if(policyInfos.begin(), policyInfos.end(), [](const auto& info) {
+ return info.mmapPolicy == AudioMMapPolicy::AUTO ||
+ info.mmapPolicy == AudioMMapPolicy::ALWAYS;
+ }) != policyInfos.end();
+ EXPECT_EQ(isMmapSupported, isMMapSupportedByPolicyInfos)
+ << ::android::internal::ToString(policyInfos);
}
}
@@ -4167,58 +4174,32 @@
class WithRemoteSubmix {
public:
WithRemoteSubmix() = default;
- WithRemoteSubmix(AudioDeviceAddress address) : mAddress(address) {}
+ explicit WithRemoteSubmix(AudioDeviceAddress address) : mAddress(address) {}
WithRemoteSubmix(const WithRemoteSubmix&) = delete;
WithRemoteSubmix& operator=(const WithRemoteSubmix&) = delete;
- std::optional<AudioPort> getAudioPort() {
+ static std::optional<AudioPort> getRemoteSubmixAudioPort(
+ ModuleConfig* moduleConfig,
+ const std::optional<AudioDeviceAddress>& address = std::nullopt) {
AudioDeviceType deviceType = IOTraits<Stream>::is_input ? AudioDeviceType::IN_SUBMIX
: AudioDeviceType::OUT_SUBMIX;
- auto ports = mModuleConfig->getAudioPortsForDeviceTypes(
+ auto ports = moduleConfig->getAudioPortsForDeviceTypes(
std::vector<AudioDeviceType>{deviceType},
AudioDeviceDescription::CONNECTION_VIRTUAL);
- if (!ports.empty()) return ports.front();
- return {};
- }
- /* Connect remote submix external device */
- void SetUpPortConnection() {
- auto port = getAudioPort();
- ASSERT_TRUE(port.has_value()) << "Device AudioPort for remote submix not found";
- if (mAddress.has_value()) {
- port.value().ext.template get<AudioPortExt::Tag::device>().device.address =
- mAddress.value();
+ if (ports.empty()) return {};
+ AudioPort port = ports.front();
+ if (address) {
+ port.ext.template get<AudioPortExt::Tag::device>().device.address = address.value();
} else {
- port = GenerateUniqueDeviceAddress(port.value());
+ port = GenerateUniqueDeviceAddress(port);
}
- mConnectedPort = std::make_unique<WithDevicePortConnectedState>(port.value());
- ASSERT_NO_FATAL_FAILURE(mConnectedPort->SetUp(mModule, mModuleConfig));
+ return port;
}
- AudioDeviceAddress getAudioDeviceAddress() {
- if (!mAddress.has_value()) {
- mAddress = mConnectedPort->get()
- .ext.template get<AudioPortExt::Tag::device>()
- .device.address;
- }
- return mAddress.value();
- }
- /* Get mix port config for stream and setup patch for it. */
- void SetupPatch() {
- const auto portConfig =
- mModuleConfig->getSingleConfigForMixPort(IOTraits<Stream>::is_input);
- if (!portConfig.has_value()) {
- LOG(DEBUG) << __func__ << ": portConfig not found";
- mSkipTest = true;
- return;
- }
- auto devicePortConfig = mModuleConfig->getSingleConfigForDevicePort(mConnectedPort->get());
- mPatch = std::make_unique<WithAudioPatch>(IOTraits<Stream>::is_input, portConfig.value(),
- devicePortConfig);
- ASSERT_NO_FATAL_FAILURE(mPatch->SetUp(mModule));
- }
- void SetUp(IModule* module, ModuleConfig* moduleConfig) {
+ std::optional<AudioDeviceAddress> getAudioDeviceAddress() const { return mAddress; }
+ void SetUp(IModule* module, ModuleConfig* moduleConfig, const AudioPort& connectedPort) {
mModule = module;
mModuleConfig = moduleConfig;
- ASSERT_NO_FATAL_FAILURE(SetUpPortConnection());
- ASSERT_NO_FATAL_FAILURE(SetupPatch());
+
+ ASSERT_NO_FATAL_FAILURE(SetupPatch(connectedPort));
if (!mSkipTest) {
// open stream
mStream = std::make_unique<WithStream<Stream>>(
@@ -4226,6 +4207,11 @@
ASSERT_NO_FATAL_FAILURE(
mStream->SetUp(mModule, AudioCoreModuleBase::kDefaultBufferSizeFrames));
}
+ mAddress = connectedPort.ext.template get<AudioPortExt::Tag::device>().device.address;
+ }
+ void SetUp(IModule* module, ModuleConfig* moduleConfig) {
+ ASSERT_NO_FATAL_FAILURE(SetUpPortConnection(module, moduleConfig));
+ SetUp(module, moduleConfig, mConnectedPort->get());
}
void sendBurstCommands() {
const StreamContext* context = mStream->getContext();
@@ -4243,9 +4229,31 @@
}
EXPECT_FALSE(driver.hasRetrogradeObservablePosition());
}
- bool skipTest() { return mSkipTest; }
+ bool skipTest() const { return mSkipTest; }
private:
+ /* Connect remote submix external device */
+ void SetUpPortConnection(IModule* module, ModuleConfig* moduleConfig) {
+ auto port = getRemoteSubmixAudioPort(moduleConfig, mAddress);
+ ASSERT_TRUE(port.has_value()) << "Device AudioPort for remote submix not found";
+ mConnectedPort = std::make_unique<WithDevicePortConnectedState>(port.value());
+ ASSERT_NO_FATAL_FAILURE(mConnectedPort->SetUp(module, moduleConfig));
+ }
+ /* Get mix port config for stream and setup patch for it. */
+ void SetupPatch(const AudioPort& connectedPort) {
+ const auto portConfig =
+ mModuleConfig->getSingleConfigForMixPort(IOTraits<Stream>::is_input);
+ if (!portConfig.has_value()) {
+ LOG(DEBUG) << __func__ << ": portConfig not found";
+ mSkipTest = true;
+ return;
+ }
+ auto devicePortConfig = mModuleConfig->getSingleConfigForDevicePort(connectedPort);
+ mPatch = std::make_unique<WithAudioPatch>(IOTraits<Stream>::is_input, portConfig.value(),
+ devicePortConfig);
+ ASSERT_NO_FATAL_FAILURE(mPatch->SetUp(mModule));
+ }
+
bool mSkipTest = false;
IModule* mModule = nullptr;
ModuleConfig* mModuleConfig = nullptr;
@@ -4283,9 +4291,11 @@
if (streamOut.skipTest()) {
GTEST_SKIP() << "No mix port for attached devices";
}
+ auto address = streamOut.getAudioDeviceAddress();
+ ASSERT_TRUE(address.has_value());
// open input stream
- WithRemoteSubmix<IStreamIn> streamIn(streamOut.getAudioDeviceAddress());
+ WithRemoteSubmix<IStreamIn> streamIn(address.value());
ASSERT_NO_FATAL_FAILURE(streamIn.SetUp(module.get(), moduleConfig.get()));
if (streamIn.skipTest()) {
GTEST_SKIP() << "No mix port for attached devices";
@@ -4302,9 +4312,11 @@
if (streamOut.skipTest()) {
GTEST_SKIP() << "No mix port for attached devices";
}
+ auto address = streamOut.getAudioDeviceAddress();
+ ASSERT_TRUE(address.has_value());
// open input stream
- WithRemoteSubmix<IStreamIn> streamIn(streamOut.getAudioDeviceAddress());
+ WithRemoteSubmix<IStreamIn> streamIn(address.value());
ASSERT_NO_FATAL_FAILURE(streamIn.SetUp(module.get(), moduleConfig.get()));
if (streamIn.skipTest()) {
GTEST_SKIP() << "No mix port for attached devices";
@@ -4316,6 +4328,43 @@
ASSERT_NO_FATAL_FAILURE(streamIn.sendBurstCommands());
}
+TEST_P(AudioModuleRemoteSubmix, OpenInputMultipleTimes) {
+ // open output stream
+ WithRemoteSubmix<IStreamOut> streamOut;
+ ASSERT_NO_FATAL_FAILURE(streamOut.SetUp(module.get(), moduleConfig.get()));
+ if (streamOut.skipTest()) {
+ GTEST_SKIP() << "No mix port for attached devices";
+ }
+ auto address = streamOut.getAudioDeviceAddress();
+ ASSERT_TRUE(address.has_value());
+
+ // connect remote submix input device port
+ auto port = WithRemoteSubmix<IStreamIn>::getRemoteSubmixAudioPort(moduleConfig.get(),
+ address.value());
+ ASSERT_TRUE(port.has_value()) << "Device AudioPort for remote submix not found";
+ WithDevicePortConnectedState connectedInputPort(port.value());
+ ASSERT_NO_FATAL_FAILURE(connectedInputPort.SetUp(module.get(), moduleConfig.get()));
+
+ // open input streams
+ const int streamInCount = 3;
+ std::vector<std::unique_ptr<WithRemoteSubmix<IStreamIn>>> streamIns(streamInCount);
+ for (int i = 0; i < streamInCount; i++) {
+ streamIns[i] = std::make_unique<WithRemoteSubmix<IStreamIn>>();
+ ASSERT_NO_FATAL_FAILURE(
+ streamIns[i]->SetUp(module.get(), moduleConfig.get(), connectedInputPort.get()));
+ if (streamIns[i]->skipTest()) {
+ GTEST_SKIP() << "No mix port for attached devices";
+ }
+ }
+ // write something to output stream
+ ASSERT_NO_FATAL_FAILURE(streamOut.sendBurstCommands());
+
+ // read from input streams
+ for (int i = 0; i < streamInCount; i++) {
+ ASSERT_NO_FATAL_FAILURE(streamIns[i]->sendBurstCommands());
+ }
+}
+
INSTANTIATE_TEST_SUITE_P(AudioModuleRemoteSubmixTest, AudioModuleRemoteSubmix,
::testing::ValuesIn(getRemoteSubmixModuleInstance()));
GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(AudioModuleRemoteSubmix);
diff --git a/audio/aidl/vts/VtsHalAudioEffectTargetTest.cpp b/audio/aidl/vts/VtsHalAudioEffectTargetTest.cpp
index 3011a5e..1876756 100644
--- a/audio/aidl/vts/VtsHalAudioEffectTargetTest.cpp
+++ b/audio/aidl/vts/VtsHalAudioEffectTargetTest.cpp
@@ -42,11 +42,11 @@
using aidl::android::hardware::audio::effect::CommandId;
using aidl::android::hardware::audio::effect::Descriptor;
+using aidl::android::hardware::audio::effect::Flags;
using aidl::android::hardware::audio::effect::IEffect;
using aidl::android::hardware::audio::effect::IFactory;
using aidl::android::hardware::audio::effect::Parameter;
using aidl::android::hardware::audio::effect::State;
-using aidl::android::hardware::audio::effect::Flags;
using aidl::android::media::audio::common::AudioDeviceDescription;
using aidl::android::media::audio::common::AudioDeviceType;
using aidl::android::media::audio::common::AudioMode;
@@ -87,11 +87,11 @@
};
class AudioEffectDataPathTest : public AudioEffectTest {
- public:
- void SetUp() override {
- AudioEffectTest::SetUp();
- SKIP_TEST_IF_DATA_UNSUPPORTED(mDescriptor.common.flags);
- }
+ public:
+ void SetUp() override {
+ AudioEffectTest::SetUp();
+ SKIP_TEST_IF_DATA_UNSUPPORTED(mDescriptor.common.flags);
+ }
};
TEST_P(AudioEffectTest, SetupAndTearDown) {
@@ -504,6 +504,11 @@
// Set and get AudioDeviceDescription in Parameter
TEST_P(AudioEffectTest, SetAndGetParameterDeviceDescription) {
+ if (!mDescriptor.common.flags.deviceIndication) {
+ GTEST_SKIP() << "Skipping test as effect does not support deviceIndication"
+ << mDescriptor.common.flags.toString();
+ }
+
ASSERT_NO_FATAL_FAILURE(create(mFactory, mEffect, mDescriptor));
ASSERT_NO_FATAL_FAILURE(open(mEffect));
@@ -527,6 +532,11 @@
// Set and get AudioMode in Parameter
TEST_P(AudioEffectTest, SetAndGetParameterAudioMode) {
+ if (!mDescriptor.common.flags.audioModeIndication) {
+ GTEST_SKIP() << "Skipping test as effect does not support audioModeIndication"
+ << mDescriptor.common.flags.toString();
+ }
+
ASSERT_NO_FATAL_FAILURE(create(mFactory, mEffect, mDescriptor));
ASSERT_NO_FATAL_FAILURE(open(mEffect));
@@ -547,6 +557,11 @@
// Set and get AudioSource in Parameter
TEST_P(AudioEffectTest, SetAndGetParameterAudioSource) {
+ if (!mDescriptor.common.flags.audioSourceIndication) {
+ GTEST_SKIP() << "Skipping test as effect does not support audioSourceIndication"
+ << mDescriptor.common.flags.toString();
+ }
+
ASSERT_NO_FATAL_FAILURE(create(mFactory, mEffect, mDescriptor));
ASSERT_NO_FATAL_FAILURE(open(mEffect));
@@ -567,6 +582,11 @@
// Set and get VolumeStereo in Parameter
TEST_P(AudioEffectTest, SetAndGetParameterVolume) {
+ if (mDescriptor.common.flags.volume == Flags::Volume::NONE) {
+ GTEST_SKIP() << "Skipping test as effect does not support volume"
+ << mDescriptor.common.flags.toString();
+ }
+
ASSERT_NO_FATAL_FAILURE(create(mFactory, mEffect, mDescriptor));
ASSERT_NO_FATAL_FAILURE(open(mEffect));
diff --git a/automotive/can/1.0/default/libc++fs/include/automotive/filesystem b/automotive/can/1.0/default/libc++fs/include/automotive/filesystem
index 660ad09..bd3dda5 100644
--- a/automotive/can/1.0/default/libc++fs/include/automotive/filesystem
+++ b/automotive/can/1.0/default/libc++fs/include/automotive/filesystem
@@ -9,6 +9,18 @@
//===----------------------------------------------------------------------===//
#ifndef _LIBAUTO_FILESYSTEM
#define _LIBAUTO_FILESYSTEM
+
+// TODO(152067309): Remove this once the libc++ upgrade is complete.
+#include <__config>
+#if defined(_LIBCPP_VERSION) && _LIBCPP_VERSION > 8000
+
+#include <filesystem>
+namespace android::hardware::automotive {
+namespace filesystem = std::filesystem;
+}
+
+#else
+
/*
filesystem synopsis
@@ -2696,4 +2708,6 @@
_LIBCPP_POP_MACROS
+#endif // defined(_LIBCPP_VERSION) && _LIBCPP_VERSION > 8000
+
#endif // _LIBAUTO_FILESYSTEM
diff --git a/automotive/can/1.0/default/libc++fs/src/filesystem/directory_iterator.cpp b/automotive/can/1.0/default/libc++fs/src/filesystem/directory_iterator.cpp
index 37c863b..0dbf492 100644
--- a/automotive/can/1.0/default/libc++fs/src/filesystem/directory_iterator.cpp
+++ b/automotive/can/1.0/default/libc++fs/src/filesystem/directory_iterator.cpp
@@ -6,9 +6,15 @@
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
+
+// TODO(152067309): Remove this once the libc++ upgrade is complete.
+#include <__config>
+#if defined(_LIBCPP_VERSION) && _LIBCPP_VERSION <= 8000
+
/* clang-format off */
#include "automotive/filesystem"
#include <__config>
+
#if defined(_LIBCPP_WIN32API)
#define WIN32_LEAN_AND_MEAN
#include <Windows.h>
@@ -395,3 +401,5 @@
} // namespace android::hardware::automotive::filesystem
/* clang-format on */
+
+#endif // defined(_LIBCPP_VERSION) && _LIBCPP_VERSION <= 8000
diff --git a/automotive/can/1.0/default/libc++fs/src/filesystem/operations.cpp b/automotive/can/1.0/default/libc++fs/src/filesystem/operations.cpp
index 404c0bd..6a76bdc 100644
--- a/automotive/can/1.0/default/libc++fs/src/filesystem/operations.cpp
+++ b/automotive/can/1.0/default/libc++fs/src/filesystem/operations.cpp
@@ -6,6 +6,11 @@
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
+
+// TODO(152067309): Remove this once the libc++ upgrade is complete.
+#include <__config>
+#if defined(_LIBCPP_VERSION) && _LIBCPP_VERSION <= 8000
+
/* clang-format off */
#include "automotive/filesystem"
#include <array>
@@ -1771,3 +1776,5 @@
#endif
} // namespace android::hardware::automotive::filesystem
/* clang-format on */
+
+#endif // defined(_LIBCPP_VERSION) && _LIBCPP_VERSION <= 8000
diff --git a/automotive/sv/1.0/default/tests/fuzzer/AutomotiveSvV1_0Fuzzer.cpp b/automotive/sv/1.0/default/tests/fuzzer/AutomotiveSvV1_0Fuzzer.cpp
index 98834f5..4c4cc70 100644
--- a/automotive/sv/1.0/default/tests/fuzzer/AutomotiveSvV1_0Fuzzer.cpp
+++ b/automotive/sv/1.0/default/tests/fuzzer/AutomotiveSvV1_0Fuzzer.cpp
@@ -41,35 +41,32 @@
void SurroundViewFuzzer::invoke2dSessionAPI() {
sp<ISurroundView2dSession> surroundView2dSession;
+ sp<SurroundViewStream> handler;
+ mSurroundViewService->start2dSession(
+ [&surroundView2dSession](const sp<ISurroundView2dSession>& session, SvResult result) {
+ if (result == SvResult::OK) {
+ surroundView2dSession = session;
+ }
+ });
+
+ if (surroundView2dSession && !mIs2dStreamStarted) {
+ handler = sp<SurroundViewStream>::make(surroundView2dSession);
+ if (surroundView2dSession->startStream(handler) == SvResult::OK) {
+ mIs2dStreamStarted = true;
+ }
+ }
while (mFuzzedDataProvider.remaining_bytes() > 0) {
auto surroundView2dFunc = mFuzzedDataProvider.PickValueInArray<
const std::function<void()>>({
[&]() {
- mSurroundViewService->start2dSession(
- [&surroundView2dSession](const sp<ISurroundView2dSession>& session,
- SvResult result) {
- if (result == SvResult::OK) {
- surroundView2dSession = session;
- }
- });
- },
- [&]() {
- if (surroundView2dSession) {
- sp<SurroundViewStream> handler =
- sp<SurroundViewStream>::make(surroundView2dSession);
- surroundView2dSession->startStream(handler);
- mIs2dStreamStarted = true;
- }
- },
- [&]() {
if (surroundView2dSession) {
surroundView2dSession->get2dMappingInfo(
[]([[maybe_unused]] Sv2dMappingInfo info) {});
}
},
[&]() {
- if (surroundView2dSession) {
+ if (surroundView2dSession && mIs2dStreamStarted) {
Sv2dConfig config;
config.width = mFuzzedDataProvider.ConsumeIntegralInRange<uint32_t>(
kMinConfigDimension, kMaxConfigDimension);
@@ -149,8 +146,11 @@
}
},
[&]() {
- mSurroundViewService->stop2dSession(
+ SvResult result = mSurroundViewService->stop2dSession(
mFuzzedDataProvider.ConsumeBool() ? surroundView2dSession : nullptr);
+ if (result == SvResult::OK) {
+ mIs2dStreamStarted = false;
+ }
},
});
surroundView2dFunc();
@@ -159,31 +159,40 @@
if (surroundView2dSession && mIs2dStreamStarted) {
surroundView2dSession->stopStream();
}
+
+ if (surroundView2dSession) {
+ mSurroundViewService->stop2dSession(surroundView2dSession);
+ }
}
void SurroundViewFuzzer::invoke3dSessionAPI() {
sp<ISurroundView3dSession> surroundView3dSession;
+ sp<SurroundViewStream> handler;
+ mSurroundViewService->start3dSession(
+ [&surroundView3dSession](const sp<ISurroundView3dSession>& session, SvResult result) {
+ if (result == SvResult::OK) {
+ surroundView3dSession = session;
+ }
+ });
+
+ const size_t numViews = mFuzzedDataProvider.ConsumeIntegralInRange<size_t>(1, kMaxViews);
+ std::vector<View3d> views(numViews);
+ for (size_t i = 0; i < numViews; ++i) {
+ views[i].viewId = mFuzzedDataProvider.ConsumeIntegral<uint32_t>();
+ }
+ surroundView3dSession->setViews(views);
+
+ if (surroundView3dSession) {
+ handler = sp<SurroundViewStream>::make(surroundView3dSession);
+
+ if (surroundView3dSession->startStream(handler) == SvResult::OK) {
+ mIs3dStreamStarted = true;
+ }
+ }
while (mFuzzedDataProvider.remaining_bytes() > 0) {
auto surroundView3dFunc = mFuzzedDataProvider.PickValueInArray<
const std::function<void()>>({
[&]() {
- mSurroundViewService->start3dSession(
- [&surroundView3dSession](const sp<ISurroundView3dSession>& session,
- SvResult result) {
- if (result == SvResult::OK) {
- surroundView3dSession = session;
- }
- });
- },
- [&]() {
- if (surroundView3dSession) {
- sp<SurroundViewStream> handler =
- sp<SurroundViewStream>::make(surroundView3dSession);
- surroundView3dSession->startStream(handler);
- mIs3dStreamStarted = true;
- }
- },
- [&]() {
if (surroundView3dSession) {
const size_t numViews =
mFuzzedDataProvider.ConsumeIntegralInRange<size_t>(1, kMaxViews);
@@ -195,7 +204,7 @@
}
},
[&]() {
- if (surroundView3dSession) {
+ if (surroundView3dSession && mIs3dStreamStarted) {
Sv3dConfig config;
config.width = mFuzzedDataProvider.ConsumeIntegralInRange<uint32_t>(
kMinConfigDimension, kMaxConfigDimension);
@@ -306,8 +315,11 @@
}
},
[&]() {
- mSurroundViewService->stop3dSession(
+ SvResult result = mSurroundViewService->stop3dSession(
mFuzzedDataProvider.ConsumeBool() ? surroundView3dSession : nullptr);
+ if (result == SvResult::OK) {
+ mIs3dStreamStarted = false;
+ }
},
});
surroundView3dFunc();
@@ -315,6 +327,10 @@
if (surroundView3dSession && mIs3dStreamStarted) {
surroundView3dSession->stopStream();
}
+
+ if (surroundView3dSession) {
+ mSurroundViewService->stop3dSession(surroundView3dSession);
+ }
}
void SurroundViewFuzzer::process() {
diff --git a/automotive/vehicle/2.0/default/tests/fuzzer/VehicleManager_fuzzer.cpp b/automotive/vehicle/2.0/default/tests/fuzzer/VehicleManager_fuzzer.cpp
index 796c08f..8a085e5 100644
--- a/automotive/vehicle/2.0/default/tests/fuzzer/VehicleManager_fuzzer.cpp
+++ b/automotive/vehicle/2.0/default/tests/fuzzer/VehicleManager_fuzzer.cpp
@@ -161,10 +161,13 @@
hidl_string debugOption = mFuzzedDataProvider->PickValueInArray(
{"--help", "--list", "--get", "--set", "", "invalid"});
hidl_handle fd = {};
- fd.setTo(native_handle_create(/*numFds=*/1, /*numInts=*/0), /*shouldOwn=*/true);
+
+ native_handle_t* rawHandle = native_handle_create(/*numFds=*/1, /*numInts=*/0);
+ fd.setTo(native_handle_clone(rawHandle), /*shouldOwn=*/true);
mManager->debug(fd, {});
mManager->debug(fd, {debugOption});
+ native_handle_delete(rawHandle);
}
void VehicleHalManagerFuzzer::invokePropConfigs() {
diff --git a/automotive/vehicle/OWNERS b/automotive/vehicle/OWNERS
index 429ec39..d6969e5 100644
--- a/automotive/vehicle/OWNERS
+++ b/automotive/vehicle/OWNERS
@@ -1,3 +1,2 @@
ericjeong@google.com
-keunyoung@google.com
shanyu@google.com
diff --git a/common/aidl/Android.bp b/common/aidl/Android.bp
index 7f6890c..1457b8a 100644
--- a/common/aidl/Android.bp
+++ b/common/aidl/Android.bp
@@ -36,6 +36,9 @@
],
min_sdk_version: "29",
},
+ rust: {
+ enabled: true,
+ },
},
frozen: true,
versions: [
diff --git a/common/fmq/aidl/Android.bp b/common/fmq/aidl/Android.bp
index 148c63c..ad86aaf 100644
--- a/common/fmq/aidl/Android.bp
+++ b/common/fmq/aidl/Android.bp
@@ -37,6 +37,9 @@
],
min_sdk_version: "29",
},
+ rust: {
+ enabled: true,
+ },
},
frozen: true,
versions_with_info: [
diff --git a/contexthub/aidl/default/Android.bp b/contexthub/aidl/default/Android.bp
index 269057a..4bcdda8 100644
--- a/contexthub/aidl/default/Android.bp
+++ b/contexthub/aidl/default/Android.bp
@@ -57,3 +57,34 @@
],
srcs: ["main.cpp"],
}
+
+prebuilt_etc {
+ name: "android.hardware.contexthub-service.example.rc",
+ src: "android.hardware.contexthub-service.example.rc",
+ installable: false,
+}
+
+prebuilt_etc {
+ name: "contexthub-default.xml",
+ src: "contexthub-default.xml",
+ sub_dir: "vintf",
+ installable: false,
+}
+
+apex {
+ name: "com.android.hardware.contexthub",
+ vendor: true,
+ manifest: "apex_manifest.json",
+ file_contexts: "apex_file_contexts",
+ key: "com.android.hardware.key",
+ certificate: ":com.android.hardware.certificate",
+ updatable: false,
+
+ binaries: [
+ "android.hardware.contexthub-service.example",
+ ],
+ prebuilts: [
+ "android.hardware.contexthub-service.example.rc",
+ "contexthub-default.xml",
+ ],
+}
diff --git a/contexthub/aidl/default/android.hardware.contexthub-service.example.rc b/contexthub/aidl/default/android.hardware.contexthub-service.example.rc
new file mode 100644
index 0000000..7d5d2aa
--- /dev/null
+++ b/contexthub/aidl/default/android.hardware.contexthub-service.example.rc
@@ -0,0 +1,4 @@
+service vendor.contexthub-default /apex/com.android.hardware.contexthub/bin/hw/android.hardware.contexthub-service.example
+ class hal
+ user context_hub
+ group context_hub
diff --git a/contexthub/aidl/default/apex_file_contexts b/contexthub/aidl/default/apex_file_contexts
new file mode 100644
index 0000000..c3c67df
--- /dev/null
+++ b/contexthub/aidl/default/apex_file_contexts
@@ -0,0 +1,3 @@
+(/.*)? u:object_r:vendor_file:s0
+/etc(/.*)? u:object_r:vendor_configs_file:s0
+/bin/hw/android\.hardware\.contexthub-service\.example u:object_r:hal_contexthub_default_exec:s0
diff --git a/contexthub/aidl/default/apex_manifest.json b/contexthub/aidl/default/apex_manifest.json
new file mode 100644
index 0000000..aed7081
--- /dev/null
+++ b/contexthub/aidl/default/apex_manifest.json
@@ -0,0 +1,4 @@
+{
+ "name": "com.android.hardware.contexthub",
+ "version": 1
+}
\ No newline at end of file
diff --git a/drm/aidl/vts/Android.bp b/drm/aidl/vts/Android.bp
index 190f60d..5139036 100644
--- a/drm/aidl/vts/Android.bp
+++ b/drm/aidl/vts/Android.bp
@@ -59,13 +59,13 @@
data: [":libvtswidevine-arm-prebuilts"],
},
arm64: {
- data: [":libvtswidevine-arm64-prebuilts"],
+ data: [":libvtswidevine-arm64-prebuilts", ":libvtswidevine-arm-prebuilts"],
},
x86: {
data: [":libvtswidevine-x86-prebuilts"],
},
x86_64: {
- data: [":libvtswidevine-x86_64-prebuilts"],
+ data: [":libvtswidevine-x86_64-prebuilts", ":libvtswidevine-x86-prebuilts"],
},
},
test_suites: [
diff --git a/dumpstate/aidl/default/Android.bp b/dumpstate/aidl/default/Android.bp
index 45fdc17..a9da69c 100644
--- a/dumpstate/aidl/default/Android.bp
+++ b/dumpstate/aidl/default/Android.bp
@@ -44,3 +44,41 @@
"-DLOG_TAG=\"android.hardware.dumpstate-service.example\"",
],
}
+
+prebuilt_etc {
+ name: "dumpstate-default.xml",
+ src: "dumpstate-default.xml",
+ sub_dir: "vintf",
+ installable: false,
+}
+
+prebuilt_etc {
+ name: "dumpstate-default.rc",
+ src: ":gen-dumpstate-default.rc-for-apex",
+ installable: false,
+}
+
+genrule {
+ name: "gen-dumpstate-default.rc-for-apex",
+ srcs: ["dumpstate-default.rc"],
+ out: ["dumpstate-default-apex.rc"],
+ cmd: "sed -E 's/\\/vendor\\/bin\\/hw/\\/apex\\/com.android.hardware.dumpstate\\/bin\\/hw/' $(in) > $(out)",
+}
+
+apex {
+ name: "com.android.hardware.dumpstate",
+ vendor: true,
+ manifest: "apex_manifest.json",
+ file_contexts: "apex_file_contexts",
+ key: "com.android.hardware.key",
+ certificate: ":com.android.hardware.certificate",
+ updatable: false,
+
+ binaries: [
+ "android.hardware.dumpstate-service.example",
+ ],
+ prebuilts: [
+ "dumpstate-default.rc",
+ "dumpstate-default.xml",
+ ],
+}
diff --git a/dumpstate/aidl/default/apex_file_contexts b/dumpstate/aidl/default/apex_file_contexts
new file mode 100644
index 0000000..91153a9
--- /dev/null
+++ b/dumpstate/aidl/default/apex_file_contexts
@@ -0,0 +1,3 @@
+(/.*)? u:object_r:vendor_file:s0
+/etc(/.*)? u:object_r:vendor_configs_file:s0
+/bin/hw/android\.hardware\.dumpstate-service\.example u:object_r:hal_dumpstate_default_exec:s0
\ No newline at end of file
diff --git a/dumpstate/aidl/default/apex_manifest.json b/dumpstate/aidl/default/apex_manifest.json
new file mode 100644
index 0000000..32beea4
--- /dev/null
+++ b/dumpstate/aidl/default/apex_manifest.json
@@ -0,0 +1,4 @@
+{
+ "name": "com.android.hardware.dumpstate",
+ "version": 1
+}
\ No newline at end of file
diff --git a/health/1.0/default/convert.cpp b/health/1.0/default/convert.cpp
index 31b4679..e12e197 100644
--- a/health/1.0/default/convert.cpp
+++ b/health/1.0/default/convert.cpp
@@ -117,7 +117,7 @@
info.batteryCycleCount = p->batteryCycleCount;
info.batteryFullCharge = p->batteryFullCharge;
info.batteryChargeCounter = p->batteryChargeCounter;
- info.batteryTechnology = p->batteryTechnology;
+ info.batteryTechnology = p->batteryTechnology.c_str();
}
void convertFromHealthInfo(const HealthInfo& info,
diff --git a/keymaster/4.0/vts/functional/HmacKeySharingTest.cpp b/keymaster/4.0/vts/functional/HmacKeySharingTest.cpp
index f57a668..1bff076 100644
--- a/keymaster/4.0/vts/functional/HmacKeySharingTest.cpp
+++ b/keymaster/4.0/vts/functional/HmacKeySharingTest.cpp
@@ -137,7 +137,7 @@
auto nonces = copyNonces(params);
EXPECT_EQ(allKeymasters().size(), nonces.size());
std::sort(nonces.begin(), nonces.end());
- std::unique(nonces.begin(), nonces.end());
+ nonces.erase(std::unique(nonces.begin(), nonces.end()), nonces.end());
EXPECT_EQ(allKeymasters().size(), nonces.size());
auto responses = computeSharedHmac(allKeymasters(), params);
diff --git a/media/bufferpool/aidl/Android.bp b/media/bufferpool/aidl/Android.bp
index b01cdbe..10de755 100644
--- a/media/bufferpool/aidl/Android.bp
+++ b/media/bufferpool/aidl/Android.bp
@@ -46,5 +46,8 @@
],
min_sdk_version: "29",
},
+ rust: {
+ enabled: true,
+ },
},
}
diff --git a/media/c2/aidl/Android.bp b/media/c2/aidl/Android.bp
index 75d74ac..3f2cadb 100644
--- a/media/c2/aidl/Android.bp
+++ b/media/c2/aidl/Android.bp
@@ -11,11 +11,12 @@
aidl_interface {
name: "android.hardware.media.c2",
+ min_sdk_version: "31",
vendor_available: true,
double_loadable: true,
srcs: ["android/hardware/media/c2/*.aidl"],
- include_dirs: [
- "frameworks/base/core/java",
+ headers: [
+ "HardwareBuffer_aidl",
],
imports: [
"android.hardware.common-V2",
@@ -31,6 +32,11 @@
},
ndk: {
enabled: true,
+ apex_available: [
+ "//apex_available:platform",
+ "com.android.media.swcodec",
+ "test_com.android.media.swcodec",
+ ],
additional_shared_libraries: [
"libnativewindow",
],
diff --git a/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/IGraphicBufferAllocator.aidl b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/IGraphicBufferAllocator.aidl
index da3d5ff..3e460dd 100644
--- a/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/IGraphicBufferAllocator.aidl
+++ b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/IGraphicBufferAllocator.aidl
@@ -36,7 +36,7 @@
interface IGraphicBufferAllocator {
android.hardware.media.c2.IGraphicBufferAllocator.Allocation allocate(in android.hardware.media.c2.IGraphicBufferAllocator.Description desc);
boolean deallocate(in long id);
- android.hardware.media.c2.IGraphicBufferAllocator.WaitableFds getWaitableFds();
+ ParcelFileDescriptor getWaitableFd();
parcelable Allocation {
android.hardware.HardwareBuffer buffer;
ParcelFileDescriptor fence;
@@ -47,8 +47,4 @@
int format;
long usage;
}
- parcelable WaitableFds {
- ParcelFileDescriptor allocEvent;
- ParcelFileDescriptor statusEvent;
- }
}
diff --git a/media/c2/aidl/android/hardware/media/c2/IGraphicBufferAllocator.aidl b/media/c2/aidl/android/hardware/media/c2/IGraphicBufferAllocator.aidl
index 1c97214..49c4ea4 100644
--- a/media/c2/aidl/android/hardware/media/c2/IGraphicBufferAllocator.aidl
+++ b/media/c2/aidl/android/hardware/media/c2/IGraphicBufferAllocator.aidl
@@ -75,31 +75,22 @@
boolean deallocate(in long id);
/**
- * Fds for waitable object events.
- *
- * Fds are created by eventfd() with semaphore mode.
- * For allocEvent, An integer counter regarding dequeuable buffer count is maintained
- * by client using read()/write() to the fd. The fd can be checked whether it is
- * readable via poll(). When in readable status, the specified counter is positive
- * so allocate/dequeue can happen.
- *
- * For statusEvent, the client can notify further allocation is not feasible.
- * e.g.) life-cycle of the underlying allocator is ended.
- *
- * C2Fence object should be implemented based on this Fds. Thus, C2Fence can return
- * either by allocation being ready or allocation being infeasible by the client status
- * change.
- */
- parcelable WaitableFds {
- ParcelFileDescriptor allocEvent;
- ParcelFileDescriptor statusEvent;
- }
-
- /**
- * Gets waiable file descriptors.
+ * Gets a waitable file descriptor.
*
* Use this method once and cache it in order not to create unnecessary duplicated fds.
- * The returned array will have two fds.
+ *
+ * Two file descriptors are created by pipe2(), and the reading end will be returned
+ * and shared by this method. Whenever a dequeuable buffer is ready a byte will be
+ * written to the writing end. Whenever a buffer is allocated(or dequeued) a byte will
+ * be read from the reading end.
+ *
+ * The returned file descriptor(the reading end) can be polled whether the read is ready
+ * via ::poll(). If no more allocate() can be fulfilled(by status change or etc.), the
+ * writing end will be closed. In the case, POLLHUP event can be retrieved via ::poll().
+ *
+ * C2Fence object should be implemented based on this Fd. Thus, C2Fence can return
+ * either by allocation being ready or allocation being infeasible by the client status
+ * change.
*
* If many waitable objects based on the same fd are competing, all watiable objects will be
* notified. After being notified, they should invoke allocate(). At least one of them can
@@ -110,5 +101,5 @@
* @return an fd array which will be wrapped to C2Fence and will be waited for
* until allocating is unblocked.
*/
- WaitableFds getWaitableFds();
+ ParcelFileDescriptor getWaitableFd();
}
diff --git a/secure_element/aidl/vts/VtsHalSecureElementTargetTest.cpp b/secure_element/aidl/vts/VtsHalSecureElementTargetTest.cpp
index 97b4e27..9678da4 100644
--- a/secure_element/aidl/vts/VtsHalSecureElementTargetTest.cpp
+++ b/secure_element/aidl/vts/VtsHalSecureElementTargetTest.cpp
@@ -293,11 +293,13 @@
std::vector<uint8_t> response;
LogicalChannelResponse logical_channel_response;
+ /* Temporaly disable this check to clarify Basic Channel behavior (b/300502872)
// Note: no channel is opened for this test
// transmit() will return an empty response with the error
// code CHANNEL_NOT_AVAILABLE when the SE cannot be
// communicated with.
EXPECT_ERR(secure_element_->transmit(kDataApdu, &response));
+ */
EXPECT_OK(secure_element_->openLogicalChannel(kSelectableAid, 0x00, &logical_channel_response));
EXPECT_GE(logical_channel_response.selectResponse.size(), 2u);
diff --git a/security/keymint/aidl/vts/functional/AttestKeyTest.cpp b/security/keymint/aidl/vts/functional/AttestKeyTest.cpp
index 4c46719..cc97c13 100644
--- a/security/keymint/aidl/vts/functional/AttestKeyTest.cpp
+++ b/security/keymint/aidl/vts/functional/AttestKeyTest.cpp
@@ -88,30 +88,6 @@
return imei;
}
-
-// Use `ro.product.<property>_for_attestation` property for attestation if it is present else
-// fallback to use `ro.product.vendor.<property>` if it is present else fallback to
-// `ro.product.<property>`. Similar logic can be seen in Java method `getVendorDeviceIdProperty`
-// in frameworks/base/core/java/android/os/Build.java.
-template <Tag tag>
-void add_attestation_id(AuthorizationSetBuilder* attestation_id_tags,
- TypedTag<TagType::BYTES, tag> tag_type, const char* prop) {
- ::android::String8 prop_name =
- ::android::String8::format("ro.product.%s_for_attestation", prop);
- std::string prop_value = ::android::base::GetProperty(prop_name.c_str(), /* default= */ "");
- if (!prop_value.empty()) {
- add_tag_from_prop(attestation_id_tags, tag_type, prop_name.c_str());
- } else {
- prop_name = ::android::String8::format("ro.product.vendor.%s", prop);
- prop_value = ::android::base::GetProperty(prop_name.c_str(), /* default= */ "");
- if (!prop_value.empty()) {
- add_tag_from_prop(attestation_id_tags, tag_type, prop_name.c_str());
- } else {
- prop_name = ::android::String8::format("ro.product.%s", prop);
- add_tag_from_prop(attestation_id_tags, tag_type, prop_name.c_str());
- }
- }
-}
} // namespace
class AttestKeyTest : public KeyMintAidlTestBase {
diff --git a/security/keymint/aidl/vts/functional/KeyMintAidlTestBase.cpp b/security/keymint/aidl/vts/functional/KeyMintAidlTestBase.cpp
index 5f8ec0e..3a8a1e8 100644
--- a/security/keymint/aidl/vts/functional/KeyMintAidlTestBase.cpp
+++ b/security/keymint/aidl/vts/functional/KeyMintAidlTestBase.cpp
@@ -841,7 +841,7 @@
int vendor_api_level = property_get_int32("ro.vendor.api_level", 0);
if (SecLevel() == SecurityLevel::STRONGBOX) {
// This is known to be broken on older vendor implementations.
- if (vendor_api_level < __ANDROID_API_T__) {
+ if (vendor_api_level <= __ANDROID_API_U__) {
compare_output = false;
} else {
additional_information = " (b/194134359) ";
diff --git a/security/keymint/aidl/vts/functional/KeyMintAidlTestBase.h b/security/keymint/aidl/vts/functional/KeyMintAidlTestBase.h
index 8934a57..9778b3d 100644
--- a/security/keymint/aidl/vts/functional/KeyMintAidlTestBase.h
+++ b/security/keymint/aidl/vts/functional/KeyMintAidlTestBase.h
@@ -454,6 +454,29 @@
::android::PrintInstanceNameToString); \
GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(name);
+// Use `ro.product.<property>_for_attestation` property for attestation if it is present else
+// fallback to use `ro.product.vendor.<property>` if it is present else fallback to
+// `ro.product.<property>`. Similar logic can be seen in Java method `getVendorDeviceIdProperty`
+// in frameworks/base/core/java/android/os/Build.java.
+template <Tag tag>
+void add_attestation_id(AuthorizationSetBuilder* attestation_id_tags,
+ TypedTag<TagType::BYTES, tag> tag_type, const char* prop) {
+ ::android::String8 prop_name =
+ ::android::String8::format("ro.product.%s_for_attestation", prop);
+ std::string prop_value = ::android::base::GetProperty(prop_name.c_str(), /* default= */ "");
+ if (!prop_value.empty()) {
+ add_tag_from_prop(attestation_id_tags, tag_type, prop_name.c_str());
+ } else {
+ prop_name = ::android::String8::format("ro.product.vendor.%s", prop);
+ prop_value = ::android::base::GetProperty(prop_name.c_str(), /* default= */ "");
+ if (!prop_value.empty()) {
+ add_tag_from_prop(attestation_id_tags, tag_type, prop_name.c_str());
+ } else {
+ prop_name = ::android::String8::format("ro.product.%s", prop);
+ add_tag_from_prop(attestation_id_tags, tag_type, prop_name.c_str());
+ }
+ }
+}
} // namespace test
} // namespace aidl::android::hardware::security::keymint
diff --git a/security/keymint/aidl/vts/functional/KeyMintTest.cpp b/security/keymint/aidl/vts/functional/KeyMintTest.cpp
index 5c3d8cc..de563c4 100644
--- a/security/keymint/aidl/vts/functional/KeyMintTest.cpp
+++ b/security/keymint/aidl/vts/functional/KeyMintTest.cpp
@@ -2082,11 +2082,6 @@
* attestation extension.
*/
TEST_P(NewKeyGenerationTest, EcdsaAttestationIdTags) {
- if (is_gsi_image()) {
- // GSI sets up a standard set of device identifiers that may not match
- // the device identifiers held by the device.
- GTEST_SKIP() << "Test not applicable under GSI";
- }
auto challenge = "hello";
auto app_id = "foo";
auto subject = "cert subj 2";
@@ -2106,38 +2101,12 @@
// Various ATTESTATION_ID_* tags that map to fields in the attestation extension ASN.1 schema.
auto extra_tags = AuthorizationSetBuilder();
- // Use ro.product.brand_for_attestation property for attestation if it is present else fallback
- // to ro.product.brand
- std::string prop_value =
- ::android::base::GetProperty("ro.product.brand_for_attestation", /* default= */ "");
- if (!prop_value.empty()) {
- add_tag_from_prop(&extra_tags, TAG_ATTESTATION_ID_BRAND,
- "ro.product.brand_for_attestation");
- } else {
- add_tag_from_prop(&extra_tags, TAG_ATTESTATION_ID_BRAND, "ro.product.brand");
- }
- add_tag_from_prop(&extra_tags, TAG_ATTESTATION_ID_DEVICE, "ro.product.device");
- // Use ro.product.name_for_attestation property for attestation if it is present else fallback
- // to ro.product.name
- prop_value = ::android::base::GetProperty("ro.product.name_for_attestation", /* default= */ "");
- if (!prop_value.empty()) {
- add_tag_from_prop(&extra_tags, TAG_ATTESTATION_ID_PRODUCT,
- "ro.product.name_for_attestation");
- } else {
- add_tag_from_prop(&extra_tags, TAG_ATTESTATION_ID_PRODUCT, "ro.product.name");
- }
+ add_attestation_id(&extra_tags, TAG_ATTESTATION_ID_BRAND, "brand");
+ add_attestation_id(&extra_tags, TAG_ATTESTATION_ID_DEVICE, "device");
+ add_attestation_id(&extra_tags, TAG_ATTESTATION_ID_PRODUCT, "name");
+ add_attestation_id(&extra_tags, TAG_ATTESTATION_ID_MANUFACTURER, "manufacturer");
+ add_attestation_id(&extra_tags, TAG_ATTESTATION_ID_MODEL, "model");
add_tag_from_prop(&extra_tags, TAG_ATTESTATION_ID_SERIAL, "ro.serialno");
- add_tag_from_prop(&extra_tags, TAG_ATTESTATION_ID_MANUFACTURER, "ro.product.manufacturer");
- // Use ro.product.model_for_attestation property for attestation if it is present else fallback
- // to ro.product.model
- prop_value =
- ::android::base::GetProperty("ro.product.model_for_attestation", /* default= */ "");
- if (!prop_value.empty()) {
- add_tag_from_prop(&extra_tags, TAG_ATTESTATION_ID_MODEL,
- "ro.product.model_for_attestation");
- } else {
- add_tag_from_prop(&extra_tags, TAG_ATTESTATION_ID_MODEL, "ro.product.model");
- }
for (const KeyParameter& tag : extra_tags) {
SCOPED_TRACE(testing::Message() << "tag-" << tag);
@@ -4828,7 +4797,7 @@
EXPECT_EQ(ErrorCode::OK, Begin(KeyPurpose::DECRYPT, params));
string result;
- EXPECT_EQ(ErrorCode::UNKNOWN_ERROR, Finish(ciphertext1, &result));
+ EXPECT_NE(ErrorCode::OK, Finish(ciphertext1, &result));
EXPECT_EQ(0U, result.size());
}
}
@@ -5336,7 +5305,7 @@
EXPECT_EQ(ErrorCode::OK, Begin(KeyPurpose::DECRYPT, params));
string result;
- EXPECT_EQ(ErrorCode::UNKNOWN_ERROR, Finish(ciphertext1, &result));
+ EXPECT_NE(ErrorCode::OK, Finish(ciphertext1, &result));
EXPECT_EQ(0U, result.size());
}
}
@@ -5403,7 +5372,7 @@
.Digest(Digest::SHA_2_256)
.Padding(PaddingMode::RSA_OAEP)));
string result;
- EXPECT_EQ(ErrorCode::UNKNOWN_ERROR, Finish(ciphertext, &result));
+ EXPECT_NE(ErrorCode::OK, Finish(ciphertext, &result));
EXPECT_EQ(0U, result.size());
}
@@ -5473,7 +5442,7 @@
EXPECT_EQ(ErrorCode::OK, Begin(KeyPurpose::DECRYPT, params));
string result;
- EXPECT_EQ(ErrorCode::UNKNOWN_ERROR, Finish(ciphertext1, &result));
+ EXPECT_NE(ErrorCode::OK, Finish(ciphertext1, &result));
EXPECT_EQ(0U, result.size());
}
}
@@ -5517,7 +5486,7 @@
EXPECT_EQ(ErrorCode::OK, Begin(KeyPurpose::DECRYPT, params));
string result;
- EXPECT_EQ(ErrorCode::UNKNOWN_ERROR, Finish(ciphertext, &result));
+ EXPECT_NE(ErrorCode::OK, Finish(ciphertext, &result));
EXPECT_EQ(0U, result.size());
}
@@ -5649,7 +5618,7 @@
EXPECT_EQ(ErrorCode::OK, Begin(KeyPurpose::DECRYPT, params));
string result;
- EXPECT_EQ(ErrorCode::UNKNOWN_ERROR, Finish(ciphertext1, &result));
+ EXPECT_NE(ErrorCode::OK, Finish(ciphertext1, &result));
EXPECT_EQ(0U, result.size());
}
diff --git a/security/keymint/support/remote_prov_utils.cpp b/security/keymint/support/remote_prov_utils.cpp
index 780c3d2..34f7ce4 100644
--- a/security/keymint/support/remote_prov_utils.cpp
+++ b/security/keymint/support/remote_prov_utils.cpp
@@ -962,6 +962,20 @@
return signedRequest->value();
}
+ErrMsgOr<hwtrust::DiceChain::Kind> getDiceChainKind() {
+ int vendor_api_level = ::android::base::GetIntProperty("ro.vendor.api_level", -1);
+ switch (vendor_api_level) {
+ case __ANDROID_API_T__:
+ return hwtrust::DiceChain::Kind::kVsr13;
+ case __ANDROID_API_U__:
+ return hwtrust::DiceChain::Kind::kVsr14;
+ case __ANDROID_API_V__:
+ return hwtrust::DiceChain::Kind::kVsr15;
+ default:
+ return "Unsupported vendor API level: " + std::to_string(vendor_api_level);
+ }
+}
+
ErrMsgOr<bytevec> parseAndValidateAuthenticatedRequest(const std::vector<uint8_t>& request,
const std::vector<uint8_t>& challenge) {
auto [parsedRequest, _, csrErrMsg] = cppbor::parse(request);
@@ -996,7 +1010,12 @@
}
// DICE chain is [ pubkey, + DiceChainEntry ].
- auto diceContents = validateBcc(diceCertChain, hwtrust::DiceChain::Kind::kVsr14);
+ auto diceChainKind = getDiceChainKind();
+ if (!diceChainKind) {
+ return diceChainKind.message();
+ }
+
+ auto diceContents = validateBcc(diceCertChain, *diceChainKind);
if (!diceContents) {
return diceContents.message() + "\n" + prettyPrint(diceCertChain);
}
diff --git a/security/rkp/aidl/android/hardware/security/keymint/generateCertificateRequestV2.cddl b/security/rkp/aidl/android/hardware/security/keymint/generateCertificateRequestV2.cddl
index 80f7cbd..15b0442 100644
--- a/security/rkp/aidl/android/hardware/security/keymint/generateCertificateRequestV2.cddl
+++ b/security/rkp/aidl/android/hardware/security/keymint/generateCertificateRequestV2.cddl
@@ -90,9 +90,10 @@
DiceChainEntryPayload = { ; CWT [RFC8392]
1 : tstr, ; Issuer
2 : tstr, ; Subject
+ -4670554 : "android.15", ; Profile Name
-4670552 : bstr .cbor PubKeyEd25519 /
bstr .cbor PubKeyECDSA256 /
- bstr .cbor PubKeyECDSA384, ; Subject Public Key
+ bstr .cbor PubKeyECDSA384, ; Subject Public Key
-4670553 : bstr ; Key Usage
; NOTE: All of the following fields may be omitted for a "Degenerate DICE Chain", as
diff --git a/security/sharedsecret/aidl/vts/functional/SharedSecretAidlTest.cpp b/security/sharedsecret/aidl/vts/functional/SharedSecretAidlTest.cpp
index 51938ba..7599bce 100644
--- a/security/sharedsecret/aidl/vts/functional/SharedSecretAidlTest.cpp
+++ b/security/sharedsecret/aidl/vts/functional/SharedSecretAidlTest.cpp
@@ -164,7 +164,7 @@
auto nonces = copyNonces(params);
EXPECT_EQ(sharedSecrets.size(), nonces.size());
std::sort(nonces.begin(), nonces.end());
- std::unique(nonces.begin(), nonces.end());
+ nonces.erase(std::unique(nonces.begin(), nonces.end()), nonces.end());
EXPECT_EQ(sharedSecrets.size(), nonces.size());
auto responses = computeAllSharedSecrets(params);
diff --git a/wifi/hostapd/1.0/vts/functional/hostapd_hidl_test.cpp b/wifi/hostapd/1.0/vts/functional/hostapd_hidl_test.cpp
index bb99ae4..46cba93 100644
--- a/wifi/hostapd/1.0/vts/functional/hostapd_hidl_test.cpp
+++ b/wifi/hostapd/1.0/vts/functional/hostapd_hidl_test.cpp
@@ -48,6 +48,13 @@
virtual void SetUp() override {
wifi_instance_name_ = std::get<0>(GetParam());
hostapd_instance_name_ = std::get<1>(GetParam());
+
+ // Disable Wi-Fi framework to avoid interference
+ isWifiEnabled_ = isWifiFrameworkEnabled();
+ isScanAlwaysEnabled_ = isWifiScanAlwaysAvailable();
+ toggleWifiFramework(false);
+ toggleWifiScanAlwaysAvailable(false);
+
stopSupplicantIfNeeded(wifi_instance_name_);
startHostapdAndWaitForHidlService(wifi_instance_name_,
hostapd_instance_name_);
@@ -58,14 +65,21 @@
virtual void TearDown() override {
HIDL_INVOKE_VOID_WITHOUT_ARGUMENTS(hostapd_, terminate);
stopHostapd(wifi_instance_name_);
+
+ // Restore Wi-Fi framework state
+ toggleWifiFramework(isWifiEnabled_);
+ toggleWifiScanAlwaysAvailable(isScanAlwaysEnabled_);
}
protected:
- std::string getPrimaryWlanIfaceName() {
+ bool isWifiEnabled_ = false;
+ bool isScanAlwaysEnabled_ = false;
+
+ std::string getPrimaryWlanIfaceName() {
std::array<char, PROPERTY_VALUE_MAX> buffer;
property_get("wifi.interface", buffer.data(), "wlan0");
return buffer.data();
- }
+ }
IHostapd::IfaceParams getIfaceParamsWithAcs() {
IHostapd::IfaceParams iface_params;
diff --git a/wifi/hostapd/1.0/vts/functional/hostapd_hidl_test_utils.cpp b/wifi/hostapd/1.0/vts/functional/hostapd_hidl_test_utils.cpp
index 75d6252..3ae9b39 100644
--- a/wifi/hostapd/1.0/vts/functional/hostapd_hidl_test_utils.cpp
+++ b/wifi/hostapd/1.0/vts/functional/hostapd_hidl_test_utils.cpp
@@ -100,3 +100,24 @@
::android::hardware::wifi::hostapd::V1_1::IHostapd::castFrom(hostapd);
return hostapd_1_1.get() != nullptr;
}
+
+void toggleWifiFramework(bool enable) {
+ std::string cmd = "/system/bin/cmd wifi set-wifi-enabled ";
+ cmd += enable ? "enabled" : "disabled";
+ testing::checkSubstringInCommandOutput(cmd.c_str(), "X");
+}
+
+void toggleWifiScanAlwaysAvailable(bool enable) {
+ std::string cmd = "/system/bin/cmd wifi set-scan-always-available ";
+ cmd += enable ? "enabled" : "disabled";
+ testing::checkSubstringInCommandOutput(cmd.c_str(), "X");
+}
+
+bool isWifiFrameworkEnabled() {
+ return testing::checkSubstringInCommandOutput("/system/bin/cmd wifi status", "Wifi is enabled");
+}
+
+bool isWifiScanAlwaysAvailable() {
+ return testing::checkSubstringInCommandOutput("/system/bin/cmd wifi status",
+ "Wifi scanning is always available");
+}
diff --git a/wifi/hostapd/1.0/vts/functional/hostapd_hidl_test_utils.h b/wifi/hostapd/1.0/vts/functional/hostapd_hidl_test_utils.h
index 5cb4f01..ea7c112 100644
--- a/wifi/hostapd/1.0/vts/functional/hostapd_hidl_test_utils.h
+++ b/wifi/hostapd/1.0/vts/functional/hostapd_hidl_test_utils.h
@@ -17,14 +17,17 @@
#ifndef HOSTAPD_HIDL_TEST_UTILS_H
#define HOSTAPD_HIDL_TEST_UTILS_H
+#include <VtsCoreUtil.h>
#include <android/hardware/wifi/hostapd/1.0/IHostapd.h>
#include <android/hardware/wifi/hostapd/1.1/IHostapd.h>
// Used to stop the android wifi framework before every test.
-void stopWifiFramework(const std::string& instance_name);
-void startWifiFramework(const std::string& instance_name);
void stopSupplicantIfNeeded(const std::string& instance_name);
void stopHostapd(const std::string& instance_name);
+void toggleWifiFramework(bool enable);
+void toggleWifiScanAlwaysAvailable(bool enable);
+bool isWifiFrameworkEnabled();
+bool isWifiScanAlwaysAvailable();
// Used to configure the chip, driver and start wpa_hostapd before every
// test.
void startHostapdAndWaitForHidlService(