name: "android.hardware.broadcastradio@1.1_hal",
srcs: [
"types.hal",
+ "IBroadcastRadio.hal",
"IBroadcastRadioFactory.hal",
"ITuner.hal",
"ITunerCallback.hal",
],
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",
],
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",
--- /dev/null
+/*
+ * 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);
+
+};
* NOT_INITIALIZED if another error occurs
* @return info Current program information.
*/
- getProgramInformation_1_1() generates(Result result, ProgramInfo info);
+ 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.
* 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.
*/
getProgramList(string filter)
- generates(ProgramListResult result, vec<ProgramInfo> programList);
+ generates (ProgramListResult result, vec<ProgramInfo> programList);
};
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 {
/*
* @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();
};
}
-// 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;
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)
{
#ifndef ANDROID_HARDWARE_BROADCASTRADIO_V1_1_BROADCASTRADIO_H
#define ANDROID_HARDWARE_BROADCASTRADIO_V1_1_BROADCASTRADIO_H
-#include <android/hardware/broadcastradio/1.0/IBroadcastRadio.h>
+#include <android/hardware/broadcastradio/1.1/IBroadcastRadio.h>
#include <android/hardware/broadcastradio/1.1/types.h>
#include <hardware/radio.h>
using V1_0::BandConfig;
using V1_0::Properties;
-struct BroadcastRadio : public V1_0::IBroadcastRadio {
+struct BroadcastRadio : public V1_1::IBroadcastRadio {
BroadcastRadio(Class classId);
- // Methods from ::android::hardware::broadcastradio::V1_0::IBroadcastRadio follow.
+ // Methods from ::android::hardware::broadcastradio::V1_1::IBroadcastRadio follow.
Return<void> getProperties(getProperties_cb _hidl_cb) override;
+ Return<void> getProperties_1_1(getProperties_1_1_cb _hidl_cb) override;
Return<void> openTuner(const BandConfig& config, bool audio,
const sp<V1_0::ITunerCallback>& callback, openTuner_cb _hidl_cb) override;
return Void();
}
+Return<ProgramListResult> Tuner::startBackgroundScan() {
+ return ProgramListResult::NOT_INITIALIZED;
+}
+
Return<void> Tuner::getProgramList(const hidl_string& filter __unused, getProgramList_cb _hidl_cb) {
hidl_vec<ProgramInfo> pList;
// TODO(b/34054813): do the actual implementation.
Return<Result> cancel() override;
Return<void> getProgramInformation(getProgramInformation_cb _hidl_cb) override;
Return<void> getProgramInformation_1_1(getProgramInformation_1_1_cb _hidl_cb) override;
+ Return<ProgramListResult> startBackgroundScan() override;
Return<void> getProgramList(const hidl_string& filter, getProgramList_cb _hidl_cb) override;
static void callback(radio_hal_event_t *halEvent, void *cookie);
MUTED = 1 << 1,
};
+struct Properties {
+ @1.0::Properties base;
+
+ /**
+ * The hardware supports background scanning in general. At the given time
+ * it may not be available though, see startBackgroundScan.
+ */
+ bool supportsBackgroundScanning;
+};
+
/**
* Radio program information. Returned by the HAL with event RADIO_EVENT_TUNED.
* Contains information on currently tuned channel.
using ::android::hardware::broadcastradio::V1_1::ITunerCallback;
using ::android::hardware::broadcastradio::V1_1::ProgramInfo;
using ::android::hardware::broadcastradio::V1_1::Result;
+using ::android::hardware::broadcastradio::V1_1::ProgramListResult;
// The main test class for Broadcast Radio HIDL HAL.
return Void();
}
+ virtual Return<void> backgroundScanComplete(ProgramListResult result __unused) {
+ return Void();
+ }
+
+ virtual Return<void> programListChanged() {
+ return Void();
+ }
+
MyCallback(BroadcastRadioHidlTest *parentTest) : mParentTest(parentTest) {}
private: