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

Commit d1d3f70f authored by Amy Zhang's avatar Amy Zhang
Browse files

Revert "Add monitor for ip cid change"

This CL will be re-revert once the corresponding JNI and framework CL are ready to commit

This reverts commit b6064e59.

Reason for revert: build breakage

Change-Id: I9b1e2493f1bc93393b634d6b841a56c6d0171542
parent b6064e59
Loading
Loading
Loading
Loading
+10 −14
Original line number Diff line number Diff line
@@ -85,23 +85,19 @@ interface IFilter extends @1.0::IFilter {
    configureAvStreamType(AvStreamType avStreamType) generates (Result result);

    /**
     * Configure the monitor event.
     * Configure the filter to monitor specific Scrambling Status.
     *
     * The event for Scrambling Status should be sent at the following two scenarios:
     * Scrambling Status should be sent through the filer callback at the following two scenarios:
     *   1. When this method is called, the first detected scrambling status should be sent.
     *   2. When the Scrambling status transits into different status, event should be sent.
     *   2. When the filter transits into the monitored statuses configured through this method,
     *      event should be sent.
     *
     * The event for IP CID change should be sent at the following two scenarios:
     *   1. When this method is called, the first detected CID for the IP should be sent.
     *   2. When the CID is changed to different value for the IP filter, event should be sent.
     *
     * @param monitorEventypes the events to monitor. Set corresponding bit of the event to monitor.
     *                         Reset to stop monitoring.
     * @param statuses Scrambling Statuses to monitor. Set corresponding bit to monitor. Reset to
     *        stop monitoring.
     * @return result Result status of the operation.
     *         SUCCESS if successful,
     *         INVALID_STATE if configure can't be applied,
     *         UNKNOWN_ERROR if failed for other reasons.
     */
    configureMonitorEvent(bitfield<DemuxFilterMonitorEventType> monitorEventTypes)
            generates (Result result);
    configureScramblingEvent(bitfield<ScramblingStatus> statuses) generates (Result result);
};
+16 −40
Original line number Diff line number Diff line
@@ -250,49 +250,25 @@ Return<Result> Filter::configureAvStreamType(const V1_1::AvStreamType& avStreamT
    return Result::SUCCESS;
}

