diff options
author | Tomasz Wasilczyk <twasilczyk@google.com> | 2018-02-08 13:42:31 -0800 |
---|---|---|
committer | Tomasz Wasilczyk <twasilczyk@google.com> | 2018-02-09 19:43:45 +0000 |
commit | 8c34c8179d4b745338e6200b337488ef9ad4b7ed (patch) | |
tree | 297721f53fbdabdef2f0d79b231c20ad52670f11 | |
parent | e3d0fd346bbddd9f0423fb52fce70bd11e3535f9 (diff) | |
download | platform_hardware_interfaces-8c34c8179d4b745338e6200b337488ef9ad4b7ed.tar.gz platform_hardware_interfaces-8c34c8179d4b745338e6200b337488ef9ad4b7ed.tar.bz2 platform_hardware_interfaces-8c34c8179d4b745338e6200b337488ef9ad4b7ed.zip |
Move broadcast radio 1.2 default implementation back to 1.1.
Bug: 62945293
Test: VTS
Change-Id: I95d68ea61f5b50c5b510212b0941bddad1158f97
-rw-r--r-- | broadcastradio/1.1/default/Android.bp (renamed from broadcastradio/1.2/default/Android.bp) | 5 | ||||
-rw-r--r-- | broadcastradio/1.1/default/BroadcastRadio.cpp (renamed from broadcastradio/1.2/default/BroadcastRadio.cpp) | 4 | ||||
-rw-r--r-- | broadcastradio/1.1/default/BroadcastRadio.h (renamed from broadcastradio/1.2/default/BroadcastRadio.h) | 16 | ||||
-rw-r--r-- | broadcastradio/1.1/default/BroadcastRadioFactory.cpp (renamed from broadcastradio/1.2/default/BroadcastRadioFactory.cpp) | 4 | ||||
-rw-r--r-- | broadcastradio/1.1/default/BroadcastRadioFactory.h (renamed from broadcastradio/1.2/default/BroadcastRadioFactory.h) | 14 | ||||
-rw-r--r-- | broadcastradio/1.1/default/OWNERS (renamed from broadcastradio/1.2/default/OWNERS) | 0 | ||||
-rw-r--r-- | broadcastradio/1.1/default/Tuner.cpp (renamed from broadcastradio/1.2/default/Tuner.cpp) | 31 | ||||
-rw-r--r-- | broadcastradio/1.1/default/Tuner.h (renamed from broadcastradio/1.2/default/Tuner.h) | 21 | ||||
-rw-r--r-- | broadcastradio/1.1/default/VirtualProgram.cpp (renamed from broadcastradio/1.2/default/VirtualProgram.cpp) | 6 | ||||
-rw-r--r-- | broadcastradio/1.1/default/VirtualProgram.h (renamed from broadcastradio/1.2/default/VirtualProgram.h) | 12 | ||||
-rw-r--r-- | broadcastradio/1.1/default/VirtualRadio.cpp (renamed from broadcastradio/1.2/default/VirtualRadio.cpp) | 4 | ||||
-rw-r--r-- | broadcastradio/1.1/default/VirtualRadio.h (renamed from broadcastradio/1.2/default/VirtualRadio.h) | 10 | ||||
-rw-r--r-- | broadcastradio/1.1/default/android.hardware.broadcastradio@1.1-service.rc (renamed from broadcastradio/1.2/default/android.hardware.broadcastradio@1.2-service.rc) | 2 | ||||
-rw-r--r-- | broadcastradio/1.1/default/resources.h (renamed from broadcastradio/1.2/default/resources.h) | 10 | ||||
-rw-r--r-- | broadcastradio/1.1/default/service.cpp (renamed from broadcastradio/1.2/default/service.cpp) | 2 | ||||
-rw-r--r-- | broadcastradio/1.2/vts/OWNERS | 7 | ||||
-rw-r--r-- | broadcastradio/1.2/vts/functional/Android.bp | 28 | ||||
-rw-r--r-- | broadcastradio/1.2/vts/functional/VtsHalBroadcastradioV1_2TargetTest.cpp | 293 | ||||
-rw-r--r-- | broadcastradio/common/tests/Android.bp | 2 | ||||
-rw-r--r-- | broadcastradio/common/utils1x/Android.bp | 2 | ||||
-rw-r--r-- | broadcastradio/common/utils1x/Utils.cpp | 22 | ||||
-rw-r--r-- | broadcastradio/common/utils1x/include/broadcastradio-utils-1x/Utils.h | 10 |
22 files changed, 69 insertions, 436 deletions
diff --git a/broadcastradio/1.2/default/Android.bp b/broadcastradio/1.1/default/Android.bp index bd4be774f8..52fb45b497 100644 --- a/broadcastradio/1.2/default/Android.bp +++ b/broadcastradio/1.1/default/Android.bp @@ -15,8 +15,8 @@ // cc_binary { - name: "android.hardware.broadcastradio@1.2-service", - init_rc: ["android.hardware.broadcastradio@1.2-service.rc"], + name: "android.hardware.broadcastradio@1.1-service", + init_rc: ["android.hardware.broadcastradio@1.1-service.rc"], vendor: true, relative_install_path: "hw", cflags: [ @@ -39,7 +39,6 @@ cc_binary { 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.2/default/BroadcastRadio.cpp b/broadcastradio/1.1/default/BroadcastRadio.cpp index 74f65894e5..2933aa7dd5 100644 --- a/broadcastradio/1.2/default/BroadcastRadio.cpp +++ b/broadcastradio/1.1/default/BroadcastRadio.cpp @@ -25,7 +25,7 @@ namespace android { namespace hardware { namespace broadcastradio { -namespace V1_2 { +namespace V1_1 { namespace implementation { using V1_0::Band; @@ -190,7 +190,7 @@ Return<void> BroadcastRadio::getImage(int32_t id, getImage_cb _hidl_cb) { } } // namespace implementation -} // namespace V1_2 +} // namespace V1_1 } // namespace broadcastradio } // namespace hardware } // namespace android diff --git a/broadcastradio/1.2/default/BroadcastRadio.h b/broadcastradio/1.1/default/BroadcastRadio.h index 94d62b9bc4..bdf3b87458 100644 --- a/broadcastradio/1.2/default/BroadcastRadio.h +++ b/broadcastradio/1.1/default/BroadcastRadio.h @@ -13,24 +13,24 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#ifndef ANDROID_HARDWARE_BROADCASTRADIO_V1_2_BROADCASTRADIO_H -#define ANDROID_HARDWARE_BROADCASTRADIO_V1_2_BROADCASTRADIO_H +#ifndef ANDROID_HARDWARE_BROADCASTRADIO_V1_1_BROADCASTRADIO_H +#define ANDROID_HARDWARE_BROADCASTRADIO_V1_1_BROADCASTRADIO_H #include "Tuner.h" #include <android/hardware/broadcastradio/1.1/IBroadcastRadio.h> -#include <android/hardware/broadcastradio/1.2/types.h> +#include <android/hardware/broadcastradio/1.1/types.h> namespace android { namespace hardware { namespace broadcastradio { -namespace V1_2 { +namespace V1_1 { namespace implementation { struct AmFmBandConfig { V1_0::Band type; - uint32_t lowerLimit; // kHz - uint32_t upperLimit; // kHz + uint32_t lowerLimit; // kHz + uint32_t upperLimit; // kHz std::vector<uint32_t> spacings; // kHz }; @@ -73,9 +73,9 @@ struct BroadcastRadio : public V1_1::IBroadcastRadio { }; } // namespace implementation -} // namespace V1_2 +} // namespace V1_1 } // namespace broadcastradio } // namespace hardware } // namespace android -#endif // ANDROID_HARDWARE_BROADCASTRADIO_V1_2_BROADCASTRADIO_H +#endif // ANDROID_HARDWARE_BROADCASTRADIO_V1_1_BROADCASTRADIO_H diff --git a/broadcastradio/1.2/default/BroadcastRadioFactory.cpp b/broadcastradio/1.1/default/BroadcastRadioFactory.cpp index 8f17aff702..aecc96745d 100644 --- a/broadcastradio/1.2/default/BroadcastRadioFactory.cpp +++ b/broadcastradio/1.1/default/BroadcastRadioFactory.cpp @@ -25,7 +25,7 @@ namespace android { namespace hardware { namespace broadcastradio { -namespace V1_2 { +namespace V1_1 { namespace implementation { using V1_0::Class; @@ -57,7 +57,7 @@ Return<void> BroadcastRadioFactory::connectModule(Class classId, connectModule_c } } // namespace implementation -} // namespace V1_2 +} // namespace V1_1 } // namespace broadcastradio } // namespace hardware } // namespace android diff --git a/broadcastradio/1.2/default/BroadcastRadioFactory.h b/broadcastradio/1.1/default/BroadcastRadioFactory.h index c365ae0b70..62b65bc8ed 100644 --- a/broadcastradio/1.2/default/BroadcastRadioFactory.h +++ b/broadcastradio/1.1/default/BroadcastRadioFactory.h @@ -13,17 +13,17 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#ifndef ANDROID_HARDWARE_BROADCASTRADIO_V1_2_BROADCASTRADIOFACTORY_H -#define ANDROID_HARDWARE_BROADCASTRADIO_V1_2_BROADCASTRADIOFACTORY_H +#ifndef ANDROID_HARDWARE_BROADCASTRADIO_V1_1_BROADCASTRADIOFACTORY_H +#define ANDROID_HARDWARE_BROADCASTRADIO_V1_1_BROADCASTRADIOFACTORY_H #include <android/hardware/broadcastradio/1.1/IBroadcastRadio.h> -#include <android/hardware/broadcastradio/1.2/IBroadcastRadioFactory.h> -#include <android/hardware/broadcastradio/1.2/types.h> +#include <android/hardware/broadcastradio/1.1/IBroadcastRadioFactory.h> +#include <android/hardware/broadcastradio/1.1/types.h> namespace android { namespace hardware { namespace broadcastradio { -namespace V1_2 { +namespace V1_1 { namespace implementation { struct BroadcastRadioFactory : public IBroadcastRadioFactory { @@ -37,9 +37,9 @@ struct BroadcastRadioFactory : public IBroadcastRadioFactory { }; } // namespace implementation -} // namespace V1_2 +} // namespace V1_1 } // namespace broadcastradio } // namespace hardware } // namespace android -#endif // ANDROID_HARDWARE_BROADCASTRADIO_V1_2_BROADCASTRADIOFACTORY_H +#endif // ANDROID_HARDWARE_BROADCASTRADIO_V1_1_BROADCASTRADIOFACTORY_H diff --git a/broadcastradio/1.2/default/OWNERS b/broadcastradio/1.1/default/OWNERS index 136b607b94..136b607b94 100644 --- a/broadcastradio/1.2/default/OWNERS +++ b/broadcastradio/1.1/default/OWNERS diff --git a/broadcastradio/1.2/default/Tuner.cpp b/broadcastradio/1.1/default/Tuner.cpp index e95a13255e..2be070d965 100644 --- a/broadcastradio/1.2/default/Tuner.cpp +++ b/broadcastradio/1.1/default/Tuner.cpp @@ -17,8 +17,8 @@ #define LOG_TAG "BroadcastRadioDefault.tuner" #define LOG_NDEBUG 0 -#include "BroadcastRadio.h" #include "Tuner.h" +#include "BroadcastRadio.h" #include <broadcastradio-utils-1x/Utils.h> #include <log/log.h> @@ -26,7 +26,7 @@ namespace android { namespace hardware { namespace broadcastradio { -namespace V1_2 { +namespace V1_1 { namespace implementation { using namespace std::chrono_literals; @@ -35,13 +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 V1_2::IdentifierType; using utils::HalRevision; using std::chrono::milliseconds; @@ -62,7 +62,6 @@ Tuner::Tuner(V1_0::Class classId, const sp<V1_0::ITunerCallback>& callback) : mClassId(classId), mCallback(callback), mCallback1_1(V1_1::ITunerCallback::castFrom(callback).withDefault(nullptr)), - mCallback1_2(V1_2::ITunerCallback::castFrom(callback).withDefault(nullptr)), mVirtualRadio(getRadio(classId)), mIsAnalogForced(false) {} @@ -130,9 +129,7 @@ static ProgramInfo makeDummyProgramInfo(const ProgramSelector& selector) { } HalRevision Tuner::getHalRev() const { - if (mCallback1_2 != nullptr) { - return HalRevision::V1_2; - } else if (mCallback1_1 != nullptr) { + if (mCallback1_1 != nullptr) { return HalRevision::V1_1; } else { return HalRevision::V1_0; @@ -282,7 +279,7 @@ Return<Result> Tuner::tuneByProgramSelector(const ProgramSelector& sel) { return Result::INVALID_ARGUMENTS; } } else if (programType == ProgramType::DAB) { - if (!utils::hasId(sel, IdentifierType::DAB_SID_EXT)) return Result::INVALID_ARGUMENTS; + if (!utils::hasId(sel, IdentifierType::DAB_SIDECC)) return Result::INVALID_ARGUMENTS; } else if (programType == ProgramType::DRMO) { if (!utils::hasId(sel, IdentifierType::DRMO_SERVICE_ID)) return Result::INVALID_ARGUMENTS; } else if (programType == ProgramType::SXM) { @@ -386,24 +383,8 @@ Return<void> Tuner::isAnalogForced(isAnalogForced_cb _hidl_cb) { return {}; } -Return<void> Tuner::setParameters(const hidl_vec<VendorKeyValue>& /* parameters */, - setParameters_cb _hidl_cb) { - ALOGV("%s", __func__); - - _hidl_cb({}); - return {}; -} - -Return<void> Tuner::getParameters(const hidl_vec<hidl_string>& /* keys */, - getParameters_cb _hidl_cb) { - ALOGV("%s", __func__); - - _hidl_cb({}); - return {}; -} - } // namespace implementation -} // namespace V1_2 +} // namespace V1_1 } // namespace broadcastradio } // namespace hardware } // namespace android diff --git a/broadcastradio/1.2/default/Tuner.h b/broadcastradio/1.1/default/Tuner.h index 7e683545fa..764d5b3d28 100644 --- a/broadcastradio/1.2/default/Tuner.h +++ b/broadcastradio/1.1/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_2_TUNER_H -#define ANDROID_HARDWARE_BROADCASTRADIO_V1_2_TUNER_H +#ifndef ANDROID_HARDWARE_BROADCASTRADIO_V1_1_TUNER_H +#define ANDROID_HARDWARE_BROADCASTRADIO_V1_1_TUNER_H #include "VirtualRadio.h" -#include <android/hardware/broadcastradio/1.2/ITuner.h> -#include <android/hardware/broadcastradio/1.2/ITunerCallback.h> +#include <android/hardware/broadcastradio/1.1/ITuner.h> +#include <android/hardware/broadcastradio/1.1/ITunerCallback.h> #include <broadcastradio-utils/WorkerThread.h> namespace android { namespace hardware { namespace broadcastradio { -namespace V1_2 { +namespace V1_1 { namespace implementation { struct Tuner : public ITuner { @@ -33,7 +33,7 @@ struct Tuner : public ITuner { void forceClose(); - // V1_2::ITuner methods + // V1_1::ITuner methods virtual Return<Result> setConfiguration(const V1_0::BandConfig& config) override; virtual Return<void> getConfiguration(getConfiguration_cb _hidl_cb) override; virtual Return<Result> scan(V1_0::Direction direction, bool skipSubChannel) override; @@ -49,10 +49,6 @@ struct Tuner : public ITuner { getProgramList_cb _hidl_cb) override; virtual Return<Result> setAnalogForced(bool isForced) override; virtual Return<void> isAnalogForced(isAnalogForced_cb _hidl_cb) override; - virtual Return<void> setParameters(const hidl_vec<V1_1::VendorKeyValue>& parameters, - setParameters_cb _hidl_cb) override; - virtual Return<void> getParameters(const hidl_vec<hidl_string>& keys, - getParameters_cb _hidl_cb) override; private: std::mutex mMut; @@ -62,7 +58,6 @@ struct Tuner : public ITuner { V1_0::Class mClassId; const sp<V1_0::ITunerCallback> mCallback; const sp<V1_1::ITunerCallback> mCallback1_1; - const sp<V1_2::ITunerCallback> mCallback1_2; std::reference_wrapper<VirtualRadio> mVirtualRadio; bool mIsAmfmConfigSet = false; @@ -77,9 +72,9 @@ struct Tuner : public ITuner { }; } // namespace implementation -} // namespace V1_2 +} // namespace V1_1 } // namespace broadcastradio } // namespace hardware } // namespace android -#endif // ANDROID_HARDWARE_BROADCASTRADIO_V1_2_TUNER_H +#endif // ANDROID_HARDWARE_BROADCASTRADIO_V1_1_TUNER_H diff --git a/broadcastradio/1.2/default/VirtualProgram.cpp b/broadcastradio/1.1/default/VirtualProgram.cpp index 3594f64403..20dc1f5b5d 100644 --- a/broadcastradio/1.2/default/VirtualProgram.cpp +++ b/broadcastradio/1.1/default/VirtualProgram.cpp @@ -22,7 +22,7 @@ namespace android { namespace hardware { namespace broadcastradio { -namespace V1_2 { +namespace V1_1 { namespace implementation { using std::vector; @@ -30,9 +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 V1_2::IdentifierType; using utils::HalRevision; static MetaData createDemoBitmap(MetadataKey key, HalRevision halRev) { @@ -96,7 +96,7 @@ vector<ProgramInfo> getProgramInfoVector(const vector<VirtualProgram>& vec, HalR } } // namespace implementation -} // namespace V1_2 +} // namespace V1_1 } // namespace broadcastradio } // namespace hardware } // namespace android diff --git a/broadcastradio/1.2/default/VirtualProgram.h b/broadcastradio/1.1/default/VirtualProgram.h index c0b20f0a72..fd7a5e7731 100644 --- a/broadcastradio/1.2/default/VirtualProgram.h +++ b/broadcastradio/1.1/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_2_VIRTUALPROGRAM_H -#define ANDROID_HARDWARE_BROADCASTRADIO_V1_2_VIRTUALPROGRAM_H +#ifndef ANDROID_HARDWARE_BROADCASTRADIO_V1_1_VIRTUALPROGRAM_H +#define ANDROID_HARDWARE_BROADCASTRADIO_V1_1_VIRTUALPROGRAM_H -#include <android/hardware/broadcastradio/1.2/types.h> +#include <android/hardware/broadcastradio/1.1/types.h> #include <broadcastradio-utils-1x/Utils.h> namespace android { namespace hardware { namespace broadcastradio { -namespace V1_2 { +namespace V1_1 { namespace implementation { /** @@ -47,9 +47,9 @@ std::vector<V1_1::ProgramInfo> getProgramInfoVector(const std::vector<VirtualPro utils::HalRevision halRev); } // namespace implementation -} // namespace V1_2 +} // namespace V1_1 } // namespace broadcastradio } // namespace hardware } // namespace android -#endif // ANDROID_HARDWARE_BROADCASTRADIO_V1_2_VIRTUALPROGRAM_H +#endif // ANDROID_HARDWARE_BROADCASTRADIO_V1_1_VIRTUALPROGRAM_H diff --git a/broadcastradio/1.2/default/VirtualRadio.cpp b/broadcastradio/1.1/default/VirtualRadio.cpp index 8988080061..5b79155522 100644 --- a/broadcastradio/1.2/default/VirtualRadio.cpp +++ b/broadcastradio/1.1/default/VirtualRadio.cpp @@ -24,7 +24,7 @@ namespace android { namespace hardware { namespace broadcastradio { -namespace V1_2 { +namespace V1_1 { namespace implementation { using V1_0::Band; @@ -100,7 +100,7 @@ VirtualRadio& getDigitalRadio() { } } // namespace implementation -} // namespace V1_2 +} // namespace V1_1 } // namespace broadcastradio } // namespace hardware } // namespace android diff --git a/broadcastradio/1.2/default/VirtualRadio.h b/broadcastradio/1.1/default/VirtualRadio.h index 8cfaefeb42..176b1b2fb9 100644 --- a/broadcastradio/1.2/default/VirtualRadio.h +++ b/broadcastradio/1.1/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_2_VIRTUALRADIO_H -#define ANDROID_HARDWARE_BROADCASTRADIO_V1_2_VIRTUALRADIO_H +#ifndef ANDROID_HARDWARE_BROADCASTRADIO_V1_1_VIRTUALRADIO_H +#define ANDROID_HARDWARE_BROADCASTRADIO_V1_1_VIRTUALRADIO_H #include "VirtualProgram.h" @@ -24,7 +24,7 @@ namespace android { namespace hardware { namespace broadcastradio { -namespace V1_2 { +namespace V1_1 { namespace implementation { /** @@ -72,9 +72,9 @@ VirtualRadio& getSatRadio(); VirtualRadio& getDigitalRadio(); } // namespace implementation -} // namespace V1_2 +} // namespace V1_1 } // namespace broadcastradio } // namespace hardware } // namespace android -#endif // ANDROID_HARDWARE_BROADCASTRADIO_V1_2_VIRTUALRADIO_H +#endif // ANDROID_HARDWARE_BROADCASTRADIO_V1_1_VIRTUALRADIO_H diff --git a/broadcastradio/1.2/default/android.hardware.broadcastradio@1.2-service.rc b/broadcastradio/1.1/default/android.hardware.broadcastradio@1.1-service.rc index 3741f21aa2..7c57135fc2 100644 --- a/broadcastradio/1.2/default/android.hardware.broadcastradio@1.2-service.rc +++ b/broadcastradio/1.1/default/android.hardware.broadcastradio@1.1-service.rc @@ -1,4 +1,4 @@ -service broadcastradio-hal /vendor/bin/hw/android.hardware.broadcastradio@1.2-service +service broadcastradio-hal /vendor/bin/hw/android.hardware.broadcastradio@1.1-service class hal user audioserver group audio diff --git a/broadcastradio/1.2/default/resources.h b/broadcastradio/1.1/default/resources.h index b383c278e0..b7e709f955 100644 --- a/broadcastradio/1.2/default/resources.h +++ b/broadcastradio/1.1/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_2_RESOURCES_H -#define ANDROID_HARDWARE_BROADCASTRADIO_V1_2_RESOURCES_H +#ifndef ANDROID_HARDWARE_BROADCASTRADIO_V1_1_RESOURCES_H +#define ANDROID_HARDWARE_BROADCASTRADIO_V1_1_RESOURCES_H namespace android { namespace hardware { namespace broadcastradio { -namespace V1_2 { +namespace V1_1 { namespace implementation { namespace resources { @@ -38,9 +38,9 @@ constexpr uint8_t demoPng[] = { } // namespace resources } // namespace implementation -} // namespace V1_2 +} // namespace V1_1 } // namespace broadcastradio } // namespace hardware } // namespace android -#endif // ANDROID_HARDWARE_BROADCASTRADIO_V1_2_RESOURCES_H +#endif // ANDROID_HARDWARE_BROADCASTRADIO_V1_1_RESOURCES_H diff --git a/broadcastradio/1.2/default/service.cpp b/broadcastradio/1.1/default/service.cpp index ea86fbaf33..f8af0b78cb 100644 --- a/broadcastradio/1.2/default/service.cpp +++ b/broadcastradio/1.1/default/service.cpp @@ -22,7 +22,7 @@ using android::hardware::configureRpcThreadpool; using android::hardware::joinRpcThreadpool; -using android::hardware::broadcastradio::V1_2::implementation::BroadcastRadioFactory; +using android::hardware::broadcastradio::V1_1::implementation::BroadcastRadioFactory; int main(int /* argc */, char** /* argv */) { configureRpcThreadpool(4, true); diff --git a/broadcastradio/1.2/vts/OWNERS b/broadcastradio/1.2/vts/OWNERS deleted file mode 100644 index 12adf5762b..0000000000 --- a/broadcastradio/1.2/vts/OWNERS +++ /dev/null @@ -1,7 +0,0 @@ -# Automotive team -egranata@google.com -twasilczyk@google.com - -# VTS team -yuexima@google.com -yim@google.com diff --git a/broadcastradio/1.2/vts/functional/Android.bp b/broadcastradio/1.2/vts/functional/Android.bp deleted file mode 100644 index fd1c25430f..0000000000 --- a/broadcastradio/1.2/vts/functional/Android.bp +++ /dev/null @@ -1,28 +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. -// - -cc_test { - name: "VtsHalBroadcastradioV1_2TargetTest", - defaults: ["VtsHalTargetTestDefaults"], - srcs: ["VtsHalBroadcastradioV1_2TargetTest.cpp"], - static_libs: [ - "android.hardware.broadcastradio@1.0", - "android.hardware.broadcastradio@1.1", - "android.hardware.broadcastradio@1.2", - "android.hardware.broadcastradio@vts-utils-lib", - "libgmock", - ], -} diff --git a/broadcastradio/1.2/vts/functional/VtsHalBroadcastradioV1_2TargetTest.cpp b/broadcastradio/1.2/vts/functional/VtsHalBroadcastradioV1_2TargetTest.cpp deleted file mode 100644 index 085206b2d3..0000000000 --- a/broadcastradio/1.2/vts/functional/VtsHalBroadcastradioV1_2TargetTest.cpp +++ /dev/null @@ -1,293 +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. - */ - -#define LOG_TAG "broadcastradio.vts" - -#include <VtsHalHidlTargetTestBase.h> -#include <android-base/logging.h> -#include <android/hardware/broadcastradio/1.1/IBroadcastRadio.h> -#include <android/hardware/broadcastradio/1.2/IBroadcastRadioFactory.h> -#include <android/hardware/broadcastradio/1.2/ITuner.h> -#include <android/hardware/broadcastradio/1.2/ITunerCallback.h> -#include <android/hardware/broadcastradio/1.2/types.h> -#include <broadcastradio-vts-utils/call-barrier.h> -#include <broadcastradio-vts-utils/mock-timeout.h> -#include <broadcastradio-vts-utils/pointer-utils.h> -#include <cutils/native_handle.h> -#include <cutils/properties.h> -#include <gmock/gmock.h> -#include <hidl/HidlTransportSupport.h> -#include <utils/threads.h> - -#include <chrono> - -namespace android { -namespace hardware { -namespace broadcastradio { -namespace V1_2 { -namespace vts { - -using namespace std::chrono_literals; - -using testing::_; -using testing::AnyNumber; -using testing::ByMove; -using testing::DoAll; -using testing::Invoke; -using testing::SaveArg; - -using broadcastradio::vts::CallBarrier; -using V1_0::BandConfig; -using V1_0::Class; -using V1_0::MetaData; -using V1_0::MetadataKey; -using V1_0::MetadataType; -using V1_1::IBroadcastRadio; -using V1_1::ProgramInfo; -using V1_1::ProgramListResult; -using V1_1::ProgramSelector; -using V1_1::Properties; - -using broadcastradio::vts::clearAndWait; - -static constexpr auto kConfigTimeout = 10s; -static constexpr auto kConnectModuleTimeout = 1s; - -static void printSkipped(std::string msg) { - std::cout << "[ SKIPPED ] " << msg << std::endl; -} - -struct TunerCallbackMock : public ITunerCallback { - TunerCallbackMock() { EXPECT_CALL(*this, hardwareFailure()).Times(0); } - - MOCK_METHOD0(hardwareFailure, Return<void>()); - MOCK_TIMEOUT_METHOD2(configChange, Return<void>(Result, const BandConfig&)); - MOCK_METHOD2(tuneComplete, Return<void>(Result, const V1_0::ProgramInfo&)); - MOCK_TIMEOUT_METHOD2(tuneComplete_1_1, Return<void>(Result, const ProgramSelector&)); - MOCK_METHOD1(afSwitch, Return<void>(const V1_0::ProgramInfo&)); - MOCK_METHOD1(antennaStateChange, Return<void>(bool connected)); - MOCK_METHOD1(trafficAnnouncement, Return<void>(bool active)); - MOCK_METHOD1(emergencyAnnouncement, Return<void>(bool active)); - MOCK_METHOD3(newMetadata, Return<void>(uint32_t ch, uint32_t subCh, const hidl_vec<MetaData>&)); - MOCK_METHOD1(backgroundScanAvailable, Return<void>(bool)); - MOCK_TIMEOUT_METHOD1(backgroundScanComplete, Return<void>(ProgramListResult)); - MOCK_METHOD0(programListChanged, Return<void>()); - MOCK_TIMEOUT_METHOD1(currentProgramInfoChanged, Return<void>(const ProgramInfo&)); - MOCK_METHOD1(parametersUpdated, Return<void>(const hidl_vec<VendorKeyValue>& parameters)); -}; - -class BroadcastRadioHalTest : public ::testing::VtsHalHidlTargetTestBase, - public ::testing::WithParamInterface<Class> { - protected: - virtual void SetUp() override; - virtual void TearDown() override; - - bool openTuner(); - - Class radioClass; - bool skipped = false; - - sp<IBroadcastRadio> mRadioModule; - sp<ITuner> mTuner; - sp<TunerCallbackMock> mCallback = new TunerCallbackMock(); - - private: - const BandConfig& getBand(unsigned idx); - - hidl_vec<BandConfig> mBands; -}; - -void BroadcastRadioHalTest::SetUp() { - radioClass = GetParam(); - - // lookup HIDL service - auto factory = getService<IBroadcastRadioFactory>(); - ASSERT_NE(nullptr, factory.get()); - - // connect radio module - Result connectResult; - CallBarrier onConnect; - factory->connectModule(radioClass, [&](Result ret, const sp<V1_0::IBroadcastRadio>& radio) { - connectResult = ret; - if (ret == Result::OK) mRadioModule = IBroadcastRadio::castFrom(radio); - onConnect.call(); - }); - ASSERT_TRUE(onConnect.waitForCall(kConnectModuleTimeout)); - - if (connectResult == Result::INVALID_ARGUMENTS) { - printSkipped("This device class is not supported."); - skipped = true; - return; - } - ASSERT_EQ(connectResult, Result::OK); - ASSERT_NE(nullptr, mRadioModule.get()); - - // get module properties - Properties prop11; - auto& prop10 = prop11.base; - auto propResult = - mRadioModule->getProperties_1_1([&](const Properties& properties) { prop11 = properties; }); - - ASSERT_TRUE(propResult.isOk()); - EXPECT_EQ(radioClass, prop10.classId); - EXPECT_GT(prop10.numTuners, 0u); - EXPECT_GT(prop11.supportedProgramTypes.size(), 0u); - EXPECT_GT(prop11.supportedIdentifierTypes.size(), 0u); - if (radioClass == Class::AM_FM) { - EXPECT_GT(prop10.bands.size(), 0u); - } - mBands = prop10.bands; -} - -void BroadcastRadioHalTest::TearDown() { - mTuner.clear(); - mRadioModule.clear(); - clearAndWait(mCallback, 1s); -} - -bool BroadcastRadioHalTest::openTuner() { - EXPECT_EQ(nullptr, mTuner.get()); - - if (radioClass == Class::AM_FM) { - EXPECT_TIMEOUT_CALL(*mCallback, configChange, Result::OK, _); - } - - Result halResult = Result::NOT_INITIALIZED; - auto openCb = [&](Result result, const sp<V1_0::ITuner>& tuner) { - halResult = result; - if (result != Result::OK) return; - mTuner = ITuner::castFrom(tuner); - }; - auto hidlResult = mRadioModule->openTuner(getBand(0), true, mCallback, openCb); - - EXPECT_TRUE(hidlResult.isOk()); - EXPECT_EQ(Result::OK, halResult); - EXPECT_NE(nullptr, mTuner.get()); - if (radioClass == Class::AM_FM && mTuner != nullptr) { - EXPECT_TIMEOUT_CALL_WAIT(*mCallback, configChange, kConfigTimeout); - - BandConfig halConfig; - Result halResult = Result::NOT_INITIALIZED; - mTuner->getConfiguration([&](Result result, const BandConfig& config) { - halResult = result; - halConfig = config; - }); - EXPECT_EQ(Result::OK, halResult); - EXPECT_TRUE(halConfig.antennaConnected); - } - - EXPECT_NE(nullptr, mTuner.get()); - return nullptr != mTuner.get(); -} - -const BandConfig& BroadcastRadioHalTest::getBand(unsigned idx) { - static const BandConfig dummyBandConfig = {}; - - if (radioClass != Class::AM_FM) { - ALOGD("Not AM/FM radio, returning dummy band config"); - return dummyBandConfig; - } - - EXPECT_GT(mBands.size(), idx); - if (mBands.size() <= idx) { - ALOGD("Band index out of bound, returning dummy band config"); - return dummyBandConfig; - } - - auto& band = mBands[idx]; - ALOGD("Returning %s band", toString(band.type).c_str()); - return band; -} - -/** - * Test IBroadcastRadio::get|setParameters() methods called with no parameters. - * - * Verifies that: - * - callback is called for empty parameters set. - */ -TEST_P(BroadcastRadioHalTest, NoParameters) { - if (skipped) return; - - ASSERT_TRUE(openTuner()); - - hidl_vec<VendorKeyValue> halResults = {}; - bool wasCalled = false; - auto cb = [&](hidl_vec<VendorKeyValue> results) { - wasCalled = true; - halResults = results; - }; - - auto hidlResult = mTuner->setParameters({}, cb); - ASSERT_TRUE(hidlResult.isOk()); - ASSERT_TRUE(wasCalled); - ASSERT_EQ(0u, halResults.size()); - - wasCalled = false; - hidlResult = mTuner->getParameters({}, cb); - ASSERT_TRUE(hidlResult.isOk()); - ASSERT_TRUE(wasCalled); - ASSERT_EQ(0u, halResults.size()); -} - -/** - * Test IBroadcastRadio::get|setParameters() methods called with unknown parameters. - * - * Verifies that: - * - unknown parameters are ignored; - * - callback is called also for empty results set. - */ -TEST_P(BroadcastRadioHalTest, UnknownParameters) { - if (skipped) return; - - ASSERT_TRUE(openTuner()); - - hidl_vec<VendorKeyValue> halResults = {}; - bool wasCalled = false; - auto cb = [&](hidl_vec<VendorKeyValue> results) { - wasCalled = true; - halResults = results; - }; - - auto hidlResult = mTuner->setParameters({{"com.google.unknown", "dummy"}}, cb); - ASSERT_TRUE(hidlResult.isOk()); - ASSERT_TRUE(wasCalled); - ASSERT_EQ(0u, halResults.size()); - - wasCalled = false; - hidlResult = mTuner->getParameters({{"com.google.unknown*", "dummy"}}, cb); - ASSERT_TRUE(hidlResult.isOk()); - ASSERT_TRUE(wasCalled); - ASSERT_EQ(0u, halResults.size()); -} - -// TODO(b/69860743): implement VerifyIdentifiersFormat test when -// the new program list fetching mechanism is implemented - -INSTANTIATE_TEST_CASE_P(BroadcastRadioHalTestCases, BroadcastRadioHalTest, - ::testing::Values(Class::AM_FM, Class::SAT, Class::DT)); - -} // namespace vts -} // namespace V1_2 -} // namespace broadcastradio -} // namespace hardware -} // namespace android - -int main(int argc, char** argv) { - ::testing::InitGoogleTest(&argc, argv); - int status = RUN_ALL_TESTS(); - ALOGI("Test result = %d", status); - return status; -} diff --git a/broadcastradio/common/tests/Android.bp b/broadcastradio/common/tests/Android.bp index f6a3b6f4d9..3ba31db11a 100644 --- a/broadcastradio/common/tests/Android.bp +++ b/broadcastradio/common/tests/Android.bp @@ -33,7 +33,7 @@ cc_test { "android.hardware.broadcastradio@common-utils-2x-lib", ], shared_libs: [ - "android.hardware.broadcastradio@1.2", + "android.hardware.broadcastradio@1.1", "android.hardware.broadcastradio@2.0", ], } diff --git a/broadcastradio/common/utils1x/Android.bp b/broadcastradio/common/utils1x/Android.bp index 127c15a154..443dca158d 100644 --- a/broadcastradio/common/utils1x/Android.bp +++ b/broadcastradio/common/utils1x/Android.bp @@ -28,6 +28,6 @@ cc_library_static { ], export_include_dirs: ["include"], shared_libs: [ - "android.hardware.broadcastradio@1.2", + "android.hardware.broadcastradio@1.1", ], } diff --git a/broadcastradio/common/utils1x/Utils.cpp b/broadcastradio/common/utils1x/Utils.cpp index 7a59d6a13a..9c2cc3d51e 100644 --- a/broadcastradio/common/utils1x/Utils.cpp +++ b/broadcastradio/common/utils1x/Utils.cpp @@ -26,10 +26,10 @@ namespace broadcastradio { namespace utils { using V1_0::Band; +using V1_1::IdentifierType; using V1_1::ProgramIdentifier; using V1_1::ProgramSelector; using V1_1::ProgramType; -using V1_2::IdentifierType; static bool isCompatibleProgramType(const uint32_t ia, const uint32_t ib) { auto a = static_cast<ProgramType>(ia); @@ -86,7 +86,7 @@ bool tunesTo(const ProgramSelector& a, const ProgramSelector& b) { return haveEqualIds(a, b, IdentifierType::AMFM_FREQUENCY); case ProgramType::DAB: - return haveEqualIds(a, b, IdentifierType::DAB_SID_EXT); + return haveEqualIds(a, b, IdentifierType::DAB_SIDECC); case ProgramType::DRMO: return haveEqualIds(a, b, IdentifierType::DRMO_SERVICE_ID); case ProgramType::SXM: @@ -126,35 +126,21 @@ bool isFm(const Band band) { static bool maybeGetId(const ProgramSelector& sel, const IdentifierType type, uint64_t* val) { auto itype = static_cast<uint32_t>(type); - auto itypeAlt = itype; - if (type == IdentifierType::DAB_SIDECC) { - itypeAlt = static_cast<uint32_t>(IdentifierType::DAB_SID_EXT); - } - if (type == IdentifierType::DAB_SID_EXT) { - itypeAlt = static_cast<uint32_t>(IdentifierType::DAB_SIDECC); - } - if (sel.primaryId.type == itype || sel.primaryId.type == itypeAlt) { + if (sel.primaryId.type == itype) { if (val) *val = sel.primaryId.value; return true; } // not optimal, but we don't care in default impl - bool gotAlt = false; for (auto&& id : sel.secondaryIds) { if (id.type == itype) { if (val) *val = id.value; return true; } - // alternative identifier is a backup, we prefer original value - if (id.type == itypeAlt) { - if (val) *val = id.value; - gotAlt = true; - continue; - } } - return gotAlt; + return false; } bool hasId(const ProgramSelector& sel, const IdentifierType type) { diff --git a/broadcastradio/common/utils1x/include/broadcastradio-utils-1x/Utils.h b/broadcastradio/common/utils1x/include/broadcastradio-utils-1x/Utils.h index 5884b5ad6f..8ad7109928 100644 --- a/broadcastradio/common/utils1x/include/broadcastradio-utils-1x/Utils.h +++ b/broadcastradio/common/utils1x/include/broadcastradio-utils-1x/Utils.h @@ -16,7 +16,7 @@ #ifndef ANDROID_HARDWARE_BROADCASTRADIO_COMMON_UTILS_1X_H #define ANDROID_HARDWARE_BROADCASTRADIO_COMMON_UTILS_1X_H -#include <android/hardware/broadcastradio/1.2/types.h> +#include <android/hardware/broadcastradio/1.1/types.h> #include <chrono> #include <queue> #include <thread> @@ -29,7 +29,7 @@ namespace utils { enum class HalRevision : uint32_t { V1_0 = 1, V1_1, - V1_2, + V1_2, // TODO(b/62945293): remove }; /** @@ -50,21 +50,21 @@ bool isAmFm(const V1_1::ProgramType type); bool isAm(const V1_0::Band band); bool isFm(const V1_0::Band band); -bool hasId(const V1_1::ProgramSelector& sel, const V1_2::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 V1_1::ProgramSelector& sel, const V1_2::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 V1_1::ProgramSelector& sel, const V1_2::IdentifierType type, uint64_t defval); +uint64_t getId(const V1_1::ProgramSelector& sel, const V1_1::IdentifierType type, uint64_t defval); V1_1::ProgramSelector make_selector(V1_0::Band band, uint32_t channel, uint32_t subChannel = 0); |