summaryrefslogtreecommitdiffstats
path: root/broadcastradio
diff options
context:
space:
mode:
Diffstat (limited to 'broadcastradio')
-rw-r--r--broadcastradio/1.0/Android.mk19
-rw-r--r--broadcastradio/1.0/default/Android.bp41
-rw-r--r--broadcastradio/1.0/default/Android.mk28
-rw-r--r--broadcastradio/1.0/vts/Android.mk19
-rw-r--r--broadcastradio/1.0/vts/functional/VtsHalBroadcastradioV1_0TargetTest.cpp195
-rw-r--r--broadcastradio/1.1/Android.mk19
-rw-r--r--broadcastradio/1.1/ITuner.hal34
-rw-r--r--broadcastradio/1.1/ITunerCallback.hal10
-rw-r--r--broadcastradio/1.1/default/Android.bp42
-rw-r--r--broadcastradio/1.1/default/Android.mk46
-rw-r--r--broadcastradio/1.1/default/Tuner.cpp15
-rw-r--r--broadcastradio/1.1/default/Tuner.h2
-rw-r--r--broadcastradio/1.1/types.hal28
-rw-r--r--broadcastradio/1.1/vts/Android.mk19
-rw-r--r--broadcastradio/1.1/vts/functional/VtsHalBroadcastradioV1_1TargetTest.cpp4
-rw-r--r--broadcastradio/Android.bp2
16 files changed, 316 insertions, 207 deletions
diff --git a/broadcastradio/1.0/Android.mk b/broadcastradio/1.0/Android.mk
deleted file mode 100644
index f9e32763ff..0000000000
--- a/broadcastradio/1.0/Android.mk
+++ /dev/null
@@ -1,19 +0,0 @@
-#
-# Copyright (C) 2016 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.
-#
-
-LOCAL_PATH := $(call my-dir)
-
-include $(call all-subdir-makefiles)
diff --git a/broadcastradio/1.0/default/Android.bp b/broadcastradio/1.0/default/Android.bp
new file mode 100644
index 0000000000..f961dfd4f0
--- /dev/null
+++ b/broadcastradio/1.0/default/Android.bp
@@ -0,0 +1,41 @@
+//
+// 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.
+//
+
+cc_library_shared {
+ name: "android.hardware.broadcastradio@1.0-impl",
+ vendor: true,
+ relative_install_path: "hw",
+ cflags: [
+ "-Wall",
+ "-Wextra",
+ "-Werror",
+ ],
+ srcs: [
+ "BroadcastRadio.cpp",
+ "BroadcastRadioFactory.cpp",
+ "Tuner.cpp",
+ "Utils.cpp",
+ ],
+ shared_libs: [
+ "libhidlbase",
+ "libhidltransport",
+ "libutils",
+ "liblog",
+ "libhardware",
+ "android.hardware.broadcastradio@1.0",
+ "libradio_metadata",
+ ],
+}
diff --git a/broadcastradio/1.0/default/Android.mk b/broadcastradio/1.0/default/Android.mk
deleted file mode 100644
index bb325953f4..0000000000
--- a/broadcastradio/1.0/default/Android.mk
+++ /dev/null
@@ -1,28 +0,0 @@
-LOCAL_PATH := $(call my-dir)
-
-include $(CLEAR_VARS)
-LOCAL_MODULE := android.hardware.broadcastradio@1.0-impl
-LOCAL_PROPRIETARY_MODULE := true
-LOCAL_MODULE_RELATIVE_PATH := hw
-LOCAL_SRC_FILES := \
- BroadcastRadio.cpp \
- BroadcastRadioFactory.cpp \
- Tuner.cpp \
- Utils.cpp
-
-LOCAL_SHARED_LIBRARIES := \
- libhidlbase \
- libhidltransport \
- libutils \
- liblog \
- libhardware \
- android.hardware.broadcastradio@1.0 \
- libradio_metadata
-
-ifeq ($(strip $(AUDIOSERVER_MULTILIB)),)
-LOCAL_MULTILIB := 32
-else
-LOCAL_MULTILIB := $(AUDIOSERVER_MULTILIB)
-endif
-
-include $(BUILD_SHARED_LIBRARY)
diff --git a/broadcastradio/1.0/vts/Android.mk b/broadcastradio/1.0/vts/Android.mk
deleted file mode 100644
index f9e32763ff..0000000000
--- a/broadcastradio/1.0/vts/Android.mk
+++ /dev/null
@@ -1,19 +0,0 @@
-#
-# Copyright (C) 2016 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.
-#
-
-LOCAL_PATH := $(call my-dir)
-
-include $(call all-subdir-makefiles)
diff --git a/broadcastradio/1.0/vts/functional/VtsHalBroadcastradioV1_0TargetTest.cpp b/broadcastradio/1.0/vts/functional/VtsHalBroadcastradioV1_0TargetTest.cpp
index ebeadb13da..fd048db35d 100644
--- a/broadcastradio/1.0/vts/functional/VtsHalBroadcastradioV1_0TargetTest.cpp
+++ b/broadcastradio/1.0/vts/functional/VtsHalBroadcastradioV1_0TargetTest.cpp
@@ -46,7 +46,8 @@ using ::android::hardware::broadcastradio::V1_0::BandConfig;
using ::android::hardware::broadcastradio::V1_0::Direction;
using ::android::hardware::broadcastradio::V1_0::ProgramInfo;
using ::android::hardware::broadcastradio::V1_0::MetaData;
-
+using ::android::hardware::broadcastradio::V1_0::MetadataKey;
+using ::android::hardware::broadcastradio::V1_0::MetadataType;
#define RETURN_IF_SKIPPED \
if (skipped) { \
@@ -229,6 +230,18 @@ class BroadcastRadioHidlTest : public ::testing::VtsHalHidlTargetTestBase,
bool openTuner();
bool checkAntenna();
+ /**
+ * Retrieves AM/FM band configuration from module properties.
+ *
+ * The configuration may not exist: if radio type is other than AM/FM
+ * or provided index is out of bounds.
+ * In such case, empty configuration is returned.
+ *
+ * @param idx Band index to retrieve.
+ * @return Band configuration reference.
+ */
+ const BandConfig& getBand(unsigned idx);
+
static const nsecs_t kConnectCallbacktimeoutNs = seconds_to_nanoseconds(1);
static const nsecs_t kConfigCallbacktimeoutNs = seconds_to_nanoseconds(10);
static const nsecs_t kTuneCallbacktimeoutNs = seconds_to_nanoseconds(30);
@@ -237,6 +250,7 @@ class BroadcastRadioHidlTest : public ::testing::VtsHalHidlTargetTestBase,
bool skipped;
sp<IBroadcastRadio> mRadio;
Properties mHalProperties;
+ bool mHalPropertiesInitialized = false;
sp<ITuner> mTuner;
sp<MyCallback> mTunerCallback;
Mutex mLock;
@@ -280,23 +294,29 @@ static bool operator==(const BandConfig& l, const BandConfig& r) {
bool BroadcastRadioHidlTest::getProperties()
{
- if (mHalProperties.bands.size() == 0) {
- Result halResult = Result::NOT_INITIALIZED;
- Return<void> hidlReturn =
- mRadio->getProperties([&](Result result, const Properties& properties) {
- halResult = result;
- if (result == Result::OK) {
- mHalProperties = properties;
- }
- });
+ if (mHalPropertiesInitialized) return true;
- EXPECT_TRUE(hidlReturn.isOk());
- EXPECT_EQ(Result::OK, halResult);
- EXPECT_EQ(Class::AM_FM, mHalProperties.classId);
- EXPECT_GT(mHalProperties.numTuners, 0u);
+ Result halResult = Result::NOT_INITIALIZED;
+ auto hidlReturn = mRadio->getProperties([&](Result result, const Properties& properties) {
+ halResult = result;
+ if (result == Result::OK) {
+ mHalProperties = properties;
+ }
+ });
+
+ EXPECT_TRUE(hidlReturn.isOk());
+ EXPECT_EQ(Result::OK, halResult);
+ EXPECT_EQ(radioClass, mHalProperties.classId);
+ EXPECT_GT(mHalProperties.numTuners, 0u);
+ if (radioClass == Class::AM_FM) {
EXPECT_GT(mHalProperties.bands.size(), 0u);
}
- return mHalProperties.bands.size() > 0;
+
+ if (hidlReturn.isOk() && halResult == Result::OK) {
+ mHalPropertiesInitialized = true;
+ return true;
+ }
+ return false;
}
bool BroadcastRadioHidlTest::openTuner()
@@ -306,17 +326,18 @@ bool BroadcastRadioHidlTest::openTuner()
}
if (mTuner.get() == nullptr) {
Result halResult = Result::NOT_INITIALIZED;
- Return<void> hidlReturn =
- mRadio->openTuner(mHalProperties.bands[0], true, mTunerCallback,
- [&](Result result, const sp<ITuner>& tuner) {
- halResult = result;
- if (result == Result::OK) {
- mTuner = tuner;
- }
- });
+ auto openCb = [&](Result result, const sp<ITuner>& tuner) {
+ halResult = result;
+ if (result == Result::OK) {
+ mTuner = tuner;
+ }
+ };
+ auto hidlReturn = mRadio->openTuner(getBand(0), true, mTunerCallback, openCb);
EXPECT_TRUE(hidlReturn.isOk());
EXPECT_EQ(Result::OK, halResult);
- EXPECT_EQ(true, waitForCallback(kConfigCallbacktimeoutNs));
+ if (radioClass == Class::AM_FM) {
+ EXPECT_EQ(true, waitForCallback(kConfigCallbacktimeoutNs));
+ }
}
EXPECT_NE(nullptr, mTuner.get());
return nullptr != mTuner.get();
@@ -324,6 +345,8 @@ bool BroadcastRadioHidlTest::openTuner()
bool BroadcastRadioHidlTest::checkAntenna()
{
+ if (radioClass != Class::AM_FM) return true;
+
BandConfig halConfig;
Result halResult = Result::NOT_INITIALIZED;
Return<void> hidlReturn =
@@ -337,6 +360,19 @@ bool BroadcastRadioHidlTest::checkAntenna()
return ((halResult == Result::OK) && (halConfig.antennaConnected == true));
}
+const BandConfig& BroadcastRadioHidlTest::getBand(unsigned idx) {
+ static BandConfig dummyBandConfig = {};
+ if (radioClass == Class::AM_FM) {
+ EXPECT_GT(mHalProperties.bands.size(), idx);
+ if (mHalProperties.bands.size() > idx) {
+ return mHalProperties.bands[idx];
+ } else {
+ return dummyBandConfig;
+ }
+ } else {
+ return dummyBandConfig;
+ }
+}
/**
* Test IBroadcastRadio::getProperties() method
@@ -344,7 +380,7 @@ bool BroadcastRadioHidlTest::checkAntenna()
* Verifies that:
* - the HAL implements the method
* - the method returns 0 (no error)
- * - the implementation class is AM_FM
+ * - the implementation class is radioClass
* - the implementation supports at least one tuner
* - the implementation supports at one band
*/
@@ -383,22 +419,24 @@ TEST_P(BroadcastRadioHidlTest, ReopenTuner) {
* Test IBroadcastRadio::openTuner() method called twice.
*
* Verifies that:
- * - the openTuner method fails when called for the second time without deleting previous
- * ITuner instance
+ * - the openTuner method fails with INVALID_STATE or succeeds when called for the second time
+ * without deleting previous ITuner instance
*/
TEST_P(BroadcastRadioHidlTest, OpenTunerTwice) {
RETURN_IF_SKIPPED;
EXPECT_TRUE(openTuner());
Result halResult = Result::NOT_INITIALIZED;
- Return<void> hidlReturn =
- mRadio->openTuner(mHalProperties.bands[0], true, mTunerCallback,
- [&](Result result, const sp<ITuner>&) {
- halResult = result;
- });
+ auto openCb = [&](Result result, const sp<ITuner>&) { halResult = result; };
+ auto hidlReturn = mRadio->openTuner(getBand(0), true, mTunerCallback, openCb);
EXPECT_TRUE(hidlReturn.isOk());
- EXPECT_EQ(Result::INVALID_STATE, halResult);
- EXPECT_TRUE(waitForCallback(kConfigCallbacktimeoutNs));
+ if (halResult == Result::OK) {
+ if (radioClass == Class::AM_FM) {
+ EXPECT_TRUE(waitForCallback(kConfigCallbacktimeoutNs));
+ }
+ } else {
+ EXPECT_EQ(Result::INVALID_STATE, halResult);
+ }
}
/**
@@ -409,18 +447,22 @@ TEST_P(BroadcastRadioHidlTest, OpenTunerTwice) {
* - the methods return 0 (no error)
* - the configuration callback is received within kConfigCallbacktimeoutNs ns
* - the configuration read back from HAl has the same class Id
+ *
+ * Skipped for other radio classes than AM/FM, because setConfiguration
+ * applies only for these bands.
*/
TEST_P(BroadcastRadioHidlTest, SetAndGetConfiguration) {
+ if (radioClass != Class::AM_FM) skipped = true;
RETURN_IF_SKIPPED;
ASSERT_EQ(true, openTuner());
// test setConfiguration
mCallbackCalled = false;
- Return<Result> hidlResult = mTuner->setConfiguration(mHalProperties.bands[1]);
+ Return<Result> hidlResult = mTuner->setConfiguration(getBand(1));
EXPECT_TRUE(hidlResult.isOk());
EXPECT_EQ(Result::OK, hidlResult);
EXPECT_EQ(true, waitForCallback(kConfigCallbacktimeoutNs));
EXPECT_EQ(Result::OK, mResultCallbackData);
- EXPECT_EQ(mHalProperties.bands[1], mBandConfigCallbackData);
+ EXPECT_EQ(getBand(1), mBandConfigCallbackData);
// test getConfiguration
BandConfig halConfig;
@@ -434,7 +476,7 @@ TEST_P(BroadcastRadioHidlTest, SetAndGetConfiguration) {
});
EXPECT_TRUE(hidlReturn.isOk());
EXPECT_EQ(Result::OK, halResult);
- EXPECT_EQ(mHalProperties.bands[1], halConfig);
+ EXPECT_EQ(getBand(1), halConfig);
}
/**
@@ -443,8 +485,12 @@ TEST_P(BroadcastRadioHidlTest, SetAndGetConfiguration) {
* Verifies that:
* - the methods returns INVALID_ARGUMENTS on invalid arguments
* - the method recovers and succeeds after passing correct arguments
+ *
+ * Skipped for other radio classes than AM/FM, because setConfiguration
+ * applies only for these bands.
*/
TEST_P(BroadcastRadioHidlTest, SetConfigurationFails) {
+ if (radioClass != Class::AM_FM) skipped = true;
RETURN_IF_SKIPPED;
ASSERT_EQ(true, openTuner());
@@ -463,7 +509,7 @@ TEST_P(BroadcastRadioHidlTest, SetConfigurationFails) {
// Test setConfiguration recovering after passing good data.
mCallbackCalled = false;
- setResult = mTuner->setConfiguration(mHalProperties.bands[0]);
+ setResult = mTuner->setConfiguration(getBand(0));
EXPECT_TRUE(setResult.isOk());
EXPECT_EQ(Result::OK, setResult);
EXPECT_EQ(true, waitForCallback(kConfigCallbacktimeoutNs));
@@ -506,8 +552,12 @@ TEST_P(BroadcastRadioHidlTest, Scan) {
* - the method returns 0 (no error)
* - the tuned callback is received within kTuneCallbacktimeoutNs ns
* - skipping sub-channel or not does not fail the call
+ *
+ * Skipped for other radio classes than AM/FM, because step is not possible
+ * on DAB nor satellite.
*/
TEST_P(BroadcastRadioHidlTest, Step) {
+ if (radioClass != Class::AM_FM) skipped = true;
RETURN_IF_SKIPPED;
ASSERT_EQ(true, openTuner());
ASSERT_TRUE(checkAntenna());
@@ -533,20 +583,26 @@ TEST_P(BroadcastRadioHidlTest, Step) {
* - the HAL implements the methods
* - the methods return 0 (no error)
* - the tuned callback is received within kTuneCallbacktimeoutNs ns after tune()
+ *
+ * Skipped for other radio classes than AM/FM, because tune to frequency
+ * is not possible on DAB nor satellite.
*/
TEST_P(BroadcastRadioHidlTest, TuneAndGetProgramInformationAndCancel) {
+ if (radioClass != Class::AM_FM) skipped = true;
RETURN_IF_SKIPPED;
ASSERT_EQ(true, openTuner());
ASSERT_TRUE(checkAntenna());
+ auto& band = getBand(0);
+
// test tune
- ASSERT_GT(mHalProperties.bands[0].spacings.size(), 0u);
- ASSERT_GT(mHalProperties.bands[0].upperLimit, mHalProperties.bands[0].lowerLimit);
+ ASSERT_GT(band.spacings.size(), 0u);
+ ASSERT_GT(band.upperLimit, band.lowerLimit);
// test scan UP
- uint32_t lowerLimit = mHalProperties.bands[0].lowerLimit;
- uint32_t upperLimit = mHalProperties.bands[0].upperLimit;
- uint32_t spacing = mHalProperties.bands[0].spacings[0];
+ uint32_t lowerLimit = band.lowerLimit;
+ uint32_t upperLimit = band.upperLimit;
+ uint32_t spacing = band.spacings[0];
uint32_t channel =
lowerLimit + (((upperLimit - lowerLimit) / 2 + spacing - 1) / spacing) * spacing;
@@ -571,11 +627,8 @@ TEST_P(BroadcastRadioHidlTest, TuneAndGetProgramInformationAndCancel) {
EXPECT_TRUE(hidlReturn.isOk());
EXPECT_EQ(Result::OK, halResult);
if (mResultCallbackData == Result::OK) {
- EXPECT_EQ(true, halInfo.tuned);
EXPECT_LE(halInfo.channel, upperLimit);
EXPECT_GE(halInfo.channel, lowerLimit);
- } else {
- EXPECT_EQ(false, halInfo.tuned);
}
// test cancel
@@ -591,8 +644,12 @@ TEST_P(BroadcastRadioHidlTest, TuneAndGetProgramInformationAndCancel) {
* Verifies that:
* - the method returns INVALID_ARGUMENTS when applicable
* - the method recovers and succeeds after passing correct arguments
+ *
+ * Skipped for other radio classes than AM/FM, because tune to frequency
+ * is not possible on DAB nor satellite.
*/
TEST_P(BroadcastRadioHidlTest, TuneFailsOutOfBounds) {
+ if (radioClass != Class::AM_FM) skipped = true;
RETURN_IF_SKIPPED;
ASSERT_TRUE(openTuner());
ASSERT_TRUE(checkAntenna());
@@ -622,6 +679,52 @@ TEST_P(BroadcastRadioHidlTest, TuneFailsOutOfBounds) {
EXPECT_TRUE(waitForCallback(kTuneCallbacktimeoutNs));
}
+/**
+ * Test proper image format in metadata.
+ *
+ * Verifies that:
+ * - all images in metadata are provided in-band (as a binary blob, not by id)
+ *
+ * This is a counter-test for OobImagesOnly from 1.1 VTS.
+ */
+TEST_P(BroadcastRadioHidlTest, IbImagesOnly) {
+ RETURN_IF_SKIPPED;
+ ASSERT_TRUE(openTuner());
+ ASSERT_TRUE(checkAntenna());
+
+ bool firstScan = true;
+ uint32_t firstChannel, prevChannel;
+ while (true) {
+ mCallbackCalled = false;
+ auto hidlResult = mTuner->scan(Direction::UP, true);
+ ASSERT_TRUE(hidlResult.isOk());
+ if (hidlResult == Result::TIMEOUT) {
+ ALOGI("Got timeout on scan operation");
+ break;
+ }
+ ASSERT_EQ(Result::OK, hidlResult);
+ ASSERT_EQ(true, waitForCallback(kTuneCallbacktimeoutNs));
+
+ if (firstScan) {
+ firstScan = false;
+ firstChannel = mProgramInfoCallbackData.channel;
+ } else {
+ // scanned the whole band
+ if (mProgramInfoCallbackData.channel >= firstChannel && prevChannel <= firstChannel) {
+ break;
+ }
+ }
+ prevChannel = mProgramInfoCallbackData.channel;
+
+ for (auto&& entry : mProgramInfoCallbackData.metadata) {
+ if (entry.key != MetadataKey::ICON && entry.key != MetadataKey::ART) continue;
+ EXPECT_EQ(MetadataType::RAW, entry.type);
+ EXPECT_EQ(0, entry.intValue);
+ EXPECT_GT(entry.rawValue.size(), 0u);
+ }
+ }
+}
+
INSTANTIATE_TEST_CASE_P(
BroadcastRadioHidlTestCases,
BroadcastRadioHidlTest,
diff --git a/broadcastradio/1.1/Android.mk b/broadcastradio/1.1/Android.mk
deleted file mode 100644
index 0c4c55d1ca..0000000000
--- a/broadcastradio/1.1/Android.mk
+++ /dev/null
@@ -1,19 +0,0 @@
-#
-# 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.
-#
-
-LOCAL_PATH := $(call my-dir)
-
-include $(call all-subdir-makefiles)
diff --git a/broadcastradio/1.1/ITuner.hal b/broadcastradio/1.1/ITuner.hal
index 82d45c6b5e..751162966f 100644
--- a/broadcastradio/1.1/ITuner.hal
+++ b/broadcastradio/1.1/ITuner.hal
@@ -47,8 +47,8 @@ interface ITuner extends @1.0::ITuner {
*
* @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
+ * UNAVAILABLE if the background scan is unavailable,
+ * ie. temporarily due to ongoing foreground
* playback in single-tuner device.
* NOT_INITIALIZED other error, ie. HW failure.
*/
@@ -65,6 +65,7 @@ interface ITuner extends @1.0::ITuner {
* Client application MUST verify vendor/product name
* before setting this parameter to anything else.
* @return result OK if the list was successfully retrieved.
+ * INVALID_ARGUMENTS if invalid arguments are passed
* NOT_READY if the scan is in progress.
* NOT_STARTED if the scan has not been started, client may
* call startBackgroundScan to fix this.
@@ -74,4 +75,33 @@ interface ITuner extends @1.0::ITuner {
getProgramList(string filter)
generates (ProgramListResult result, vec<ProgramInfo> programList);
+ /**
+ * Checks, if the analog playback is forced, see setAnalogForced.
+ *
+ * The isForced value is only valid if result was OK.
+ *
+ * @return result OK if the call succeeded and isForced is valid.
+ * INVALID_STATE if the switch is not supported at current
+ * configuration.
+ * NOT_INITIALIZED if any other error occurs.
+ * @return isForced true if analog is forced, false otherwise.
+ */
+ isAnalogForced() generates (Result result, bool isForced);
+
+ /**
+ * 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 managed from the HAL implementation side.
+ *
+ * Some radio technologies may not support this, ie. DAB.
+ *
+ * @param isForced true to force analog, false for a default behaviour.
+ * @return result OK if the setting was successfully done.
+ * INVALID_STATE if the switch is not supported at current
+ * configuration.
+ * NOT_INITIALIZED if any other error occurs.
+ */
+ setAnalogForced(bool isForced) generates (Result result);
};
diff --git a/broadcastradio/1.1/ITunerCallback.hal b/broadcastradio/1.1/ITunerCallback.hal
index 07ce984e95..158e2170b1 100644
--- a/broadcastradio/1.1/ITunerCallback.hal
+++ b/broadcastradio/1.1/ITunerCallback.hal
@@ -40,11 +40,19 @@ interface ITunerCallback extends @1.0::ITunerCallback {
oneway afSwitch_1_1(ProgramInfo info);
/**
+ * Called by the HAL when background scan feature becomes available or not.
+ *
+ * @param isAvailable true, if the tuner turned temporarily background-
+ * capable, false in the other case.
+ */
+ oneway backgroundScanAvailable(bool isAvailable);
+
+ /**
* 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
+ * UNAVAILABLE if the scan was interrupted due to
* hardware becoming temporarily unavailable.
* NOT_INITIALIZED other error, ie. HW failure.
*/
diff --git a/broadcastradio/1.1/default/Android.bp b/broadcastradio/1.1/default/Android.bp
new file mode 100644
index 0000000000..759eb09118
--- /dev/null
+++ b/broadcastradio/1.1/default/Android.bp
@@ -0,0 +1,42 @@
+//
+// 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.
+//
+
+cc_library_shared {
+ name: "android.hardware.broadcastradio@1.1-impl",
+ vendor: true,
+ relative_install_path: "hw",
+ cflags: [
+ "-Wall",
+ "-Wextra",
+ "-Werror",
+ ],
+ srcs: [
+ "BroadcastRadio.cpp",
+ "BroadcastRadioFactory.cpp",
+ "Tuner.cpp",
+ "Utils.cpp",
+ ],
+ shared_libs: [
+ "libhidlbase",
+ "libhidltransport",
+ "libutils",
+ "liblog",
+ "libhardware",
+ "android.hardware.broadcastradio@1.0",
+ "android.hardware.broadcastradio@1.1",
+ "libradio_metadata",
+ ],
+}
diff --git a/broadcastradio/1.1/default/Android.mk b/broadcastradio/1.1/default/Android.mk
deleted file mode 100644
index bb32d5072a..0000000000
--- a/broadcastradio/1.1/default/Android.mk
+++ /dev/null
@@ -1,46 +0,0 @@
-#
-# 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.
-#
-
-LOCAL_PATH := $(call my-dir)
-
-include $(CLEAR_VARS)
-LOCAL_MODULE := android.hardware.broadcastradio@1.1-impl
-LOCAL_PROPRIETARY_MODULE := true
-LOCAL_MODULE_RELATIVE_PATH := hw
-LOCAL_CFLAGS += -Werror -Wall -Wextra
-LOCAL_SRC_FILES := \
- BroadcastRadio.cpp \
- BroadcastRadioFactory.cpp \
- Tuner.cpp \
- Utils.cpp
-
-LOCAL_SHARED_LIBRARIES := \
- libhidlbase \
- libhidltransport \
- libutils \
- liblog \
- libhardware \
- android.hardware.broadcastradio@1.0 \
- android.hardware.broadcastradio@1.1 \
- libradio_metadata
-
-ifeq ($(strip $(AUDIOSERVER_MULTILIB)),)
-LOCAL_MULTILIB := 32
-else
-LOCAL_MULTILIB := $(AUDIOSERVER_MULTILIB)
-endif
-
-include $(BUILD_SHARED_LIBRARY)
diff --git a/broadcastradio/1.1/default/Tuner.cpp b/broadcastradio/1.1/default/Tuner.cpp
index f280754c86..ae5848cec7 100644
--- a/broadcastradio/1.1/default/Tuner.cpp
+++ b/broadcastradio/1.1/default/Tuner.cpp
@@ -201,16 +201,27 @@ exit:
}
Return<ProgramListResult> Tuner::startBackgroundScan() {
- return ProgramListResult::NOT_INITIALIZED;
+ return ProgramListResult::UNAVAILABLE;
}
Return<void> Tuner::getProgramList(const hidl_string& filter __unused, getProgramList_cb _hidl_cb) {
hidl_vec<ProgramInfo> pList;
// TODO(b/34054813): do the actual implementation.
- _hidl_cb(ProgramListResult::NOT_INITIALIZED, pList);
+ _hidl_cb(ProgramListResult::NOT_STARTED, pList);
return Void();
}
+Return<void> Tuner::isAnalogForced(isAnalogForced_cb _hidl_cb) {
+ // TODO(b/34348946): do the actual implementation.
+ _hidl_cb(Result::INVALID_STATE, false);
+ return Void();
+}
+
+Return<Result> Tuner::setAnalogForced(bool isForced __unused) {
+ // TODO(b/34348946): do the actual implementation.
+ return Result::INVALID_STATE;
+}
+
} // namespace implementation
} // namespace V1_1
} // namespace broadcastradio
diff --git a/broadcastradio/1.1/default/Tuner.h b/broadcastradio/1.1/default/Tuner.h
index d7b4545cc7..57eafd3d7c 100644
--- a/broadcastradio/1.1/default/Tuner.h
+++ b/broadcastradio/1.1/default/Tuner.h
@@ -44,6 +44,8 @@ struct Tuner : public ITuner {
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;
+ Return<void> isAnalogForced(isAnalogForced_cb _hidl_cb) override;
+ Return<Result> setAnalogForced(bool isForced) override;
static void callback(radio_hal_event_t *halEvent, void *cookie);
void onCallback(radio_hal_event_t *halEvent);
diff --git a/broadcastradio/1.1/types.hal b/broadcastradio/1.1/types.hal
index 3021f2eb19..5577ea02da 100644
--- a/broadcastradio/1.1/types.hal
+++ b/broadcastradio/1.1/types.hal
@@ -23,7 +23,7 @@ typedef @1.0::Result Result;
enum ProgramListResult : Result {
NOT_READY,
NOT_STARTED,
- TEMPORARILY_UNAVAILABLE,
+ UNAVAILABLE,
};
/**
@@ -53,6 +53,18 @@ struct Properties {
* it may not be available though, see startBackgroundScan.
*/
bool supportsBackgroundScanning;
+
+ /**
+ * Opaque vendor-specific string, to be passed to front-end without changes.
+ * Format of this string can vary across vendors.
+ *
+ * It may be used for extra features, that's not supported by a platform,
+ * for example: "preset-slots=6;ultra-hd-capable=false".
+ *
+ * Front-end application MUST verify vendor/product name from the
+ * @1.0::Properties struct before doing any interpretation of this value.
+ */
+ string vendorExension;
};
/**
@@ -64,10 +76,14 @@ struct ProgramInfo {
bitfield<ProgramInfoFlags> flags;
/**
- * Vendors are allowed to define their own set of flags and store it in this
- * field. They MUST verify vendor/product name from Properties struct
- * (IBroadcastRadio::getProperties) before doing any interpretation
- * of such values.
+ * Opaque vendor-specific string, to be passed to front-end without changes.
+ * Format of this string can vary across vendors.
+ *
+ * It may be used for extra features, that's not supported by a platform,
+ * for example: "paid-service=true;bitrate=320kbps".
+ *
+ * Front-end application MUST verify vendor/product name from the
+ * @1.0::Properties struct before doing any interpretation of this value.
*/
- uint32_t vendorFlags;
+ string vendorExension;
};
diff --git a/broadcastradio/1.1/vts/Android.mk b/broadcastradio/1.1/vts/Android.mk
deleted file mode 100644
index 0c4c55d1ca..0000000000
--- a/broadcastradio/1.1/vts/Android.mk
+++ /dev/null
@@ -1,19 +0,0 @@
-#
-# 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.
-#
-
-LOCAL_PATH := $(call my-dir)
-
-include $(call all-subdir-makefiles)
diff --git a/broadcastradio/1.1/vts/functional/VtsHalBroadcastradioV1_1TargetTest.cpp b/broadcastradio/1.1/vts/functional/VtsHalBroadcastradioV1_1TargetTest.cpp
index d3c05c47fb..aa5ab548f6 100644
--- a/broadcastradio/1.1/vts/functional/VtsHalBroadcastradioV1_1TargetTest.cpp
+++ b/broadcastradio/1.1/vts/functional/VtsHalBroadcastradioV1_1TargetTest.cpp
@@ -129,6 +129,10 @@ class BroadcastRadioHidlTest : public ::testing::VtsHalHidlTargetTestBase {
return Void();
}
+ virtual Return<void> backgroundScanAvailable(bool isAvailable __unused) {
+ return Void();
+ }
+
virtual Return<void> backgroundScanComplete(ProgramListResult result __unused) {
return Void();
}
diff --git a/broadcastradio/Android.bp b/broadcastradio/Android.bp
index 5cacbf3417..7a315faab3 100644
--- a/broadcastradio/Android.bp
+++ b/broadcastradio/Android.bp
@@ -1,7 +1,9 @@
// This is an autogenerated file, do not edit.
subdirs = [
"1.0",
+ "1.0/default",
"1.0/vts/functional",
"1.1",
+ "1.1/default",
"1.1/vts/functional",
]