Return<Result> Filter::configureMonitorEvent(uint32_t monitorEventTypes) {
Return<Result> Filter::configureScramblingEvent(uint32_t statuses) {
    ALOGV("%s", __FUNCTION__);

    DemuxFilterEvent emptyFilterEvent;
    V1_1::DemuxFilterMonitorEvent monitorEvent;
    V1_1::DemuxFilterEventExt eventExt;

    uint32_t newScramblingStatus =
            monitorEventTypes & V1_1::DemuxFilterMonitorEventType::SCRAMBLING_STATUS;
    uint32_t newIpCid = monitorEventTypes & V1_1::DemuxFilterMonitorEventType::IP_CID_CHANGE;

    // if scrambling status monitoring flipped, record the new state and send msg on enabling
    if (newScramblingStatus ^ mScramblingStatusMonitored) {
        mScramblingStatusMonitored = newScramblingStatus;
        if (mScramblingStatusMonitored) {
    mStatuses = statuses;
    if (mCallback_1_1 != nullptr) {
        // Assuming current status is always NOT_SCRAMBLED
                monitorEvent.scramblingStatus(V1_1::ScramblingStatus::NOT_SCRAMBLED);
                eventExt.events.resize(1);
                eventExt.events[0].monitorEvent(monitorEvent);
                mCallback_1_1->onFilterEvent_1_1(emptyFilterEvent, eventExt);
            } else {
                return Result::INVALID_STATE;
            }
        }
    }
        V1_1::DemuxFilterEventExt filterEventExt;
        V1_1::DemuxFilterEventExt::Event event;
        event.scramblingStatus(V1_1::ScramblingStatus::NOT_SCRAMBLED);
        int size = filterEventExt.events.size();
        filterEventExt.events.resize(size + 1);
        filterEventExt.events[size] = event;
        DemuxFilterEvent emptyFilterEvent;

    // if ip cid monitoring flipped, record the new state and send msg on enabling
    if (newIpCid ^ mIpCidMonitored) {
        mIpCidMonitored = newIpCid;
        if (mIpCidMonitored) {
            if (mCallback_1_1 != nullptr) {
                // Return random cid
                monitorEvent.cid(1);
                eventExt.events.resize(1);
                eventExt.events[0].monitorEvent(monitorEvent);
                mCallback_1_1->onFilterEvent_1_1(emptyFilterEvent, eventExt);
        mCallback_1_1->onFilterEvent_1_1(emptyFilterEvent, filterEventExt);
        mFilterEventExt.events.resize(0);
    } else {
        return Result::INVALID_STATE;
    }
        }
    }

    return Result::SUCCESS;
}

+1 −3
Original line number Diff line number Diff line
@@ -84,7 +84,7 @@ class Filter : public V1_1::IFilter {

    virtual Return<Result> configureAvStreamType(const V1_1::AvStreamType& avStreamType) override;

    virtual Return<Result> configureMonitorEvent(uint32_t monitorEventTypes) override;
    virtual Return<Result> configureScramblingEvent(uint32_t statuses) override;

    /**
     * To create a FilterMQ and its Event Flag.
@@ -238,8 +238,6 @@ class Filter : public V1_1::IFilter {

    bool mConfigured = false;
    int mStartId = 0;
    uint8_t mScramblingStatusMonitored = 0;
    uint8_t mIpCidMonitored = 0;
};

}  // namespace implementation
+3 −41
Original line number Diff line number Diff line
@@ -151,42 +151,22 @@ struct DemuxFilterMmtpRecordEventExt {
struct DemuxFilterEventExt {
    safe_union Event {
        /**
         * No extended filter Event.
         * No extended record filter Event. This is used by the tsRecord or mmtpRecord filter event
         * that does not contain the DemuxFilterTs/MmtpRecordEventExt information.
         */
        Monostate noinit;

        /**
         * Extended TS Record event sent along with @1.0::DemuxFilterEvent::Event::tsRecord.
         * DemuxFilterEventExt.events[i] is corresponding to @1.0::DemuxFilterEvent.events[i]. If
         * @1.0::DemuxFilterEvent.events[i] does not have extended event,
         * DemuxFilterEventExt.events[i] should use Monostate.
         */
        DemuxFilterTsRecordEventExt tsRecord;

        /**
         * Extended MMTP Record event sent along with @1.0::DemuxFilterEvent::Event::mmtpRecord.
         * DemuxFilterEventExt.events[i] is corresponding to @1.0::DemuxFilterEvent.events[i]. If
         * @1.0::DemuxFilterEvent.events[i] does not have extended event,
         * DemuxFilterEventExt.events[i] should use Monostate.
         */
        DemuxFilterMmtpRecordEventExt mmtpRecord;

        /**
         * Monitor event to notify monitored status change.
         *
         * When sending monitorEvent, DemuxFilterEventExt.events should only contain one
         * monitorEvent. MonitorEvent should be sent with an empty @1.0::DemuxFilterEvent.
         */
        DemuxFilterMonitorEvent monitorEvent;
        ScramblingStatus scramblingStatus;

        /**
         * An unique ID to mark the start point of receiving the valid filter events after
         * reconfiguring the filter. It must be sent at least once in the first event after the
         * filter is restarted. 0 is reserved for the newly opened filter's first start, which is
         * optional for HAL to send.
         *
         * When sending starId, DemuxFilterEventExt.events should only contain one startId event.
         * StardId event should be sent with an empty @1.0::DemuxFilterEvent.
         */
        uint32_t startId;
    };
@@ -216,24 +196,6 @@ enum ScramblingStatus : uint32_t {
    SCRAMBLED = 1 << 2,
};

@export
enum DemuxFilterMonitorEventType : uint32_t {
    SCRAMBLING_STATUS = 1 << 0,
    IP_CID_CHANGE = 1 << 1,
};

safe_union DemuxFilterMonitorEvent {
    /**
     * New scrambling status.
     */
    ScramblingStatus scramblingStatus;

    /**
     * New cid for the IP filter.
     */
    uint32_t cid;
};

typedef FrontendDvbcSpectralInversion FrontendSpectralInversion;

/**
+4 −26
Original line number Diff line number Diff line
@@ -40,18 +40,6 @@ void FilterCallback::testFilterScramblingEvent() {
    ALOGW("[vts] pass and stop");
}

void FilterCallback::testFilterIpCidEvent() {
    android::Mutex::Autolock autoLock(mMsgLock);
    while (mIpCidEvent < 1) {
        if (-ETIMEDOUT == mMsgCondition.waitRelative(mMsgLock, WAIT_TIMEOUT)) {
            EXPECT_TRUE(false) << "ip cid change event does not output within timeout";
            return;
        }
    }
    mIpCidEvent = 0;
    ALOGW("[vts] pass and stop");
}

void FilterCallback::testStartIdAfterReconfigure() {
    android::Mutex::Autolock autoLock(mMsgLock);
    while (!mStartIdReceived) {
@@ -92,18 +80,9 @@ void FilterCallback::readFilterEventData() {
                      eventExt.mmtpRecord().pts, eventExt.mmtpRecord().firstMbInSlice,
                      eventExt.mmtpRecord().mpuSequenceNumber, eventExt.mmtpRecord().tsIndexMask);
                break;
            case DemuxFilterEventExt::Event::hidl_discriminator::monitorEvent:
                switch (eventExt.monitorEvent().getDiscriminator()) {
                    case DemuxFilterMonitorEvent::hidl_discriminator::scramblingStatus:
            case DemuxFilterEventExt::Event::hidl_discriminator::scramblingStatus:
                mScramblingStatusEvent++;
                break;
                    case DemuxFilterMonitorEvent::hidl_discriminator::cid:
                        mIpCidEvent++;
                        break;
                    default:
                        break;
                }
                break;
            case DemuxFilterEventExt::Event::hidl_discriminator::startId:
                ALOGD("[vts] Extended restart filter event, startId=%d", eventExt.startId());
                mStartIdReceived = true;
@@ -293,16 +272,15 @@ AssertionResult FilterTests::closeFilter(uint64_t filterId) {
    return AssertionResult(status == Result::SUCCESS);
}

AssertionResult FilterTests::configureMonitorEvent(uint64_t filterId, uint32_t monitorEventTypes) {
AssertionResult FilterTests::configureScramblingEvent(uint64_t filterId, uint32_t statuses) {
    EXPECT_TRUE(mFilters[filterId]) << "Test with getNewlyOpenedFilterId first.";
    Result status;

    sp<android::hardware::tv::tuner::V1_1::IFilter> filter_v1_1 =
            android::hardware::tv::tuner::V1_1::IFilter::castFrom(mFilters[filterId]);
    if (filter_v1_1 != NULL) {
        status = filter_v1_1->configureMonitorEvent(monitorEventTypes);
        status = filter_v1_1->configureScramblingEvent(statuses);
        mFilterCallbacks[filterId]->testFilterScramblingEvent();
        mFilterCallbacks[filterId]->testFilterIpCidEvent();
    } else {
        ALOGW("[vts] Can't cast IFilter into v1_1.");
        return failure();
Loading