* This call does not trigger actual scan, but operates on the list cached
* internally at the driver level.
*
- * @param filter vendor-specific filter for the stations to be retrieved.
- * An empty string MUST result in full list.
- * Client application MUST verify vendor/product name
- * before setting this parameter to anything else.
+ * @param vendorFilter vendor-specific filter for the stations to be retrieved.
+ * An empty vector MUST result in full list for a given tuner.
* @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_INITIALIZED if any other error occurs.
* @return programList List of stations available for user.
*/
- getProgramList(string filter)
+ getProgramList(vec<VendorKeyValue> vendorFilter)
generates (ProgramListResult result, vec<ProgramInfo> programList);
/**
prop10.numAudioSources = 1;
prop10.supportsCapture = false;
prop11.supportsBackgroundScanning = false;
- prop11.supportedProgramTypes = vector<uint32_t>({
+ prop11.supportedProgramTypes = hidl_vec<uint32_t>({
static_cast<uint32_t>(ProgramType::AM), static_cast<uint32_t>(ProgramType::FM),
static_cast<uint32_t>(ProgramType::AM_HD), static_cast<uint32_t>(ProgramType::FM_HD),
});
- prop11.supportedIdentifierTypes = vector<uint32_t>({
+ prop11.supportedIdentifierTypes = hidl_vec<uint32_t>({
static_cast<uint32_t>(IdentifierType::AMFM_FREQUENCY),
static_cast<uint32_t>(IdentifierType::RDS_PI),
static_cast<uint32_t>(IdentifierType::HD_STATION_ID_EXT),
static_cast<uint32_t>(IdentifierType::HD_SUBCHANNEL),
});
- prop11.vendorInfo = "dummy";
+ prop11.vendorInfo = hidl_vec<VendorKeyValue>({
+ {"com.google.dummy", "dummy"},
+ });
prop10.bands.resize(mConfig.amFmBands.size());
for (size_t i = 0; i < mConfig.amFmBands.size(); i++) {
return ProgramListResult::UNAVAILABLE;
}
-Return<void> Tuner::getProgramList(const hidl_string& filter, getProgramList_cb _hidl_cb) {
- ALOGV("%s(%s)", __func__, filter.c_str());
+Return<void> Tuner::getProgramList(const hidl_vec<VendorKeyValue>& vendorFilter,
+ getProgramList_cb _hidl_cb) {
+ ALOGV("%s(%s)", __func__, toString(vendorFilter).substr(0, 100).c_str());
lock_guard<mutex> lk(mMut);
if (mIsClosed) {
_hidl_cb(ProgramListResult::NOT_INITIALIZED, {});
virtual Return<void> getProgramInformation(getProgramInformation_cb _hidl_cb) override;
virtual Return<void> getProgramInformation_1_1(getProgramInformation_1_1_cb _hidl_cb) override;
virtual Return<ProgramListResult> startBackgroundScan() override;
- virtual Return<void> getProgramList(const hidl_string& filter,
+ virtual Return<void> getProgramList(const hidl_vec<VendorKeyValue>& filter,
getProgramList_cb _hidl_cb) override;
virtual Return<Result> setAnalogForced(bool isForced) override;
virtual Return<void> isAnalogForced(isAnalogForced_cb _hidl_cb) override;
createDemoBitmap(MetadataKey::ART, halRev),
});
+ info11.vendorInfo = hidl_vec<VendorKeyValue>({
+ {"com.google.dummy", "dummy"},
+ {"com.google.dummy.VirtualProgram", std::to_string(reinterpret_cast<uintptr_t>(this))},
+ });
+
return info11;
}
TRAFFIC_ANNOUNCEMENT = 1 << 3,
};
+/**
+ * A key-value pair for vendor-specific information to be passed as-is through
+ * Android framework to the front-end application.
+ */
+struct VendorKeyValue {
+ /**
+ * Key must be prefixed with unique vendor Java-style namespace,
+ * eg. 'com.somecompany.parameter1'.
+ */
+ string key;
+
+ /**
+ * Value must be passed through the framework without any changes.
+ * Format of this string can vary across vendors.
+ */
+ string value;
+};
+
struct Properties {
@1.0::Properties base;
vec<uint32_t> supportedIdentifierTypes;
/**
- * Opaque vendor-specific string, to be passed to front-end without changes.
- * Format of this string can vary across vendors.
+ * Vendor-specific information.
*
- * 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.
+ * It may be used for extra features, not supported by the platform,
+ * for example: com.me.preset-slots=6; com.me.ultra-hd-capable=false.
*/
- string vendorInfo;
+ vec<VendorKeyValue> vendorInfo;
};
/**
bitfield<ProgramInfoFlags> flags;
/**
- * 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".
+ * Vendor-specific information.
*
- * Front-end application MUST verify vendor/product name from the
- * @1.0::Properties struct before doing any interpretation of this value.
+ * It may be used for extra features, not supported by the platform,
+ * for example: paid-service=true; bitrate=320kbps.
*/
- string vendorInfo;
+ vec<VendorKeyValue> vendorInfo;
};
// first try...
EXPECT_TIMEOUT_CALL(*mCallback, backgroundScanComplete, ProgramListResult::OK)
.Times(AnyNumber());
- auto hidlResult = mTuner->getProgramList("", getListCb);
+ auto hidlResult = mTuner->getProgramList({}, getListCb);
EXPECT_TRUE(hidlResult.isOk());
if (!hidlResult.isOk()) return false;
EXPECT_TIMEOUT_CALL_WAIT(*mCallback, backgroundScanComplete, kFullScanTimeout);
// second (last) try...
- hidlResult = mTuner->getProgramList("", getListCb);
+ hidlResult = mTuner->getProgramList({}, getListCb);
EXPECT_TRUE(hidlResult.isOk());
if (!hidlResult.isOk()) return false;
EXPECT_EQ(ProgramListResult::OK, getListResult);