Branch out Broadcast Radio 1.2 HAL.
Bug: 62945293
Change-Id: Ic84f9fe6c17040053257085801208ed527fd07ab
Fixes: 64115813
Test: instrumentation, VTS
diff --git a/broadcastradio/1.1/vts/functional/Android.bp b/broadcastradio/1.1/vts/functional/Android.bp
index 4b93cbc..3d4fe05 100644
--- a/broadcastradio/1.1/vts/functional/Android.bp
+++ b/broadcastradio/1.1/vts/functional/Android.bp
@@ -21,8 +21,8 @@
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 0000000..44136c8
--- /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 0000000..29f6ab3
--- /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 0000000..ee8a45d
--- /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 0000000..223a571
--- /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 83%
rename from broadcastradio/1.1/default/Android.bp
rename to broadcastradio/1.2/default/Android.bp
index 6d26b11..e42cb1e 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 @@
"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 96%
rename from broadcastradio/1.1/default/BroadcastRadio.cpp
rename to broadcastradio/1.2/default/BroadcastRadio.cpp
index 1bcfd82..5164e47 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::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 @@
}
} // 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 a96a2ab..94d62b9 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 <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 @@
};
} // 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 90%
rename from broadcastradio/1.1/default/BroadcastRadioFactory.cpp
rename to broadcastradio/1.2/default/BroadcastRadioFactory.cpp
index f57bc79..8f17aff 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 @@
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 @@
}
} // 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 8b67ac3..c365ae0 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 <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 @@
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
diff --git a/broadcastradio/1.1/default/OWNERS b/broadcastradio/1.2/default/OWNERS
similarity index 74%
rename from broadcastradio/1.1/default/OWNERS
rename to broadcastradio/1.2/default/OWNERS
index 0c27b71..136b607 100644
--- a/broadcastradio/1.1/default/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 9a34cb1..f5fb643 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::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 @@
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 @@
}
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<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 @@
}
} // 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 07d3189..3cf077b 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 <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 @@
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 @@
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
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 7977391..95879e3 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 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 @@
}
} // 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 a14830d..5342c84 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 <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 @@
* 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
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 36d47a9..867726d 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 @@
}
} // 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 3c7ae5c..8cfaefe 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 @@
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& 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 7c57135..3741f21 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 b7e709f..b383c27 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 @@
} // 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 94%
rename from broadcastradio/1.1/default/service.cpp
rename to broadcastradio/1.2/default/service.cpp
index f8af0b7..ea86fba 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 0000000..5edb097
--- /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 8c65bf6..224dd63 100644
--- a/broadcastradio/Android.bp
+++ b/broadcastradio/Android.bp
@@ -4,9 +4,10 @@
"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 fa1fd94..4456602 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 @@
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 aa5ce82..21e1cd6 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 e80d133..d8bd125 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/utils/OWNERS b/broadcastradio/common/utils/OWNERS
similarity index 74%
rename from broadcastradio/1.1/utils/OWNERS
rename to broadcastradio/common/utils/OWNERS
index 0c27b71..136b607 100644
--- a/broadcastradio/1.1/utils/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 4dd6b13..bdaf8e8 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<ProgramType>(ia);
@@ -208,7 +211,6 @@
}
} // namespace utils
-} // namespace V1_1
namespace V1_0 {
@@ -218,9 +220,9 @@
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 24c60ee..b07ce79 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 <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 @@
* @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 @@
} // 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 635876f..62bede6 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 <chrono>
#include <queue>
@@ -48,4 +48,4 @@
} // 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 0c7e2a4..4ba8a17 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/1.1/tests/OWNERS b/broadcastradio/common/vts/utils/OWNERS
similarity index 83%
copy from broadcastradio/1.1/tests/OWNERS
copy to broadcastradio/common/vts/utils/OWNERS
index aa5ce82..21e1cd6 100644
--- a/broadcastradio/1.1/tests/OWNERS
+++ b/broadcastradio/common/vts/utils/OWNERS
@@ -1,6 +1,5 @@
# Automotive team
egranata@google.com
-keunyoung@google.com
twasilczyk@google.com
# VTS team
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