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

Commit c6e67b4a authored by Tomasz Wasilczyk's avatar Tomasz Wasilczyk Committed by Android (Google) Code Review
Browse files

Merge "Change VENDOR program types to range." into oc-mr1-dev

parents 8e9eed33 da97a6dd
Loading
Loading
Loading
Loading
+15 −9
Original line number Diff line number Diff line
@@ -128,11 +128,14 @@ enum Modulation : uint32_t {
/**
 * Type of a radio technology.
 *
 * VENDOR program types must be opaque to the framework.
 *
 * There are multiple VENDOR program types just to make vendor implementation
 * easier with multiple properitary radio technologies. They are treated the
 * same by the framework.
 *
 * All other values are reserved for future use.
 * Values not matching any enumerated constant must be ignored.
 */
enum ProgramType : uint32_t {
    AM = 1,  // analogue AM radio (with or without RDS)
@@ -142,10 +145,10 @@ enum ProgramType : uint32_t {
    DAB,     // Digital audio broadcasting
    DRMO,    // Digital Radio Mondiale
    SXM,     // SiriusXM Satellite Radio
    VENDOR1, // Vendor-specific, not synced across devices.
    VENDOR2, // Vendor-specific, not synced across devices.
    VENDOR3, // Vendor-specific, not synced across devices.
    VENDOR4, // Vendor-specific, not synced across devices.

    // Vendor-specific, not synced across devices.
    VENDOR_START = 1000,
    VENDOR_END = 1999,
};

/**
@@ -155,10 +158,13 @@ enum ProgramType : uint32_t {
 * it for secondary IDs. For example, a satellite program may set AM/FM fallback
 * frequency, if a station broadcasts both via satellite and AM/FM.
 *
 * VENDOR identifier types must be opaque to the framework.
 *
 * The value format for each (but VENDOR_PRIMARY) identifier is strictly defined
 * to maintain interoperability between devices made by different vendors.
 *
 * All other values are reserved for future use.
 * Values not matching any enumerated constant must be ignored.
 */
enum IdentifierType : uint32_t {
    AMFM_FREQUENCY = 1,  // kHz
@@ -208,12 +214,12 @@ enum IdentifierType : uint32_t {
     * Primary identifier for vendor-specific radio technology.
     * The value format is determined by a vendor.
     *
     * It must not be used in any other programType than VENDORx.
     * It must not be used in any other programType than corresponding VENDOR
     * type between VENDOR_START and VENDOR_END (eg. identifier type 1015 must
     * not be used in any program type other than 1015).
     */
    VENDOR1_PRIMARY,
    VENDOR2_PRIMARY,
    VENDOR3_PRIMARY,
    VENDOR4_PRIMARY,
    VENDOR_PRIMARY_START = ProgramType:VENDOR_START,
    VENDOR_PRIMARY_END = ProgramType:VENDOR_END,
};

/**
+1 −5
Original line number Diff line number Diff line
@@ -93,11 +93,7 @@ bool tunesTo(const ProgramSelector& a, const ProgramSelector& b) {
                return haveEqualIds(a, b, IdentifierType::SXM_SERVICE_ID);
            }
            return haveEqualIds(a, b, IdentifierType::SXM_CHANNEL);
        case ProgramType::VENDOR1:
        case ProgramType::VENDOR2:
        case ProgramType::VENDOR3:
        case ProgramType::VENDOR4:
        default:
        default:  // includes all vendor types
            ALOGW("Unsupported program type: %s", toString(type).c_str());
            return false;
    }
+6 −13
Original line number Diff line number Diff line
@@ -69,10 +69,6 @@ static constexpr ProgramType kStandardProgramTypes[] = {
    ProgramType::AM,  ProgramType::FM,   ProgramType::AM_HD, ProgramType::FM_HD,
    ProgramType::DAB, ProgramType::DRMO, ProgramType::SXM};

static constexpr IdentifierType kVendorPrimartIds[] = {
    IdentifierType::VENDOR1_PRIMARY, IdentifierType::VENDOR2_PRIMARY,
    IdentifierType::VENDOR3_PRIMARY, IdentifierType::VENDOR4_PRIMARY};

static void printSkipped(std::string msg) {
    std::cout << "[  SKIPPED ] " << msg << std::endl;
}
@@ -382,17 +378,14 @@ TEST_P(BroadcastRadioHalTest, TuneFailsForPrimaryVendor) {

    for (auto ptype : kStandardProgramTypes) {
        ALOGD("Checking %s...", toString(ptype).c_str());
        for (auto idtype : kVendorPrimartIds) {
            ALOGD("...with %s", toString(idtype).c_str());
        ProgramSelector sel = {};
        sel.programType = static_cast<uint32_t>(ptype);
            sel.primaryId.type = static_cast<uint32_t>(idtype);
        sel.primaryId.type = static_cast<uint32_t>(IdentifierType::VENDOR_PRIMARY_START);

        auto tuneResult = mTuner->tuneByProgramSelector(sel);
        ASSERT_NE(Result::OK, tuneResult);
    }
}
}

/**
 * Test that tune with unknown program type fails.