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

Commit 803301a2 authored by Tomasz Wasilczyk's avatar Tomasz Wasilczyk
Browse files

Add background scan routines and callbacks to broadcast radio HAL.

Bug: b/34054813
Test: existing VTS pass, none added.
Change-Id: I2009e73a9e5edc4752366fd84f67b5a745856441
parent 97cf2b75
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -4,6 +4,7 @@ filegroup {
    name: "android.hardware.broadcastradio@1.1_hal",
    srcs: [
        "types.hal",
        "IBroadcastRadio.hal",
        "IBroadcastRadioFactory.hal",
        "ITuner.hal",
        "ITunerCallback.hal",
@@ -19,6 +20,7 @@ genrule {
    ],
    out: [
        "android/hardware/broadcastradio/1.1/types.cpp",
        "android/hardware/broadcastradio/1.1/BroadcastRadioAll.cpp",
        "android/hardware/broadcastradio/1.1/BroadcastRadioFactoryAll.cpp",
        "android/hardware/broadcastradio/1.1/TunerAll.cpp",
        "android/hardware/broadcastradio/1.1/TunerCallbackAll.cpp",
@@ -34,6 +36,11 @@ genrule {
    ],
    out: [
        "android/hardware/broadcastradio/1.1/types.h",
        "android/hardware/broadcastradio/1.1/IBroadcastRadio.h",
        "android/hardware/broadcastradio/1.1/IHwBroadcastRadio.h",
        "android/hardware/broadcastradio/1.1/BnHwBroadcastRadio.h",
        "android/hardware/broadcastradio/1.1/BpHwBroadcastRadio.h",
        "android/hardware/broadcastradio/1.1/BsBroadcastRadio.h",
        "android/hardware/broadcastradio/1.1/IBroadcastRadioFactory.h",
        "android/hardware/broadcastradio/1.1/IHwBroadcastRadioFactory.h",
        "android/hardware/broadcastradio/1.1/BnHwBroadcastRadioFactory.h",
+30 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2017 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package android.hardware.broadcastradio@1.1;

import @1.0::IBroadcastRadio;

interface IBroadcastRadio extends @1.0::IBroadcastRadio {

    /*
     * Retrieve implementation properties.
     * @return properties A Properties structure containing implementation
     *                    description and capabilities.
     */
    getProperties_1_1() generates (Properties properties);

};
+30 −3
Original line number Diff line number Diff line
@@ -28,6 +28,32 @@ interface ITuner extends @1.0::ITuner {
     */
    getProgramInformation_1_1() generates (Result result, ProgramInfo info);

    /**
     * Initiates a background scan to update internally cached program list.
     *
     * HAL client may not need to initiate the scan explicitly with this call,
     * ie. HAL implementation MAY perform the scan on boot. It's a common
     * practice in devices with two physical tuners with background scanning.
     *
     * Device must call backgroundScanComplete if the result is OK, even if the
     * scan fails later (it must pass proper result through the callback).
     * Otherwise, backgroundScanComplete must not be called as a result of this
     * certain attempt. It may still be called as a response to another call to
     * startBackgroundScan, former or latter.
     *
     * Device may utilize an already running (but not finished) scan for
     * subsequent calls to startBackgroundScan, issuing a single
     * backgroundScanComplete callback.
     *
     * @return result OK if the scan was properly scheduled (this does not mean
     *                it successfully finished).
     *                TEMPORARILY_UNAVAILABLE if the background scan is
     *                temporarily unavailable, ie. due to ongoing foreground
     *                playback in single-tuner device.
     *                NOT_INITIALIZED other error, ie. HW failure.
     */
    startBackgroundScan() generates (ProgramListResult result);

    /**
     * Retrieve station list.
     *
@@ -40,7 +66,8 @@ interface ITuner extends @1.0::ITuner {
     *               before setting this parameter to anything else.
     * @return result OK if the list was successfully retrieved.
     *                NOT_READY if the scan is in progress.
     *                NOT_STARTED if the scan has not been started.
     *                NOT_STARTED if the scan has not been started, client may
     *                call startBackgroundScan to fix this.
     *                NOT_INITIALIZED if any other error occurs.
     * @return programList List of stations available for user.
     */
+27 −3
Original line number Diff line number Diff line
@@ -19,9 +19,10 @@ package android.hardware.broadcastradio@1.1;
import @1.0::ITunerCallback;

/**
 * Some methods of @1.1::ITunerCallback are updated versions of those from @1.0:ITunerCallback.
 * All 1.1 drivers should call both (eg. tuneComplete and tuneComplete_1_1), while 1.1 clients
 * should ignore 1.0 ones, to avoid receiving a callback twice.
 * Some methods of @1.1::ITunerCallback are updated versions of those from
 * @1.0:ITunerCallback. All 1.1 HAL implementations must call both
 * (eg. tuneComplete and tuneComplete_1_1), while 1.1 clients may ignore 1.0
 * ones, to avoid receiving a callback twice.
 */
interface ITunerCallback extends @1.0::ITunerCallback {
    /*
@@ -37,4 +38,27 @@ interface ITunerCallback extends @1.0::ITunerCallback {
     * @param info A ProgramInfo structure describing the new tuned station.
     */
    oneway afSwitch_1_1(ProgramInfo info);

    /**
     * Called by the HAL when background scan initiated by startBackgroundScan
     * finishes. If the list was changed, programListChanged must be called too.
     * @param result OK if the scan succeeded, client may retrieve the actual
     *               list with ITuner::getProgramList.
     *               TEMPORARILY_UNAVAILABLE if the scan was interrupted due to
     *               hardware becoming temporarily unavailable.
     *               NOT_INITIALIZED other error, ie. HW failure.
     */
    oneway backgroundScanComplete(ProgramListResult result);

    /**
     * Called each time the internally cached program list changes. HAL may not
     * call it immediately, ie. it may wait for a short time to accumulate
     * multiple list change notifications into a single event.
     *
     * It may be triggered either by an explicitly issued background scan,
     * or a scan issued by the device internally.
     *
     * Client may retrieve the actual list with ITuner::getProgramList.
     */
    oneway programListChanged();
};
+6 −1
Original line number Diff line number Diff line
@@ -94,7 +94,7 @@ int BroadcastRadio::closeHalTuner(const struct radio_tuner *halTuner)
}


// Methods from ::android::hardware::broadcastradio::V1_0::IBroadcastRadio follow.
// Methods from ::android::hardware::broadcastradio::V1_1::IBroadcastRadio follow.
Return<void> BroadcastRadio::getProperties(getProperties_cb _hidl_cb)
{
    int rc;
@@ -115,6 +115,11 @@ exit:
    return Void();
}

Return<void> BroadcastRadio::getProperties_1_1(getProperties_1_1_cb _hidl_cb __unused)
{
    return Status::fromExceptionCode(Status::EX_UNSUPPORTED_OPERATION);
}

Return<void> BroadcastRadio::openTuner(const BandConfig& config, bool audio,
    const sp<V1_0::ITunerCallback>& callback, openTuner_cb _hidl_cb)
{
Loading