diff --git a/broadcastradio/1.1/vts/functional/Android.bp b/broadcastradio/1.1/vts/functional/Android.bp index 4b93cbcf1f..3d4fe05678 100644 --- a/broadcastradio/1.1/vts/functional/Android.bp +++ b/broadcastradio/1.1/vts/functional/Android.bp @@ -21,8 +21,8 @@ cc_test { static_libs: [ "android.hardware.broadcastradio@1.0", "android.hardware.broadcastradio@1.1", - "android.hardware.broadcastradio@1.1-utils-lib", - "android.hardware.broadcastradio@1.1-vts-utils-lib", + "android.hardware.broadcastradio@common-utils-lib", + "android.hardware.broadcastradio@vts-utils-lib", "libgmock", ], } diff --git a/broadcastradio/1.2/Android.bp b/broadcastradio/1.2/Android.bp new file mode 100644 index 0000000000..44136c8a23 --- /dev/null +++ b/broadcastradio/1.2/Android.bp @@ -0,0 +1,84 @@ +// This file is autogenerated by hidl-gen. Do not edit manually. + +filegroup { + name: "android.hardware.broadcastradio@1.2_hal", + srcs: [ + "types.hal", + "IBroadcastRadioFactory.hal", + "ITuner.hal", + "ITunerCallback.hal", + ], +} + +genrule { + name: "android.hardware.broadcastradio@1.2_genc++", + tools: ["hidl-gen"], + cmd: "$(location hidl-gen) -o $(genDir) -Lc++-sources -randroid.hardware:hardware/interfaces -randroid.hidl:system/libhidl/transport android.hardware.broadcastradio@1.2", + srcs: [ + ":android.hardware.broadcastradio@1.2_hal", + ], + out: [ + "android/hardware/broadcastradio/1.2/types.cpp", + "android/hardware/broadcastradio/1.2/BroadcastRadioFactoryAll.cpp", + "android/hardware/broadcastradio/1.2/TunerAll.cpp", + "android/hardware/broadcastradio/1.2/TunerCallbackAll.cpp", + ], +} + +genrule { + name: "android.hardware.broadcastradio@1.2_genc++_headers", + tools: ["hidl-gen"], + cmd: "$(location hidl-gen) -o $(genDir) -Lc++-headers -randroid.hardware:hardware/interfaces -randroid.hidl:system/libhidl/transport android.hardware.broadcastradio@1.2", + srcs: [ + ":android.hardware.broadcastradio@1.2_hal", + ], + out: [ + "android/hardware/broadcastradio/1.2/types.h", + "android/hardware/broadcastradio/1.2/hwtypes.h", + "android/hardware/broadcastradio/1.2/IBroadcastRadioFactory.h", + "android/hardware/broadcastradio/1.2/IHwBroadcastRadioFactory.h", + "android/hardware/broadcastradio/1.2/BnHwBroadcastRadioFactory.h", + "android/hardware/broadcastradio/1.2/BpHwBroadcastRadioFactory.h", + "android/hardware/broadcastradio/1.2/BsBroadcastRadioFactory.h", + "android/hardware/broadcastradio/1.2/ITuner.h", + "android/hardware/broadcastradio/1.2/IHwTuner.h", + "android/hardware/broadcastradio/1.2/BnHwTuner.h", + "android/hardware/broadcastradio/1.2/BpHwTuner.h", + "android/hardware/broadcastradio/1.2/BsTuner.h", + "android/hardware/broadcastradio/1.2/ITunerCallback.h", + "android/hardware/broadcastradio/1.2/IHwTunerCallback.h", + "android/hardware/broadcastradio/1.2/BnHwTunerCallback.h", + "android/hardware/broadcastradio/1.2/BpHwTunerCallback.h", + "android/hardware/broadcastradio/1.2/BsTunerCallback.h", + ], +} + +cc_library { + name: "android.hardware.broadcastradio@1.2", + defaults: ["hidl-module-defaults"], + generated_sources: ["android.hardware.broadcastradio@1.2_genc++"], + generated_headers: ["android.hardware.broadcastradio@1.2_genc++_headers"], + export_generated_headers: ["android.hardware.broadcastradio@1.2_genc++_headers"], + vendor_available: true, + vndk: { + enabled: true, + }, + shared_libs: [ + "libhidlbase", + "libhidltransport", + "libhwbinder", + "liblog", + "libutils", + "libcutils", + "android.hardware.broadcastradio@1.0", + "android.hardware.broadcastradio@1.1", + ], + export_shared_lib_headers: [ + "libhidlbase", + "libhidltransport", + "libhwbinder", + "libutils", + "android.hardware.broadcastradio@1.0", + "android.hardware.broadcastradio@1.1", + ], +} diff --git a/broadcastradio/1.2/IBroadcastRadioFactory.hal b/broadcastradio/1.2/IBroadcastRadioFactory.hal new file mode 100644 index 0000000000..29f6ab35f1 --- /dev/null +++ b/broadcastradio/1.2/IBroadcastRadioFactory.hal @@ -0,0 +1,29 @@ +/* + * 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.2; + +import @1.1::IBroadcastRadioFactory; + +/** + * To use 1.2 features you must cast specific interfaces returned from the + * 1.0 HAL. For example V1_0::IBroadcastRadio::openTuner() returns V1_0::ITuner, + * which can be cast with V1_2::ITuner::castFrom() call. + * + * The 1.2 server must always return the 1.2 version of specific interface. + */ +interface IBroadcastRadioFactory extends @1.1::IBroadcastRadioFactory { +}; diff --git a/broadcastradio/1.2/ITuner.hal b/broadcastradio/1.2/ITuner.hal new file mode 100644 index 0000000000..ee8a45d336 --- /dev/null +++ b/broadcastradio/1.2/ITuner.hal @@ -0,0 +1,22 @@ +/* + * 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.2; + +import @1.1::ITuner; + +interface ITuner extends @1.1::ITuner { +}; diff --git a/broadcastradio/1.2/ITunerCallback.hal b/broadcastradio/1.2/ITunerCallback.hal new file mode 100644 index 0000000000..223a571cf9 --- /dev/null +++ b/broadcastradio/1.2/ITunerCallback.hal @@ -0,0 +1,22 @@ +/* + * 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.2; + +import @1.1::ITunerCallback; + +interface ITunerCallback extends @1.1::ITunerCallback { +}; diff --git a/broadcastradio/1.1/default/Android.bp b/broadcastradio/1.2/default/Android.bp similarity index 84% rename from broadcastradio/1.1/default/Android.bp rename to broadcastradio/1.2/default/Android.bp index 6d26b11bd8..e42cb1e7f7 100644 --- a/broadcastradio/1.1/default/Android.bp +++ b/broadcastradio/1.2/default/Android.bp @@ -15,8 +15,8 @@ // cc_binary { - name: "android.hardware.broadcastradio@1.1-service", - init_rc: ["android.hardware.broadcastradio@1.1-service.rc"], + name: "android.hardware.broadcastradio@1.2-service", + init_rc: ["android.hardware.broadcastradio@1.2-service.rc"], vendor: true, relative_install_path: "hw", cflags: [ @@ -33,11 +33,12 @@ cc_binary { "service.cpp" ], static_libs: [ - "android.hardware.broadcastradio@1.1-utils-lib", + "android.hardware.broadcastradio@common-utils-lib", ], shared_libs: [ "android.hardware.broadcastradio@1.0", "android.hardware.broadcastradio@1.1", + "android.hardware.broadcastradio@1.2", "libbase", "libhidlbase", "libhidltransport", diff --git a/broadcastradio/1.1/default/BroadcastRadio.cpp b/broadcastradio/1.2/default/BroadcastRadio.cpp similarity index 97% rename from broadcastradio/1.1/default/BroadcastRadio.cpp rename to broadcastradio/1.2/default/BroadcastRadio.cpp index 1bcfd824f7..5164e47356 100644 --- a/broadcastradio/1.1/default/BroadcastRadio.cpp +++ b/broadcastradio/1.2/default/BroadcastRadio.cpp @@ -25,7 +25,7 @@ namespace android { namespace hardware { namespace broadcastradio { -namespace V1_1 { +namespace V1_2 { namespace implementation { using V1_0::Band; @@ -33,6 +33,11 @@ using V1_0::BandConfig; using V1_0::Class; using V1_0::Deemphasis; using V1_0::Rds; +using V1_1::IdentifierType; +using V1_1::ProgramSelector; +using V1_1::ProgramType; +using V1_1::Properties; +using V1_1::VendorKeyValue; using std::lock_guard; using std::map; @@ -185,7 +190,7 @@ Return BroadcastRadio::getImage(int32_t id, getImage_cb _hidl_cb) { } } // namespace implementation -} // namespace V1_1 +} // namespace V1_2 } // namespace broadcastradio } // namespace hardware } // namespace android diff --git a/broadcastradio/1.1/default/BroadcastRadio.h b/broadcastradio/1.2/default/BroadcastRadio.h similarity index 88% rename from broadcastradio/1.1/default/BroadcastRadio.h rename to broadcastradio/1.2/default/BroadcastRadio.h index a96a2ab933..94d62b9bc4 100644 --- a/broadcastradio/1.1/default/BroadcastRadio.h +++ b/broadcastradio/1.2/default/BroadcastRadio.h @@ -13,18 +13,18 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#ifndef ANDROID_HARDWARE_BROADCASTRADIO_V1_1_BROADCASTRADIO_H -#define ANDROID_HARDWARE_BROADCASTRADIO_V1_1_BROADCASTRADIO_H +#ifndef ANDROID_HARDWARE_BROADCASTRADIO_V1_2_BROADCASTRADIO_H +#define ANDROID_HARDWARE_BROADCASTRADIO_V1_2_BROADCASTRADIO_H #include "Tuner.h" #include -#include +#include namespace android { namespace hardware { namespace broadcastradio { -namespace V1_1 { +namespace V1_2 { namespace implementation { struct AmFmBandConfig { @@ -73,9 +73,9 @@ struct BroadcastRadio : public V1_1::IBroadcastRadio { }; } // namespace implementation -} // namespace V1_1 +} // namespace V1_2 } // namespace broadcastradio } // namespace hardware } // namespace android -#endif // ANDROID_HARDWARE_BROADCASTRADIO_V1_1_BROADCASTRADIO_H +#endif // ANDROID_HARDWARE_BROADCASTRADIO_V1_2_BROADCASTRADIO_H diff --git a/broadcastradio/1.1/default/BroadcastRadioFactory.cpp b/broadcastradio/1.2/default/BroadcastRadioFactory.cpp similarity index 91% rename from broadcastradio/1.1/default/BroadcastRadioFactory.cpp rename to broadcastradio/1.2/default/BroadcastRadioFactory.cpp index f57bc79feb..8f17aff702 100644 --- a/broadcastradio/1.1/default/BroadcastRadioFactory.cpp +++ b/broadcastradio/1.2/default/BroadcastRadioFactory.cpp @@ -25,7 +25,7 @@ namespace android { namespace hardware { namespace broadcastradio { -namespace V1_1 { +namespace V1_2 { namespace implementation { using V1_0::Class; @@ -36,10 +36,6 @@ static const vector gAllClasses = { Class::AM_FM, Class::SAT, Class::DT, }; -IBroadcastRadioFactory* HIDL_FETCH_IBroadcastRadioFactory(const char* name __unused) { - return new BroadcastRadioFactory(); -} - BroadcastRadioFactory::BroadcastRadioFactory() { for (auto&& classId : gAllClasses) { if (!BroadcastRadio::isSupported(classId)) continue; @@ -61,7 +57,7 @@ Return BroadcastRadioFactory::connectModule(Class classId, connectModule_c } } // namespace implementation -} // namespace V1_1 +} // namespace V1_2 } // namespace broadcastradio } // namespace hardware } // namespace android diff --git a/broadcastradio/1.1/default/BroadcastRadioFactory.h b/broadcastradio/1.2/default/BroadcastRadioFactory.h similarity index 69% rename from broadcastradio/1.1/default/BroadcastRadioFactory.h rename to broadcastradio/1.2/default/BroadcastRadioFactory.h index 8b67ac3637..c365ae0b70 100644 --- a/broadcastradio/1.1/default/BroadcastRadioFactory.h +++ b/broadcastradio/1.2/default/BroadcastRadioFactory.h @@ -13,21 +13,19 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#ifndef ANDROID_HARDWARE_BROADCASTRADIO_V1_1_BROADCASTRADIOFACTORY_H -#define ANDROID_HARDWARE_BROADCASTRADIO_V1_1_BROADCASTRADIOFACTORY_H +#ifndef ANDROID_HARDWARE_BROADCASTRADIO_V1_2_BROADCASTRADIOFACTORY_H +#define ANDROID_HARDWARE_BROADCASTRADIO_V1_2_BROADCASTRADIOFACTORY_H #include -#include -#include +#include +#include namespace android { namespace hardware { namespace broadcastradio { -namespace V1_1 { +namespace V1_2 { namespace implementation { -extern "C" IBroadcastRadioFactory* HIDL_FETCH_IBroadcastRadioFactory(const char* name); - struct BroadcastRadioFactory : public IBroadcastRadioFactory { BroadcastRadioFactory(); @@ -35,13 +33,13 @@ struct BroadcastRadioFactory : public IBroadcastRadioFactory { Return connectModule(V1_0::Class classId, connectModule_cb _hidl_cb) override; private: - std::map> mRadioModules; + std::map> mRadioModules; }; } // namespace implementation -} // namespace V1_1 +} // namespace V1_2 } // namespace broadcastradio } // namespace hardware } // namespace android -#endif // ANDROID_HARDWARE_BROADCASTRADIO_V1_1_BROADCASTRADIOFACTORY_H +#endif // ANDROID_HARDWARE_BROADCASTRADIO_V1_2_BROADCASTRADIOFACTORY_H diff --git a/broadcastradio/1.1/utils/OWNERS b/broadcastradio/1.2/default/OWNERS similarity index 74% rename from broadcastradio/1.1/utils/OWNERS rename to broadcastradio/1.2/default/OWNERS index 0c27b71865..136b607b94 100644 --- a/broadcastradio/1.1/utils/OWNERS +++ b/broadcastradio/1.2/default/OWNERS @@ -1,4 +1,3 @@ # Automotive team egranata@google.com -keunyoung@google.com twasilczyk@google.com diff --git a/broadcastradio/1.1/default/Tuner.cpp b/broadcastradio/1.2/default/Tuner.cpp similarity index 94% rename from broadcastradio/1.1/default/Tuner.cpp rename to broadcastradio/1.2/default/Tuner.cpp index 9a34cb128c..f5fb6432d1 100644 --- a/broadcastradio/1.1/default/Tuner.cpp +++ b/broadcastradio/1.2/default/Tuner.cpp @@ -26,7 +26,7 @@ namespace android { namespace hardware { namespace broadcastradio { -namespace V1_1 { +namespace V1_2 { namespace implementation { using namespace std::chrono_literals; @@ -35,6 +35,13 @@ using V1_0::Band; using V1_0::BandConfig; using V1_0::Class; using V1_0::Direction; +using V1_1::IdentifierType; +using V1_1::ProgramInfo; +using V1_1::ProgramInfoFlags; +using V1_1::ProgramListResult; +using V1_1::ProgramSelector; +using V1_1::ProgramType; +using V1_1::VendorKeyValue; using utils::HalRevision; using std::chrono::milliseconds; @@ -54,7 +61,8 @@ const struct { Tuner::Tuner(V1_0::Class classId, const sp& callback) : mClassId(classId), mCallback(callback), - mCallback1_1(ITunerCallback::castFrom(callback).withDefault(nullptr)), + mCallback1_1(V1_1::ITunerCallback::castFrom(callback).withDefault(nullptr)), + mCallback1_2(V1_2::ITunerCallback::castFrom(callback).withDefault(nullptr)), mVirtualRadio(getRadio(classId)), mIsAnalogForced(false) {} @@ -122,7 +130,9 @@ static ProgramInfo makeDummyProgramInfo(const ProgramSelector& selector) { } HalRevision Tuner::getHalRev() const { - if (mCallback1_1 != nullptr) { + if (mCallback1_2 != nullptr) { + return HalRevision::V1_2; + } else if (mCallback1_1 != nullptr) { return HalRevision::V1_1; } else { return HalRevision::V1_0; @@ -310,9 +320,8 @@ Return Tuner::cancelAnnouncement() { Return Tuner::getProgramInformation(getProgramInformation_cb _hidl_cb) { ALOGV("%s", __func__); - return getProgramInformation_1_1([&](Result result, const ProgramInfo& info) { - _hidl_cb(result, info.base); - }); + return getProgramInformation_1_1( + [&](Result result, const ProgramInfo& info) { _hidl_cb(result, info.base); }); } Return Tuner::getProgramInformation_1_1(getProgramInformation_1_1_cb _hidl_cb) { @@ -374,7 +383,7 @@ Return Tuner::isAnalogForced(isAnalogForced_cb _hidl_cb) { } } // namespace implementation -} // namespace V1_1 +} // namespace V1_2 } // namespace broadcastradio } // namespace hardware } // namespace android diff --git a/broadcastradio/1.1/default/Tuner.h b/broadcastradio/1.2/default/Tuner.h similarity index 74% rename from broadcastradio/1.1/default/Tuner.h rename to broadcastradio/1.2/default/Tuner.h index 07d31898a7..3cf077bfba 100644 --- a/broadcastradio/1.1/default/Tuner.h +++ b/broadcastradio/1.2/default/Tuner.h @@ -13,19 +13,19 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#ifndef ANDROID_HARDWARE_BROADCASTRADIO_V1_1_TUNER_H -#define ANDROID_HARDWARE_BROADCASTRADIO_V1_1_TUNER_H +#ifndef ANDROID_HARDWARE_BROADCASTRADIO_V1_2_TUNER_H +#define ANDROID_HARDWARE_BROADCASTRADIO_V1_2_TUNER_H #include "VirtualRadio.h" -#include -#include +#include +#include #include namespace android { namespace hardware { namespace broadcastradio { -namespace V1_1 { +namespace V1_2 { namespace implementation { struct Tuner : public ITuner { @@ -33,19 +33,19 @@ struct Tuner : public ITuner { void forceClose(); - // V1_1::ITuner methods + // V1_2::ITuner methods virtual Return setConfiguration(const V1_0::BandConfig& config) override; virtual Return getConfiguration(getConfiguration_cb _hidl_cb) override; virtual Return scan(V1_0::Direction direction, bool skipSubChannel) override; virtual Return step(V1_0::Direction direction, bool skipSubChannel) override; virtual Return tune(uint32_t channel, uint32_t subChannel) override; - virtual Return tuneByProgramSelector(const ProgramSelector& program) override; + virtual Return tuneByProgramSelector(const V1_1::ProgramSelector& program) override; virtual Return cancel() override; virtual Return cancelAnnouncement() override; virtual Return getProgramInformation(getProgramInformation_cb _hidl_cb) override; virtual Return getProgramInformation_1_1(getProgramInformation_1_1_cb _hidl_cb) override; - virtual Return startBackgroundScan() override; - virtual Return getProgramList(const hidl_vec& filter, + virtual Return startBackgroundScan() override; + virtual Return getProgramList(const hidl_vec& filter, getProgramList_cb _hidl_cb) override; virtual Return setAnalogForced(bool isForced) override; virtual Return isAnalogForced(isAnalogForced_cb _hidl_cb) override; @@ -58,23 +58,24 @@ struct Tuner : public ITuner { V1_0::Class mClassId; const sp mCallback; const sp mCallback1_1; + const sp mCallback1_2; std::reference_wrapper mVirtualRadio; bool mIsAmfmConfigSet = false; V1_0::BandConfig mAmfmConfig; bool mIsTuneCompleted = false; - ProgramSelector mCurrentProgram = {}; - ProgramInfo mCurrentProgramInfo = {}; + V1_1::ProgramSelector mCurrentProgram = {}; + V1_1::ProgramInfo mCurrentProgramInfo = {}; std::atomic mIsAnalogForced; utils::HalRevision getHalRev() const; - void tuneInternalLocked(const ProgramSelector& sel); + void tuneInternalLocked(const V1_1::ProgramSelector& sel); }; } // namespace implementation -} // namespace V1_1 +} // namespace V1_2 } // namespace broadcastradio } // namespace hardware } // namespace android -#endif // ANDROID_HARDWARE_BROADCASTRADIO_V1_1_TUNER_H +#endif // ANDROID_HARDWARE_BROADCASTRADIO_V1_2_TUNER_H diff --git a/broadcastradio/1.1/default/VirtualProgram.cpp b/broadcastradio/1.2/default/VirtualProgram.cpp similarity index 96% rename from broadcastradio/1.1/default/VirtualProgram.cpp rename to broadcastradio/1.2/default/VirtualProgram.cpp index 7977391cdd..95879e34df 100644 --- a/broadcastradio/1.1/default/VirtualProgram.cpp +++ b/broadcastradio/1.2/default/VirtualProgram.cpp @@ -22,7 +22,7 @@ namespace android { namespace hardware { namespace broadcastradio { -namespace V1_1 { +namespace V1_2 { namespace implementation { using std::vector; @@ -30,6 +30,9 @@ using std::vector; using V1_0::MetaData; using V1_0::MetadataKey; using V1_0::MetadataType; +using V1_1::IdentifierType; +using V1_1::ProgramInfo; +using V1_1::VendorKeyValue; using utils::HalRevision; static MetaData createDemoBitmap(MetadataKey key, HalRevision halRev) { @@ -100,7 +103,7 @@ vector getProgramInfoVector(const vector& vec, HalR } } // namespace implementation -} // namespace V1_1 +} // namespace V1_2 } // namespace broadcastradio } // namespace hardware } // namespace android diff --git a/broadcastradio/1.1/default/VirtualProgram.h b/broadcastradio/1.2/default/VirtualProgram.h similarity index 68% rename from broadcastradio/1.1/default/VirtualProgram.h rename to broadcastradio/1.2/default/VirtualProgram.h index a14830d77a..5342c848a3 100644 --- a/broadcastradio/1.1/default/VirtualProgram.h +++ b/broadcastradio/1.2/default/VirtualProgram.h @@ -13,16 +13,16 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#ifndef ANDROID_HARDWARE_BROADCASTRADIO_V1_1_VIRTUALPROGRAM_H -#define ANDROID_HARDWARE_BROADCASTRADIO_V1_1_VIRTUALPROGRAM_H +#ifndef ANDROID_HARDWARE_BROADCASTRADIO_V1_2_VIRTUALPROGRAM_H +#define ANDROID_HARDWARE_BROADCASTRADIO_V1_2_VIRTUALPROGRAM_H -#include +#include #include namespace android { namespace hardware { namespace broadcastradio { -namespace V1_1 { +namespace V1_2 { namespace implementation { /** @@ -32,24 +32,24 @@ namespace implementation { * not an entry for a captured station in the radio tuner memory. */ struct VirtualProgram { - ProgramSelector selector; + V1_1::ProgramSelector selector; std::string programName = ""; std::string songArtist = ""; std::string songTitle = ""; - ProgramInfo getProgramInfo(utils::HalRevision halRev) const; + V1_1::ProgramInfo getProgramInfo(utils::HalRevision halRev) const; friend bool operator<(const VirtualProgram& lhs, const VirtualProgram& rhs); }; -std::vector getProgramInfoVector(const std::vector& vec, - utils::HalRevision halRev); +std::vector getProgramInfoVector(const std::vector& vec, + utils::HalRevision halRev); } // namespace implementation -} // namespace V1_1 +} // namespace V1_2 } // namespace broadcastradio } // namespace hardware } // namespace android -#endif // ANDROID_HARDWARE_BROADCASTRADIO_V1_1_VIRTUALPROGRAM_H +#endif // ANDROID_HARDWARE_BROADCASTRADIO_V1_2_VIRTUALPROGRAM_H diff --git a/broadcastradio/1.1/default/VirtualRadio.cpp b/broadcastradio/1.2/default/VirtualRadio.cpp similarity index 97% rename from broadcastradio/1.1/default/VirtualRadio.cpp rename to broadcastradio/1.2/default/VirtualRadio.cpp index 36d47a92e7..867726d2fc 100644 --- a/broadcastradio/1.1/default/VirtualRadio.cpp +++ b/broadcastradio/1.2/default/VirtualRadio.cpp @@ -24,11 +24,12 @@ namespace android { namespace hardware { namespace broadcastradio { -namespace V1_1 { +namespace V1_2 { namespace implementation { using V1_0::Band; using V1_0::Class; +using V1_1::ProgramSelector; using std::lock_guard; using std::move; @@ -99,7 +100,7 @@ VirtualRadio& getDigitalRadio() { } } // namespace implementation -} // namespace V1_1 +} // namespace V1_2 } // namespace broadcastradio } // namespace hardware } // namespace android diff --git a/broadcastradio/1.1/default/VirtualRadio.h b/broadcastradio/1.2/default/VirtualRadio.h similarity index 87% rename from broadcastradio/1.1/default/VirtualRadio.h rename to broadcastradio/1.2/default/VirtualRadio.h index 3c7ae5c193..8cfaefeb42 100644 --- a/broadcastradio/1.1/default/VirtualRadio.h +++ b/broadcastradio/1.2/default/VirtualRadio.h @@ -13,8 +13,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#ifndef ANDROID_HARDWARE_BROADCASTRADIO_V1_1_VIRTUALRADIO_H -#define ANDROID_HARDWARE_BROADCASTRADIO_V1_1_VIRTUALRADIO_H +#ifndef ANDROID_HARDWARE_BROADCASTRADIO_V1_2_VIRTUALRADIO_H +#define ANDROID_HARDWARE_BROADCASTRADIO_V1_2_VIRTUALRADIO_H #include "VirtualProgram.h" @@ -24,7 +24,7 @@ namespace android { namespace hardware { namespace broadcastradio { -namespace V1_1 { +namespace V1_2 { namespace implementation { /** @@ -40,7 +40,7 @@ class VirtualRadio { VirtualRadio(const std::vector initialList); std::vector getProgramList(); - bool getProgram(const ProgramSelector& selector, VirtualProgram& program); + bool getProgram(const V1_1::ProgramSelector& selector, VirtualProgram& program); private: std::mutex mMut; @@ -72,9 +72,9 @@ VirtualRadio& getSatRadio(); VirtualRadio& getDigitalRadio(); } // namespace implementation -} // namespace V1_1 +} // namespace V1_2 } // namespace broadcastradio } // namespace hardware } // namespace android -#endif // ANDROID_HARDWARE_BROADCASTRADIO_V1_1_VIRTUALRADIO_H +#endif // ANDROID_HARDWARE_BROADCASTRADIO_V1_2_VIRTUALRADIO_H diff --git a/broadcastradio/1.1/default/android.hardware.broadcastradio@1.1-service.rc b/broadcastradio/1.2/default/android.hardware.broadcastradio@1.2-service.rc similarity index 83% rename from broadcastradio/1.1/default/android.hardware.broadcastradio@1.1-service.rc rename to broadcastradio/1.2/default/android.hardware.broadcastradio@1.2-service.rc index 7c57135fc2..3741f21aa2 100644 --- a/broadcastradio/1.1/default/android.hardware.broadcastradio@1.1-service.rc +++ b/broadcastradio/1.2/default/android.hardware.broadcastradio@1.2-service.rc @@ -1,4 +1,4 @@ -service broadcastradio-hal /vendor/bin/hw/android.hardware.broadcastradio@1.1-service +service broadcastradio-hal /vendor/bin/hw/android.hardware.broadcastradio@1.2-service class hal user audioserver group audio diff --git a/broadcastradio/1.1/default/resources.h b/broadcastradio/1.2/default/resources.h similarity index 89% rename from broadcastradio/1.1/default/resources.h rename to broadcastradio/1.2/default/resources.h index b7e709f955..b383c278e0 100644 --- a/broadcastradio/1.1/default/resources.h +++ b/broadcastradio/1.2/default/resources.h @@ -13,13 +13,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#ifndef ANDROID_HARDWARE_BROADCASTRADIO_V1_1_RESOURCES_H -#define ANDROID_HARDWARE_BROADCASTRADIO_V1_1_RESOURCES_H +#ifndef ANDROID_HARDWARE_BROADCASTRADIO_V1_2_RESOURCES_H +#define ANDROID_HARDWARE_BROADCASTRADIO_V1_2_RESOURCES_H namespace android { namespace hardware { namespace broadcastradio { -namespace V1_1 { +namespace V1_2 { namespace implementation { namespace resources { @@ -38,9 +38,9 @@ constexpr uint8_t demoPng[] = { } // namespace resources } // namespace implementation -} // namespace V1_1 +} // namespace V1_2 } // namespace broadcastradio } // namespace hardware } // namespace android -#endif // ANDROID_HARDWARE_BROADCASTRADIO_V1_1_RESOURCES_H +#endif // ANDROID_HARDWARE_BROADCASTRADIO_V1_2_RESOURCES_H diff --git a/broadcastradio/1.1/default/service.cpp b/broadcastradio/1.2/default/service.cpp similarity index 95% rename from broadcastradio/1.1/default/service.cpp rename to broadcastradio/1.2/default/service.cpp index f8af0b78cb..ea86fbaf33 100644 --- a/broadcastradio/1.1/default/service.cpp +++ b/broadcastradio/1.2/default/service.cpp @@ -22,7 +22,7 @@ using android::hardware::configureRpcThreadpool; using android::hardware::joinRpcThreadpool; -using android::hardware::broadcastradio::V1_1::implementation::BroadcastRadioFactory; +using android::hardware::broadcastradio::V1_2::implementation::BroadcastRadioFactory; int main(int /* argc */, char** /* argv */) { configureRpcThreadpool(4, true); diff --git a/broadcastradio/1.2/types.hal b/broadcastradio/1.2/types.hal new file mode 100644 index 0000000000..5edb097aaf --- /dev/null +++ b/broadcastradio/1.2/types.hal @@ -0,0 +1,23 @@ +/** + * Copyright 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.2; + +import @1.1::Result; +import @1.1::VendorKeyValue; + +typedef @1.1::Result Result; +typedef @1.1::VendorKeyValue VendorKeyValue; diff --git a/broadcastradio/Android.bp b/broadcastradio/Android.bp index 8c65bf6013..224dd6391f 100644 --- a/broadcastradio/Android.bp +++ b/broadcastradio/Android.bp @@ -4,9 +4,10 @@ subdirs = [ "1.0/default", "1.0/vts/functional", "1.1", - "1.1/default", - "1.1/tests", - "1.1/utils", "1.1/vts/functional", - "1.1/vts/utils", + "1.2", + "1.2/default", + "common/tests", + "common/utils", + "common/vts/utils", ] diff --git a/broadcastradio/1.1/tests/Android.bp b/broadcastradio/common/tests/Android.bp similarity index 85% rename from broadcastradio/1.1/tests/Android.bp rename to broadcastradio/common/tests/Android.bp index fa1fd94409..44566028de 100644 --- a/broadcastradio/1.1/tests/Android.bp +++ b/broadcastradio/common/tests/Android.bp @@ -15,7 +15,7 @@ // cc_test { - name: "android.hardware.broadcastradio@1.1-utils-tests", + name: "android.hardware.broadcastradio@common-utils-tests", vendor: true, cflags: [ "-Wall", @@ -25,5 +25,5 @@ cc_test { srcs: [ "WorkerThread_test.cpp", ], - static_libs: ["android.hardware.broadcastradio@1.1-utils-lib"], -} + static_libs: ["android.hardware.broadcastradio@common-utils-lib"], +} \ No newline at end of file diff --git a/broadcastradio/1.1/tests/OWNERS b/broadcastradio/common/tests/OWNERS similarity index 84% rename from broadcastradio/1.1/tests/OWNERS rename to broadcastradio/common/tests/OWNERS index aa5ce82e16..21e1cd66af 100644 --- a/broadcastradio/1.1/tests/OWNERS +++ b/broadcastradio/common/tests/OWNERS @@ -1,6 +1,5 @@ # Automotive team egranata@google.com -keunyoung@google.com twasilczyk@google.com # VTS team diff --git a/broadcastradio/1.1/tests/WorkerThread_test.cpp b/broadcastradio/common/tests/WorkerThread_test.cpp similarity index 100% rename from broadcastradio/1.1/tests/WorkerThread_test.cpp rename to broadcastradio/common/tests/WorkerThread_test.cpp diff --git a/broadcastradio/1.1/utils/Android.bp b/broadcastradio/common/utils/Android.bp similarity index 93% rename from broadcastradio/1.1/utils/Android.bp rename to broadcastradio/common/utils/Android.bp index e80d133dca..d8bd12556c 100644 --- a/broadcastradio/1.1/utils/Android.bp +++ b/broadcastradio/common/utils/Android.bp @@ -15,7 +15,7 @@ // cc_library_static { - name: "android.hardware.broadcastradio@1.1-utils-lib", + name: "android.hardware.broadcastradio@common-utils-lib", vendor_available: true, relative_install_path: "hw", cflags: [ diff --git a/broadcastradio/1.1/default/OWNERS b/broadcastradio/common/utils/OWNERS similarity index 74% rename from broadcastradio/1.1/default/OWNERS rename to broadcastradio/common/utils/OWNERS index 0c27b71865..136b607b94 100644 --- a/broadcastradio/1.1/default/OWNERS +++ b/broadcastradio/common/utils/OWNERS @@ -1,4 +1,3 @@ # Automotive team egranata@google.com -keunyoung@google.com twasilczyk@google.com diff --git a/broadcastradio/1.1/utils/Utils.cpp b/broadcastradio/common/utils/Utils.cpp similarity index 97% rename from broadcastradio/1.1/utils/Utils.cpp rename to broadcastradio/common/utils/Utils.cpp index 4dd6b139c4..bdaf8e8cf2 100644 --- a/broadcastradio/1.1/utils/Utils.cpp +++ b/broadcastradio/common/utils/Utils.cpp @@ -23,10 +23,13 @@ namespace android { namespace hardware { namespace broadcastradio { -namespace V1_1 { namespace utils { using V1_0::Band; +using V1_1::IdentifierType; +using V1_1::ProgramIdentifier; +using V1_1::ProgramSelector; +using V1_1::ProgramType; static bool isCompatibleProgramType(const uint32_t ia, const uint32_t ib) { auto a = static_cast(ia); @@ -208,7 +211,6 @@ bool isDigital(const ProgramSelector& sel) { } } // namespace utils -} // namespace V1_1 namespace V1_0 { @@ -218,9 +220,9 @@ bool operator==(const BandConfig& l, const BandConfig& r) { if (l.lowerLimit != r.lowerLimit) return false; if (l.upperLimit != r.upperLimit) return false; if (l.spacings != r.spacings) return false; - if (V1_1::utils::isAm(l.type)) { + if (utils::isAm(l.type)) { return l.ext.am == r.ext.am; - } else if (V1_1::utils::isFm(l.type)) { + } else if (utils::isFm(l.type)) { return l.ext.fm == r.ext.fm; } else { ALOGW("Unsupported band config type: %s", toString(l.type).c_str()); diff --git a/broadcastradio/1.1/utils/WorkerThread.cpp b/broadcastradio/common/utils/WorkerThread.cpp similarity index 100% rename from broadcastradio/1.1/utils/WorkerThread.cpp rename to broadcastradio/common/utils/WorkerThread.cpp diff --git a/broadcastradio/1.1/utils/include/broadcastradio-utils/Utils.h b/broadcastradio/common/utils/include/broadcastradio-utils/Utils.h similarity index 66% rename from broadcastradio/1.1/utils/include/broadcastradio-utils/Utils.h rename to broadcastradio/common/utils/include/broadcastradio-utils/Utils.h index 24c60ee460..b07ce79be2 100644 --- a/broadcastradio/1.1/utils/include/broadcastradio-utils/Utils.h +++ b/broadcastradio/common/utils/include/broadcastradio-utils/Utils.h @@ -13,8 +13,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#ifndef ANDROID_HARDWARE_BROADCASTRADIO_V1_1_UTILS_H -#define ANDROID_HARDWARE_BROADCASTRADIO_V1_1_UTILS_H +#ifndef ANDROID_HARDWARE_BROADCASTRADIO_COMMON_UTILS_H +#define ANDROID_HARDWARE_BROADCASTRADIO_COMMON_UTILS_H #include #include @@ -24,13 +24,12 @@ namespace android { namespace hardware { namespace broadcastradio { -namespace V1_1 { namespace utils { -// TODO(b/64115813): move it out from frameworks/base/services/core/jni/BroadcastRadio/types.h enum class HalRevision : uint32_t { V1_0 = 1, V1_1, + V1_2, }; /** @@ -43,38 +42,38 @@ enum class HalRevision : uint32_t { * @param pointer selector we're trying to match against channel. * @param channel existing channel. */ -bool tunesTo(const ProgramSelector& pointer, const ProgramSelector& channel); +bool tunesTo(const V1_1::ProgramSelector& pointer, const V1_1::ProgramSelector& channel); -ProgramType getType(const ProgramSelector& sel); -bool isAmFm(const ProgramType type); +V1_1::ProgramType getType(const V1_1::ProgramSelector& sel); +bool isAmFm(const V1_1::ProgramType type); bool isAm(const V1_0::Band band); bool isFm(const V1_0::Band band); -bool hasId(const ProgramSelector& sel, const IdentifierType type); +bool hasId(const V1_1::ProgramSelector& sel, const V1_1::IdentifierType type); /** * Returns ID (either primary or secondary) for a given program selector. * * If the selector does not contain given type, returns 0 and emits a warning. */ -uint64_t getId(const ProgramSelector& sel, const IdentifierType type); +uint64_t getId(const V1_1::ProgramSelector& sel, const V1_1::IdentifierType type); /** * Returns ID (either primary or secondary) for a given program selector. * * If the selector does not contain given type, returns default value. */ -uint64_t getId(const ProgramSelector& sel, const IdentifierType type, uint64_t defval); +uint64_t getId(const V1_1::ProgramSelector& sel, const V1_1::IdentifierType type, uint64_t defval); -ProgramSelector make_selector(V1_0::Band band, uint32_t channel, uint32_t subChannel = 0); +V1_1::ProgramSelector make_selector(V1_0::Band band, uint32_t channel, uint32_t subChannel = 0); -bool getLegacyChannel(const ProgramSelector& sel, uint32_t* channelOut, uint32_t* subChannelOut); +bool getLegacyChannel(const V1_1::ProgramSelector& sel, + uint32_t* channelOut, uint32_t* subChannelOut); -bool isDigital(const ProgramSelector& sel); +bool isDigital(const V1_1::ProgramSelector& sel); } // namespace utils -} // namespace V1_1 namespace V1_0 { @@ -86,4 +85,4 @@ bool operator==(const BandConfig& l, const BandConfig& r); } // namespace hardware } // namespace android -#endif // ANDROID_HARDWARE_BROADCASTRADIO_V1_1_UTILS_H +#endif // ANDROID_HARDWARE_BROADCASTRADIO_COMMON_UTILS_H diff --git a/broadcastradio/1.1/utils/include/broadcastradio-utils/WorkerThread.h b/broadcastradio/common/utils/include/broadcastradio-utils/WorkerThread.h similarity index 87% rename from broadcastradio/1.1/utils/include/broadcastradio-utils/WorkerThread.h rename to broadcastradio/common/utils/include/broadcastradio-utils/WorkerThread.h index 635876fbcb..62bede6ca0 100644 --- a/broadcastradio/1.1/utils/include/broadcastradio-utils/WorkerThread.h +++ b/broadcastradio/common/utils/include/broadcastradio-utils/WorkerThread.h @@ -13,8 +13,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#ifndef ANDROID_HARDWARE_BROADCASTRADIO_V1_1_WORKERTHREAD_H -#define ANDROID_HARDWARE_BROADCASTRADIO_V1_1_WORKERTHREAD_H +#ifndef ANDROID_HARDWARE_BROADCASTRADIO_COMMON_WORKERTHREAD_H +#define ANDROID_HARDWARE_BROADCASTRADIO_COMMON_WORKERTHREAD_H #include #include @@ -48,4 +48,4 @@ class WorkerThread { } // namespace android -#endif // ANDROID_HARDWARE_BROADCASTRADIO_V1_1_WORKERTHREAD_H +#endif // ANDROID_HARDWARE_BROADCASTRADIO_COMMON_WORKERTHREAD_H diff --git a/broadcastradio/1.1/vts/utils/Android.bp b/broadcastradio/common/vts/utils/Android.bp similarity index 92% rename from broadcastradio/1.1/vts/utils/Android.bp rename to broadcastradio/common/vts/utils/Android.bp index 0c7e2a4433..4ba8a17089 100644 --- a/broadcastradio/1.1/vts/utils/Android.bp +++ b/broadcastradio/common/vts/utils/Android.bp @@ -15,7 +15,7 @@ // cc_library_static { - name: "android.hardware.broadcastradio@1.1-vts-utils-lib", + name: "android.hardware.broadcastradio@vts-utils-lib", srcs: [ "call-barrier.cpp", ], diff --git a/broadcastradio/common/vts/utils/OWNERS b/broadcastradio/common/vts/utils/OWNERS new file mode 100644 index 0000000000..21e1cd66af --- /dev/null +++ b/broadcastradio/common/vts/utils/OWNERS @@ -0,0 +1,7 @@ +# Automotive team +egranata@google.com +twasilczyk@google.com + +# VTS team +ryanjcampbell@google.com +yim@google.com diff --git a/broadcastradio/1.1/vts/utils/call-barrier.cpp b/broadcastradio/common/vts/utils/call-barrier.cpp similarity index 100% rename from broadcastradio/1.1/vts/utils/call-barrier.cpp rename to broadcastradio/common/vts/utils/call-barrier.cpp diff --git a/broadcastradio/1.1/vts/utils/include/broadcastradio-vts-utils/call-barrier.h b/broadcastradio/common/vts/utils/include/broadcastradio-vts-utils/call-barrier.h similarity index 100% rename from broadcastradio/1.1/vts/utils/include/broadcastradio-vts-utils/call-barrier.h rename to broadcastradio/common/vts/utils/include/broadcastradio-vts-utils/call-barrier.h diff --git a/broadcastradio/1.1/vts/utils/include/broadcastradio-vts-utils/mock-timeout.h b/broadcastradio/common/vts/utils/include/broadcastradio-vts-utils/mock-timeout.h similarity index 100% rename from broadcastradio/1.1/vts/utils/include/broadcastradio-vts-utils/mock-timeout.h rename to broadcastradio/common/vts/utils/include/broadcastradio-vts-utils/mock-timeout.h