Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 197f9bc2 authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

Snap for 11740859 from b5ff39fb to 24Q3-release

Change-Id: Iab492baf3716252c745451ae83f419dc87c28f14
parents 6d6aab99 b5ff39fb
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -551,6 +551,11 @@ std::vector<AudioPortConfig> ModuleConfig::generateAudioDevicePortConfigs(
    return result;
}

std::optional<AudioPort> ModuleConfig::getPort(int32_t portId) {
    auto portsIt = findById(mPorts, portId);
    return portsIt != mPorts.end() ? std::optional<AudioPort>(*portsIt) : std::nullopt;
}

ndk::ScopedAStatus ModuleConfig::onExternalDeviceConnected(IModule* module, const AudioPort& port) {
    RETURN_STATUS_IF_ERROR(module->getAudioPorts(&mPorts));
    RETURN_STATUS_IF_ERROR(module->getAudioRoutes(&mRoutes));
+2 −0
Original line number Diff line number Diff line
@@ -166,6 +166,8 @@ class ModuleConfig {
        return *config.begin();
    }

    std::optional<aidl::android::media::audio::common::AudioPort> getPort(int32_t portId);

    ndk::ScopedAStatus onExternalDeviceConnected(
            aidl::android::hardware::audio::core::IModule* module,
            const aidl::android::media::audio::common::AudioPort& port);
+30 −9
Original line number Diff line number Diff line
@@ -133,13 +133,23 @@ auto findAny(const std::vector<T>& v, const std::set<int32_t>& ids) {
}

template <typename C>
std::vector<int32_t> GetNonExistentIds(const C& allIds) {
std::vector<int32_t> GetNonExistentIds(const C& allIds, bool includeZero = true) {
    if (allIds.empty()) {
        return std::vector<int32_t>{-1, 0, 1};
        return includeZero ? std::vector<int32_t>{-1, 0, 1} : std::vector<int32_t>{-1, 1};
    }
    std::vector<int32_t> nonExistentIds;
    nonExistentIds.push_back(*std::min_element(allIds.begin(), allIds.end()) - 1);
    nonExistentIds.push_back(*std::max_element(allIds.begin(), allIds.end()) + 1);
    if (auto value = *std::min_element(allIds.begin(), allIds.end()) - 1;
        includeZero || value != 0) {
        nonExistentIds.push_back(value);
    } else {
        nonExistentIds.push_back(value - 1);
    }
    if (auto value = *std::max_element(allIds.begin(), allIds.end()) + 1;
        includeZero || value != 0) {
        nonExistentIds.push_back(value);
    } else {
        nonExistentIds.push_back(value + 1);
    }
    return nonExistentIds;
}

@@ -1040,7 +1050,9 @@ class StreamWriterLogic : public StreamCommonLogic {
                       << ": received invalid byte count in the reply: " << reply.fmqByteCount;
            return Status::ABORT;
        }
        if (getDataMQ()->availableToWrite() != getDataMQ()->getQuantumCount()) {
        // It is OK for the implementation to leave data in the MQ when the stream is paused.
        if (reply.state != StreamDescriptor::State::PAUSED &&
            getDataMQ()->availableToWrite() != getDataMQ()->getQuantumCount()) {
            LOG(ERROR) << __func__ << ": the HAL module did not consume all data from the data MQ: "
                       << "available to write " << getDataMQ()->availableToWrite()
                       << ", total size: " << getDataMQ()->getQuantumCount();
@@ -2978,6 +2990,11 @@ static bool skipStreamIoTestForMixPortConfig(const AudioPortConfig& portConfig)
                     AudioOutputFlags::COMPRESS_OFFLOAD, AudioOutputFlags::INCALL_MUSIC}));
}

// Certain types of devices can not be used without special preconditions.
static bool skipStreamIoTestForDevice(const AudioDevice& device) {
    return device.type.type == AudioDeviceType::IN_ECHO_REFERENCE;
}

