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

Commit de6ddb3e authored by Tomasz Wasilczyk's avatar Tomasz Wasilczyk Committed by android-build-merger
Browse files

Merge "Fix comments and internal names about SEEK operation." into pi-dev

am: 2c82288f

Change-Id: I9d6718530cf7f764dd2f652f7440025ee45a4e64
parents ec560a87 2c82288f
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -18,7 +18,8 @@ package android.hardware.broadcastradio@2.0;
interface ITunerCallback {
    /**
     * Method called by the HAL when a tuning operation fails asynchronously
     * following a step(), scan() or tune() command.
     * following ITunerSession::tune(), ITunerSession::scan() or
     * ITunerSession::step().
     *
     * This callback is only called when the step(), scan() or tune() command
     * returned OK at first.
+14 −7
Original line number Diff line number Diff line
@@ -19,7 +19,7 @@ interface ITunerSession {
    /**
     * Tune to a specified program.
     *
     * Automatically cancels pending scan, step or tune.
     * Automatically cancels pending tune(), scan() or step().
     * If the method returns OK, tuneFailed or currentProgramInfoChanged
     * callback must be called.
     *
@@ -33,9 +33,16 @@ interface ITunerSession {
    tune(ProgramSelector program) generates (Result result);

    /**
     * Tune to the next valid program.
     * Tune (seek) to the next valid program on the "air".
     *
     * Automatically cancels pending scan, step or tune.
     * This might more naturally be called "seek" but for legacy reasons, the
     * entry point remains "scan". This should not be confused with the actual
     * scan operation (where the radio seeks through programs in a loop until
     * user chooses to stay on one of them) nor background scan operation (that
     * a tuner may do in order to locate all available programs.  This function
     * is meant to advance to the next detected program and stay there.
     *
     * Automatically cancels pending tune(), scan() or step().
     * If the method returns OK, tuneFailed or currentProgramInfoChanged
     * callback must be called.
     *
@@ -44,20 +51,20 @@ interface ITunerSession {
     *  - DAB secondary service.
     *
     * As an implementation detail, the HAL has the option to perform an actual
     * scan or select the next program from the list retrieved in the
     * seek or select the next program from the list retrieved in the
     * background, if one is not stale.
     *
     * @param directionUp True to change towards higher numeric values
     *                    (frequency, channel number), false towards lower.
     * @param skipSubChannel Don't tune to subchannels.
     * @return result OK if the scan has successfully started.
     * @return result OK if the operation has successfully started.
     */
    scan(bool directionUp, bool skipSubChannel) generates (Result result);

    /**
     * Tune to the adjacent channel, which may not be occupied by any program.
     *
     * Automatically cancels pending scan, step or tune.
     * Automatically cancels pending tune(), scan() or step().
     * If the method returns OK, tuneFailed or currentProgramInfoChanged
     * callback must be called.
     *
@@ -70,7 +77,7 @@ interface ITunerSession {
    step(bool directionUp) generates (Result result);

    /**
     * Cancel a scan, step or tune operation.
     * Cancel a pending tune(), scan() or step().
     *
     * If there is no such operation running, the call must be ignored.
     */
+5 −5
Original line number Diff line number Diff line
@@ -42,7 +42,7 @@ using std::vector;

namespace delay {

static constexpr auto scan = 200ms;
static constexpr auto seek = 200ms;
static constexpr auto step = 100ms;
static constexpr auto tune = 150ms;
static constexpr auto list = 1s;
@@ -131,11 +131,11 @@ Return<Result> TunerSession::scan(bool directionUp, bool /* skipSubChannel */) {
    if (list.empty()) {
        mIsTuneCompleted = false;
        auto task = [this, directionUp]() {
            ALOGI("Performing failed scan up=%d", directionUp);
            ALOGI("Performing failed seek up=%d", directionUp);

            mCallback->onTuneFailed(Result::TIMEOUT, {});
        };
        mThread.schedule(task, delay::scan);
        mThread.schedule(task, delay::seek);

        return Result::OK;
    }
@@ -162,12 +162,12 @@ Return<Result> TunerSession::scan(bool directionUp, bool /* skipSubChannel */) {

    mIsTuneCompleted = false;
    auto task = [this, tuneTo, directionUp]() {
        ALOGI("Performing scan up=%d", directionUp);
        ALOGI("Performing seek up=%d", directionUp);

        lock_guard<mutex> lk(mMut);
        tuneInternalLocked(tuneTo);
    };
    mThread.schedule(task, delay::scan);
    mThread.schedule(task, delay::seek);

    return Result::OK;
}
+2 −2
Original line number Diff line number Diff line
@@ -40,8 +40,8 @@ struct VirtualProgram {
    operator ProgramInfo() const;

    /**
     * Defines order on how virtual programs appear on the "air" with
     * ITunerSession::scan operation.
     * Defines order in which virtual programs appear on the "air" with
     * ITunerSession::scan().
     *
     * It's for default implementation purposes, may not be complete or correct.
     */
+10 −7
Original line number Diff line number Diff line
@@ -184,18 +184,20 @@ struct AmFmRegionConfig {
 * lowerBound + channelNumber * spacing, up to upperBound.
 */
struct AmFmBandRange {
    /** The frequency of the first channel within the range. */
    /** The frequency (in kHz) of the first channel within the range. */
    uint32_t lowerBound;

    /** The frequency of the last channel within the range. */
    /** The frequency (in kHz) of the last channel within the range. */
    uint32_t upperBound;

    /** Channel grid resolution, how far apart are the channels. */
    /** Channel grid resolution (in kHz), how far apart are the channels. */
    uint32_t spacing;

    /**
     * Spacing used when scanning for channels. It's a multiply of spacing and
     * allows to skip some channels when scanning to make it faster.
     * Channel spacing (in kHz) used to speed up seeking to the next station
     * via the ITunerSession::scan() operation.
     *
     * It must be a multiple of channel grid resolution.
     *
     * Tuner may first quickly check every n-th channel and if it detects echo
     * from a station, it fine-tunes to find the exact frequency.
@@ -415,9 +417,10 @@ enum ProgramInfoFlags : uint32_t {
    TRAFFIC_ANNOUNCEMENT = 1 << 3,

    /**
     * Tuned to a program (not playing a static).
     * Tuned to a program (not playing static).
     *
     * It's the same condition that would stop scan() operation.
     * It's the same condition that would stop a seek operation
     * (ie: ITunerSession::scan()).
     *
     * By definition, this flag must be set for all items on the program list.
     */
Loading