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

Commit bc62c155 authored by android-build-team Robot's avatar android-build-team Robot
Browse files

Snap for 6453963 from a3f9fae5 to rvc-release

Change-Id: I585585820c574263047291d3f2a0f12d4eececb9
parents 62499d30 a3f9fae5
Loading
Loading
Loading
Loading
+24 −3
Original line number Diff line number Diff line
@@ -606,8 +606,23 @@ enum VehicleProperty : int32_t {
    /**
     * Tire pressure
     *
     * min/max value indicates tire pressure sensor range.  Each tire will have a separate min/max
     * value denoted by its areaConfig.areaId.
     * Each tires is identified by its areaConfig.areaId config and their
     * minFloatValue/maxFloatValue are used to store OEM recommended pressure
     * range.
     * The Min value in the areaConfig data represents the lower bound of
     * the recommended tire pressure.
     * The Max value in the areaConfig data represents the upper bound of
     * the recommended tire pressure.
     * For example:
     * The following areaConfig indicates the recommended tire pressure
     * of left_front tire is from 200.0 KILOPASCAL to 240.0 KILOPASCAL.
     * .areaConfigs = {
     *      VehicleAreaConfig {
     *          .areaId = VehicleAreaWheel::LEFT_FRONT,
     *          .minFloatValue = 200.0,
     *          .maxFloatValue = 240.0,
     *      }
     * },
     *
     * @change_mode VehiclePropertyChangeMode:CONTINUOUS
     * @access VehiclePropertyAccess:READ
@@ -786,7 +801,8 @@ enum VehicleProperty : int32_t {
    /*
     * HVAC Properties
     *
     * Additional rules for mapping a zoned HVAC property to AreaIDs:
     * Additional rules for mapping a zoned HVAC property (except
     * HVAC_MAX_DEFROST_ON) to AreaIDs:
     *  - Every seat in VehicleAreaSeat that is available in the car, must be
     *    part of an AreaID in the AreaID array.
     *
@@ -919,6 +935,11 @@ enum VehicleProperty : int32_t {
     * possible.  Any parameters modified as a side effect of turning on/off
     * the MAX DEFROST parameter shall generate onPropertyEvent() callbacks to
     * the VHAL.
     * The AreaIDs for HVAC_MAX_DEFROST_ON indicate MAX DEFROST can be controlled
     * in the area.
     * For example:
     * areaConfig.areaId = {ROW_1_LEFT | ROW_1_RIGHT} indicates HVAC_MAX_DEFROST_ON
     * only can be controlled for the front rows.
     *
     * @change_mode VehiclePropertyChangeMode:ON_CHANGE
     * @access VehiclePropertyAccess:READ_WRITE
+5 −1
Original line number Diff line number Diff line
@@ -76,9 +76,13 @@ TEST_P(BootHidlTest, SetSnapshotMergeStatus) {
    for (const auto value : ValidMergeStatusValues()) {
        EXPECT_TRUE(boot->setSnapshotMergeStatus(value).withDefault(false));
        auto status = boot->getSnapshotMergeStatus();
        if (value == MergeStatus::SNAPSHOTTED) {
            EXPECT_TRUE(status == MergeStatus::SNAPSHOTTED || status == MergeStatus::NONE);
        } else {
            EXPECT_EQ(status, value);
        }
    }
}

INSTANTIATE_TEST_SUITE_P(
        PerInstance, BootHidlTest,
+15 −10
Original line number Diff line number Diff line
@@ -71,7 +71,7 @@ Return<void> Demux::openFilter(const DemuxFilterType& type, uint32_t bufferSize,
    mUsedFilterIds.insert(filterId);

    if (cb == nullptr) {
        ALOGW("callback can't be null");
        ALOGW("[Demux] callback can't be null");
        _hidl_cb(Result::INVALID_ARGUMENT, new Filter());
        return Void();
    }
@@ -82,9 +82,14 @@ Return<void> Demux::openFilter(const DemuxFilterType& type, uint32_t bufferSize,
        _hidl_cb(Result::UNKNOWN_ERROR, filter);
        return Void();
    }

    mFilters[filterId] = filter;
    bool result = true;
    if (mDvr != nullptr && mDvr->getType() == DvrType::PLAYBACK) {
        result = mDvr->addPlaybackFilter(filter);
    }

    _hidl_cb(Result::SUCCESS, filter);
    _hidl_cb(result ? Result::SUCCESS : Result::INVALID_ARGUMENT, filter);
    return Void();
}

@@ -130,7 +135,7 @@ Return<void> Demux::openDvr(DvrType type, uint32_t bufferSize, const sp<IDvrCall
    ALOGV("%s", __FUNCTION__);

    if (cb == nullptr) {
        ALOGW("DVR callback can't be null");
        ALOGW("[Demux] DVR callback can't be null");
        _hidl_cb(Result::INVALID_ARGUMENT, new Dvr());
        return Void();
    }
@@ -174,11 +179,11 @@ Result Demux::removeFilter(uint32_t filterId) {

void Demux::startBroadcastTsFilter(vector<uint8_t> data) {
    set<uint32_t>::iterator it;
    for (it = mUsedFilterIds.begin(); it != mUsedFilterIds.end(); it++) {
    uint16_t pid = ((data[1] & 0x1f) << 8) | ((data[2] & 0xff));
        if (DEBUG_FILTER) {
            ALOGW("start ts filter pid: %d", pid);
    if (DEBUG_DEMUX) {
        ALOGW("[Demux] start ts filter pid: %d", pid);
    }
    for (it = mUsedFilterIds.begin(); it != mUsedFilterIds.end(); it++) {
        if (pid == mFilters[*it]->getTpid()) {
            mFilters[*it]->updateFilterOutput(data);
        }
@@ -187,10 +192,10 @@ void Demux::startBroadcastTsFilter(vector<uint8_t> data) {

void Demux::sendFrontendInputToRecord(vector<uint8_t> data) {
    set<uint32_t>::iterator it;
    for (it = mRecordFilterIds.begin(); it != mRecordFilterIds.end(); it++) {
        if (DEBUG_FILTER) {
            ALOGW("update record filter output");
    if (DEBUG_DEMUX) {
        ALOGW("[Demux] update record filter output");
    }
    for (it = mRecordFilterIds.begin(); it != mRecordFilterIds.end(); it++) {
        mFilters[*it]->updateRecordOutput(data);
    }
}
+1 −1
Original line number Diff line number Diff line
@@ -188,7 +188,7 @@ class Demux : public IDemux {
    int mPesSizeLeft = 0;
    vector<uint8_t> mPesOutput;

    const bool DEBUG_FILTER = false;
    const bool DEBUG_DEMUX = false;
};

}  // namespace implementation
+28 −11
Original line number Diff line number Diff line
@@ -71,13 +71,10 @@ Return<Result> Dvr::attachFilter(const sp<IFilter>& filter) {
    }

    // check if the attached filter is a record filter

    mFilters[filterId] = filter;
    mIsRecordFilterAttached = true;
    if (!mDemux->attachRecordFilter(filterId)) {
        return Result::INVALID_ARGUMENT;
    }
    mDemux->setIsRecording(mIsRecordStarted | mIsRecordFilterAttached);

    return Result::SUCCESS;
}
@@ -110,7 +107,6 @@ Return<Result> Dvr::detachFilter(const sp<IFilter>& filter) {
    // If all the filters are detached, record can't be started
    if (mFilters.empty()) {
        mIsRecordFilterAttached = false;
        mDemux->setIsRecording(mIsRecordStarted | mIsRecordFilterAttached);
    }

    return Result::SUCCESS;
@@ -132,8 +128,7 @@ Return<Result> Dvr::start() {
        pthread_setname_np(mDvrThread, "playback_waiting_loop");
    } else if (mType == DvrType::RECORD) {
        mRecordStatus = RecordStatus::DATA_READY;
        mIsRecordStarted = true;
        mDemux->setIsRecording(mIsRecordStarted | mIsRecordFilterAttached);
        mDemux->setIsRecording(mType == DvrType::RECORD);
    }

    // TODO start another thread to send filter status callback to the framework
@@ -149,7 +144,7 @@ Return<Result> Dvr::stop() {
    std::lock_guard<std::mutex> lock(mDvrThreadLock);

    mIsRecordStarted = false;
    mDemux->setIsRecording(mIsRecordStarted | mIsRecordFilterAttached);
    mDemux->setIsRecording(false);

    return Result::SUCCESS;
}
@@ -175,7 +170,7 @@ bool Dvr::createDvrMQ() {
    std::unique_ptr<DvrMQ> tmpDvrMQ =
            std::unique_ptr<DvrMQ>(new (std::nothrow) DvrMQ(mBufferSize, true));
    if (!tmpDvrMQ->isValid()) {
        ALOGW("Failed to create FMQ of DVR");
        ALOGW("[Dvr] Failed to create FMQ of DVR");
        return false;
    }

@@ -256,7 +251,6 @@ bool Dvr::readPlaybackFMQ() {
    int playbackPacketSize = mDvrSettings.playback().packetSize;
    vector<uint8_t> dataOutputBuffer;
    dataOutputBuffer.resize(playbackPacketSize);

    // Dispatch the packet to the PID matching filter output buffer
    for (int i = 0; i < size / playbackPacketSize; i++) {
        if (!mDvrMQ->read(dataOutputBuffer.data(), playbackPacketSize)) {
@@ -283,7 +277,6 @@ void Dvr::startTpidFilter(vector<uint8_t> data) {

bool Dvr::startFilterDispatcher() {
    std::map<uint32_t, sp<IFilter>>::iterator it;

    // Handle the output data per filter type
    for (it = mFilters.begin(); it != mFilters.end(); it++) {
        if (mDemux->startFilterHandler(it->first) != Result::SUCCESS) {
@@ -296,7 +289,10 @@ bool Dvr::startFilterDispatcher() {

bool Dvr::writeRecordFMQ(const std::vector<uint8_t>& data) {
    std::lock_guard<std::mutex> lock(mWriteLock);
    ALOGW("[Dvr] write record FMQ");
    if (mRecordStatus == RecordStatus::OVERFLOW) {
        ALOGW("[Dvr] stops writing and wait for the client side flushing.");
        return true;
    }
    if (mDvrMQ->write(data.data(), data.size())) {
        mDvrEventFlag->wake(static_cast<uint32_t>(DemuxQueueNotifyBits::DATA_READY));
        maySendRecordStatusCallback();
@@ -333,6 +329,27 @@ RecordStatus Dvr::checkRecordStatusChange(uint32_t availableToWrite, uint32_t av
    return mRecordStatus;
}

bool Dvr::addPlaybackFilter(sp<IFilter> filter) {
    uint32_t filterId;
    Result status;

    filter->getId([&](Result result, uint32_t id) {
        filterId = id;
        status = result;
    });

    if (status != Result::SUCCESS) {
        return false;
    }

    mFilters[filterId] = filter;
    return true;
}

DvrType Dvr::getType() {
    return mType;
}

}  // namespace implementation
}  // namespace V1_0
}  // namespace tuner
Loading