Branch out Broadcast Radio 1.2 HAL.

Bug: 62945293
Change-Id: Ic84f9fe6c17040053257085801208ed527fd07ab
Fixes: 64115813
Test: instrumentation, VTS
This commit is contained in:
Tomasz Wasilczyk
2017-09-14 09:43:35 -07:00
parent 2cf5bc8db5
commit f679e8b6ec
36 changed files with 311 additions and 111 deletions

View File

@@ -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",
],
}

View File

@@ -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",
],
}

View File

@@ -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 {
};

View File

@@ -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 {
};

View File

@@ -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 {
};

View File

@@ -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",

View File

@@ -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<void> BroadcastRadio::getImage(int32_t id, getImage_cb _hidl_cb) {
}
} // namespace implementation
} // namespace V1_1
} // namespace V1_2
} // namespace broadcastradio
} // namespace hardware
} // namespace android

View File

@@ -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 <android/hardware/broadcastradio/1.1/IBroadcastRadio.h>
#include <android/hardware/broadcastradio/1.1/types.h>
#include <android/hardware/broadcastradio/1.2/types.h>
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

View File

@@ -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<Class> 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<void> BroadcastRadioFactory::connectModule(Class classId, connectModule_c
}
} // namespace implementation
} // namespace V1_1
} // namespace V1_2
} // namespace broadcastradio
} // namespace hardware
} // namespace android

View File

@@ -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 <android/hardware/broadcastradio/1.1/IBroadcastRadio.h>
#include <android/hardware/broadcastradio/1.1/IBroadcastRadioFactory.h>
#include <android/hardware/broadcastradio/1.1/types.h>
#include <android/hardware/broadcastradio/1.2/IBroadcastRadioFactory.h>
#include <android/hardware/broadcastradio/1.2/types.h>
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<void> connectModule(V1_0::Class classId, connectModule_cb _hidl_cb) override;
private:
std::map<V1_0::Class, sp<IBroadcastRadio>> mRadioModules;
std::map<V1_0::Class, sp<V1_1::IBroadcastRadio>> 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

View File

@@ -1,4 +1,3 @@
# Automotive team
egranata@google.com
keunyoung@google.com
twasilczyk@google.com

View File

@@ -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<V1_0::ITunerCallback>& 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<Result> Tuner::cancelAnnouncement() {
Return<void> 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<void> Tuner::getProgramInformation_1_1(getProgramInformation_1_1_cb _hidl_cb) {
@@ -374,7 +383,7 @@ Return<void> Tuner::isAnalogForced(isAnalogForced_cb _hidl_cb) {
}
} // namespace implementation
} // namespace V1_1
} // namespace V1_2
} // namespace broadcastradio
} // namespace hardware
} // namespace android

View File

@@ -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 <android/hardware/broadcastradio/1.1/ITuner.h>
#include <android/hardware/broadcastradio/1.1/ITunerCallback.h>
#include <android/hardware/broadcastradio/1.2/ITuner.h>
#include <android/hardware/broadcastradio/1.2/ITunerCallback.h>
#include <broadcastradio-utils/WorkerThread.h>
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<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;
virtual Return<Result> step(V1_0::Direction direction, bool skipSubChannel) override;
virtual Return<Result> tune(uint32_t channel, uint32_t subChannel) override;
virtual Return<Result> tuneByProgramSelector(const ProgramSelector& program) override;
virtual Return<Result> tuneByProgramSelector(const V1_1::ProgramSelector& program) override;
virtual Return<Result> cancel() override;
virtual Return<Result> cancelAnnouncement() override;
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_vec<VendorKeyValue>& filter,
virtual Return<V1_1::ProgramListResult> startBackgroundScan() override;
virtual Return<void> getProgramList(const hidl_vec<V1_1::VendorKeyValue>& filter,
getProgramList_cb _hidl_cb) override;
virtual Return<Result> setAnalogForced(bool isForced) override;
virtual Return<void> isAnalogForced(isAnalogForced_cb _hidl_cb) override;
@@ -58,23 +58,24 @@ 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;
V1_0::BandConfig mAmfmConfig;
bool mIsTuneCompleted = false;
ProgramSelector mCurrentProgram = {};
ProgramInfo mCurrentProgramInfo = {};
V1_1::ProgramSelector mCurrentProgram = {};
V1_1::ProgramInfo mCurrentProgramInfo = {};
std::atomic<bool> 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

View File

@@ -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<ProgramInfo> getProgramInfoVector(const vector<VirtualProgram>& vec, HalR
}
} // namespace implementation
} // namespace V1_1
} // namespace V1_2
} // namespace broadcastradio
} // namespace hardware
} // namespace android

View File

@@ -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 <android/hardware/broadcastradio/1.1/types.h>
#include <android/hardware/broadcastradio/1.2/types.h>
#include <broadcastradio-utils/Utils.h>
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<ProgramInfo> getProgramInfoVector(const std::vector<VirtualProgram>& vec,
utils::HalRevision halRev);
std::vector<V1_1::ProgramInfo> getProgramInfoVector(const std::vector<VirtualProgram>& 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

View File

@@ -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

View File

@@ -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<VirtualProgram> initialList);
std::vector<VirtualProgram> 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

View File

@@ -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

View File

@@ -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

View File

@@ -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);

View File

@@ -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;

View File

@@ -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",
]

View File

@@ -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"],
}

View File

@@ -1,6 +1,5 @@
# Automotive team
egranata@google.com
keunyoung@google.com
twasilczyk@google.com
# VTS team

View File

@@ -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: [

View File

@@ -1,4 +1,3 @@
# Automotive team
egranata@google.com
keunyoung@google.com
twasilczyk@google.com

View File

@@ -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<ProgramType>(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());

View File

@@ -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 <android/hardware/broadcastradio/1.1/types.h>
#include <chrono>
@@ -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

View File

@@ -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 <chrono>
#include <queue>
@@ -48,4 +48,4 @@ class WorkerThread {
} // namespace android
#endif // ANDROID_HARDWARE_BROADCASTRADIO_V1_1_WORKERTHREAD_H
#endif // ANDROID_HARDWARE_BROADCASTRADIO_COMMON_WORKERTHREAD_H

View File

@@ -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",
],

View File

@@ -0,0 +1,7 @@
# Automotive team
egranata@google.com
twasilczyk@google.com
# VTS team
ryanjcampbell@google.com
yim@google.com