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

Commit 701a5bdd authored by Tomasz Wasilczyk's avatar Tomasz Wasilczyk
Browse files

Widen dummy band range to cover all regions.

Bug: b/64115131
Test: VTS, instrumentation
Change-Id: I34e9aac440a003226200243c835e6116ba7eae90
parent cc1007af
Loading
Loading
Loading
Loading
+21 −9
Original line number Diff line number Diff line
@@ -44,17 +44,29 @@ static const map<Class, ModuleConfig> gModuleConfigs{
    {Class::AM_FM, ModuleConfig({
        "Digital radio mock",
        {  // amFmBands
            AmFmBandConfig({
                Band::AM,
                153,         // lowerLimit
                26100,       // upperLimit
                {5, 9, 10},  // spacings
            }),
            AmFmBandConfig({
                Band::FM,
                65800,           // lowerLimit
                108000,          // upperLimit
                {10, 100, 200},  // spacings
            }),
            AmFmBandConfig({
                Band::AM_HD,
                540,   // lowerLimit
                1610,  // upperLimit
                10,    // spacing
                153,         // lowerLimit
                26100,       // upperLimit
                {5, 9, 10},  // spacings
            }),
            AmFmBandConfig({
                Band::FM_HD,
                87900,   // lowerLimit
                107900,  // upperLimit
                200,     // spacing
                {200},   // spacings
            }),
        },
    })},
@@ -114,14 +126,14 @@ Return<void> BroadcastRadio::getProperties_1_1(getProperties_1_1_cb _hidl_cb) {
        dst.antennaConnected = true;
        dst.lowerLimit = src.lowerLimit;
        dst.upperLimit = src.upperLimit;
        dst.spacings = vector<uint32_t>({src.spacing});
        dst.spacings = src.spacings;

        if (src.type == Band::AM) {
        if (utils::isAm(src.type)) {
            dst.ext.am.stereo = true;
        } else if (src.type == Band::FM) {
            dst.ext.fm.deemphasis = Deemphasis::D75;
        } else if (utils::isFm(src.type)) {
            dst.ext.fm.deemphasis = static_cast<Deemphasis>(Deemphasis::D50 | Deemphasis::D75);
            dst.ext.fm.stereo = true;
            dst.ext.fm.rds = Rds::US;
            dst.ext.fm.rds = static_cast<Rds>(Rds::WORLD | Rds::US);
            dst.ext.fm.ta = true;
            dst.ext.fm.af = true;
            dst.ext.fm.ea = true;
+1 −1
Original line number Diff line number Diff line
@@ -31,7 +31,7 @@ struct AmFmBandConfig {
    V1_0::Band type;
    uint32_t lowerLimit;  // kHz
    uint32_t upperLimit;  // kHz
    uint32_t spacing;     // kHz
    std::vector<uint32_t> spacings;  // kHz
};

struct ModuleConfig {
+1 −1
Original line number Diff line number Diff line
@@ -83,7 +83,7 @@ Return<Result> Tuner::setConfiguration(const BandConfig& config) {
        mAmfmConfig.antennaConnected = true;
        mCurrentProgram = utils::make_selector(mAmfmConfig.type, mAmfmConfig.lowerLimit);

        if (mAmfmConfig.type == Band::FM_HD || mAmfmConfig.type == Band::FM) {
        if (utils::isFm(mAmfmConfig.type)) {
            mVirtualRadio = std::ref(getFmRadio());
        } else {
            mVirtualRadio = std::ref(getAmRadio());
+16 −13
Original line number Diff line number Diff line
@@ -119,6 +119,14 @@ bool isAmFm(const ProgramType type) {
    }
}

bool isAm(const Band band) {
    return band == Band::AM || band == Band::AM_HD;
}

bool isFm(const Band band) {
    return band == Band::FM || band == Band::FM_HD;
}

bool hasId(const ProgramSelector& sel, const IdentifierType type) {
    auto itype = static_cast<uint32_t>(type);
    if (sel.primaryId.type == itype) return true;
@@ -153,16 +161,11 @@ ProgramSelector make_selector(Band band, uint32_t channel, uint32_t subChannel)

    // we can't use ProgramType::AM_HD or FM_HD, because we don't know HD station ID
    ProgramType type;
    switch (band) {
        case Band::AM:
        case Band::AM_HD:
    if (isAm(band)) {
        type = ProgramType::AM;
            break;
        case Band::FM:
        case Band::FM_HD:
    } else if (isFm(band)) {
        type = ProgramType::FM;
            break;
        default:
    } else {
        LOG_ALWAYS_FATAL("Unsupported band: %s", toString(band).c_str());
    }

@@ -219,9 +222,9 @@ bool operator==(const BandConfig& l, const BandConfig& r) {
    if (l.lowerLimit != r.lowerLimit) return false;
    if (l.upperLimit != r.upperLimit) return false;
    if (l.spacings != r.spacings) return false;
    if (l.type == Band::AM || l.type == Band::AM_HD) {
    if (V1_1::utils::isAm(l.type)) {
        return l.ext.am == r.ext.am;
    } else if (l.type == Band::FM || l.type == Band::FM_HD) {
    } else if (V1_1::utils::isFm(l.type)) {
        return l.ext.fm == r.ext.fm;
    } else {
        ALOGW("Unsupported band config type: %s", toString(l.type).c_str());
+3 −0
Original line number Diff line number Diff line
@@ -48,6 +48,9 @@ bool tunesTo(const ProgramSelector& pointer, const ProgramSelector& channel);
ProgramType getType(const ProgramSelector& sel);
bool isAmFm(const ProgramType type);

bool isAm(const V1_0::Band band);
bool isFm(const V1_0::Band band);

bool hasId(const ProgramSelector& sel, const IdentifierType type);

/**