template <typename Stream>
class StreamFixtureWithWorker {
  public:
@@ -3886,6 +3903,9 @@ class AudioStreamIo : public AudioCoreModuleBase,
            GTEST_SKIP() << "No mix ports have attached devices";
        }
        for (const auto& portConfig : allPortConfigs) {
            auto port = moduleConfig->getPort(portConfig.portId);
            ASSERT_TRUE(port.has_value());
            SCOPED_TRACE(port->toString());
            SCOPED_TRACE(portConfig.toString());
            if (skipStreamIoTestForMixPortConfig(portConfig)) continue;
            const bool isNonBlocking =
@@ -3968,6 +3988,7 @@ class AudioStreamIo : public AudioCoreModuleBase,
        StreamFixture<Stream> stream;
        ASSERT_NO_FATAL_FAILURE(
                stream.SetUpStreamForMixPortConfig(module.get(), moduleConfig.get(), portConfig));
        if (skipStreamIoTestForDevice(stream.getDevice())) return;
        ASSERT_EQ("", stream.skipTestReason());
        StreamLogicDefaultDriver driver(commandsAndStates,
                                        stream.getStreamContext()->getFrameSizeBytes());
@@ -3996,6 +4017,7 @@ class AudioStreamIo : public AudioCoreModuleBase,
        StreamFixture<Stream> stream;
        ASSERT_NO_FATAL_FAILURE(
                stream.SetUpPatchForMixPortConfig(module.get(), moduleConfig.get(), portConfig));
        if (skipStreamIoTestForDevice(stream.getDevice())) return;
        ASSERT_EQ("", stream.skipTestReason());
        ASSERT_NO_FATAL_FAILURE(stream.TeardownPatchSetUpStream(module.get()));
        StreamLogicDefaultDriver driver(commandsAndStates,
@@ -4194,7 +4216,7 @@ class AudioModulePatch : public AudioCoreModule {
        // Then use the same patch setting, except for having an invalid ID.
        std::set<int32_t> patchIds;
        ASSERT_NO_FATAL_FAILURE(GetAllPatchIds(&patchIds));
        for (const auto patchId : GetNonExistentIds(patchIds)) {
        for (const auto patchId : GetNonExistentIds(patchIds, false /*includeZero*/)) {
            AudioPatch patchWithNonExistendId = patch.get();
            patchWithNonExistendId.id = patchId;
            EXPECT_STATUS(EX_ILLEGAL_ARGUMENT,
@@ -4550,9 +4572,8 @@ std::shared_ptr<StateSequence> makePauseCommands(bool isInput, bool isSync) {
                                            std::make_pair(State::PAUSED, kStartCommand),
                                            std::make_pair(State::ACTIVE, kPauseCommand),
                                            std::make_pair(State::PAUSED, kBurstCommand),
                                            std::make_pair(State::PAUSED, kStartCommand),
                                            std::make_pair(State::ACTIVE, kPauseCommand)},
                                           State::PAUSED);
                                            std::make_pair(State::PAUSED, kFlushCommand)},
                                           State::IDLE);
        if (!isSync) {
            idle.children().push_back(
                    d->makeNodes({std::make_pair(State::TRANSFERRING, kPauseCommand),
+1 −0
Original line number Diff line number Diff line
@@ -132,6 +132,7 @@ ConfigValue Config::getDefault(const std::string& name) {
}

bool Config::setInternal(const std::string& name, const ConfigValue& val) {
    LOG(INFO) << "Config::set " << name << " to " << toString(val);
    bool res = false;
    auto& data = mMap[name];

+2 −0
Original line number Diff line number Diff line
@@ -125,6 +125,8 @@ binder_status_t Fingerprint::dump(int fd, const char** /*args*/, uint32_t numArg
    }
    ::android::base::WriteStringToFd(mEngine->toString(), fd);

    ::android::base::WriteStringToFd(Fingerprint::cfg().toString(), fd);

    fsync(fd);
    return STATUS_OK;
}
Loading