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

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

Merge "Implement config flags."

parents e262f8ce 43fe8945
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@ hidl_interface {
        "android.hidl.base@1.0",
    ],
    types: [
        "ConfigFlag",
        "Constants",
        "IdentifierType",
        "Metadata",
+26 −0
Original line number Diff line number Diff line
@@ -76,6 +76,32 @@ interface ITunerSession {
     */
    cancel();

    /**
     * Fetches the current setting of a given config flag.
     *
     * The success/failure result must be consistent with setConfigFlag.
     *
     * @param flag Flag to fetch.
     * @return result OK successfully fetched the flag.
     *                INVALID_STATE if the flag is not applicable right now.
     *                NOT_SUPPORTED if the flag is not supported at all.
     * @return value The current value of the flag, if result is OK.
     */
    getConfigFlag(ConfigFlag flag) generates (Result result, bool value);

    /**
     * Sets the config flag.
     *
     * The success/failure result must be consistent with getConfigFlag.
     *
     * @param flag Flag to set.
     * @param value The new value of a given flag.
     * @return result OK successfully set the flag.
     *                INVALID_STATE if the flag is not applicable right now.
     *                NOT_SUPPORTED if the flag is not supported at all.
     */
    setConfigFlag(ConfigFlag flag, bool value) generates (Result result);

    /**
     * Generic method for setting vendor-specific parameter values.
     * The framework does not interpret the parameters, they are passed
+13 −0
Original line number Diff line number Diff line
@@ -205,6 +205,19 @@ Return<void> TunerSession::cancel() {
    return {};
}

Return<void> TunerSession::getConfigFlag(ConfigFlag flag, getConfigFlag_cb _hidl_cb) {
    ALOGV("%s(%s)", __func__, toString(flag).c_str());

    _hidl_cb(Result::NOT_SUPPORTED, false);
    return {};
}

Return<Result> TunerSession::setConfigFlag(ConfigFlag flag, bool value) {
    ALOGV("%s(%s, %d)", __func__, toString(flag).c_str(), value);

    return Result::NOT_SUPPORTED;
}

Return<void> TunerSession::setParameters(const hidl_vec<VendorKeyValue>& /* parameters */,
                                         setParameters_cb _hidl_cb) {
    ALOGV("%s", __func__);
+2 −0
Original line number Diff line number Diff line
@@ -38,6 +38,8 @@ struct TunerSession : public ITunerSession {
    virtual Return<Result> scan(bool directionUp, bool skipSubChannel) override;
    virtual Return<Result> step(bool directionUp) override;
    virtual Return<void> cancel() override;
    virtual Return<void> getConfigFlag(ConfigFlag flag, getConfigFlag_cb _hidl_cb);
    virtual Return<Result> setConfigFlag(ConfigFlag flag, bool value);
    virtual Return<void> setParameters(const hidl_vec<VendorKeyValue>& parameters,
                                       setParameters_cb _hidl_cb) override;
    virtual Return<void> getParameters(const hidl_vec<hidl_string>& keys,
+67 −0
Original line number Diff line number Diff line
@@ -36,6 +36,73 @@ enum Result : int32_t {
    TIMEOUT,
};

/**
 * Configuration flags to be used with getConfigFlag and setConfigFlag methods
 * of ITunerSession.
 */
enum ConfigFlag : uint32_t {
    /**
     * Forces mono audio stream reception.
     *
     * Analog broadcasts can recover poor reception conditions by jointing
     * stereo channels into one. Mainly for, but not limited to AM/FM.
     */
    FORCE_MONO = 1,

    /**
     * Forces the analog playback for the supporting radio technology.
     *
     * User may disable digital playback for FM HD Radio or hybrid FM/DAB with
     * this option. This is purely user choice, ie. does not reflect digital-
     * analog handover state managed from the HAL implementation side.
     *
     * Some radio technologies may not support this, ie. DAB.
     */
    FORCE_ANALOG,

    /**
     * Forces the digital playback for the supporting radio technology.
     *
     * User may disable digital-analog handover that happens with poor
     * receiption conditions. With digital forced, the radio will remain silent
     * instead of switching to analog channel if it's available. This is purely
     * user choice, it does not reflect the actual state of handover.
     */
    FORCE_DIGITAL,

    /**
     * RDS Alternative Frequencies.
     *
     * If set, radio tuner automatically switches to the best available
     * frequency that currently listened RDS station broadcasts.
     */
    RDS_AF,

    /**
     * RDS region-specific program lock-down.
     *
     * Allows user to lock to the current region as they move into the
     * other region.
     */
    RDS_REG,

    /**
     * Enables DAB implicit linking, based on program identifiers
     * (DAB SId, RDS PI).
     */
    DAB_IMPLICIT_LINKING,

    /**
     * Enables DAB hard linking (the same content).
     */
    DAB_HARD_LINKING,

    /**
     * Enables DAB hard linking (related content).
     */
    DAB_SOFT_LINKING,
};

/**
 * A key-value pair for vendor-specific information to be passed as-is through
 * Android framework to the front-end application.
Loading