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.1/vts/utils/Android.bp b/broadcastradio/1.1/vts/utils/Android.bp
deleted file mode 100644
index 0c7e2a4..0000000
--- a/broadcastradio/1.1/vts/utils/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_library_static {
- name: "android.hardware.broadcastradio@1.1-vts-utils-lib",
- srcs: [
- "call-barrier.cpp",
- ],
- export_include_dirs: ["include"],
- cflags: [
- "-Wall",
- "-Wextra",
- "-Werror",
- ],
-}
diff --git a/broadcastradio/1.1/vts/utils/call-barrier.cpp b/broadcastradio/1.1/vts/utils/call-barrier.cpp
deleted file mode 100644
index d8c4716..0000000
--- a/broadcastradio/1.1/vts/utils/call-barrier.cpp
+++ /dev/null
@@ -1,45 +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.
- */
-#include <broadcastradio-vts-utils/call-barrier.h>
-
-namespace android {
-namespace hardware {
-namespace broadcastradio {
-namespace vts {
-
-using std::lock_guard;
-using std::mutex;
-using std::unique_lock;
-
-void CallBarrier::call() {
- lock_guard<mutex> lk(mMut);
- mWasCalled = true;
- mCond.notify_all();
-}
-
-bool CallBarrier::waitForCall(std::chrono::milliseconds timeout) {
- unique_lock<mutex> lk(mMut);
-
- if (mWasCalled) return true;
-
- auto status = mCond.wait_for(lk, timeout);
- return status == std::cv_status::no_timeout;
-}
-
-} // namespace vts
-} // namespace broadcastradio
-} // namespace hardware
-} // namespace android
diff --git a/broadcastradio/1.1/vts/utils/include/broadcastradio-vts-utils/call-barrier.h b/broadcastradio/1.1/vts/utils/include/broadcastradio-vts-utils/call-barrier.h
deleted file mode 100644
index 462396a..0000000
--- a/broadcastradio/1.1/vts/utils/include/broadcastradio-vts-utils/call-barrier.h
+++ /dev/null
@@ -1,59 +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.
- */
-#ifndef ANDROID_HARDWARE_BROADCASTRADIO_V1_1_CALL_BARRIER
-#define ANDROID_HARDWARE_BROADCASTRADIO_V1_1_CALL_BARRIER
-
-#include <chrono>
-#include <thread>
-
-namespace android {
-namespace hardware {
-namespace broadcastradio {
-namespace vts {
-
-/**
- * A barrier for thread synchronization, where one should wait for another to
- * reach a specific point in execution.
- */
-class CallBarrier {
- public:
- /**
- * Notify the other thread it may continue execution.
- *
- * This may be called before the other thread starts waiting on the barrier.
- */
- void call();
-
- /**
- * Wait for the other thread to reach call() execution point.
- *
- * @param timeout a maximum time to wait.
- * @returns {@code false} if timed out, {@code true} otherwise.
- */
- bool waitForCall(std::chrono::milliseconds timeout);
-
- private:
- bool mWasCalled = false;
- std::mutex mMut;
- std::condition_variable mCond;
-};
-
-} // namespace vts
-} // namespace broadcastradio
-} // namespace hardware
-} // namespace android
-
-#endif // ANDROID_HARDWARE_BROADCASTRADIO_V1_1_CALL_BARRIER
diff --git a/broadcastradio/1.1/vts/utils/include/broadcastradio-vts-utils/mock-timeout.h b/broadcastradio/1.1/vts/utils/include/broadcastradio-vts-utils/mock-timeout.h
deleted file mode 100644
index b0ce088..0000000
--- a/broadcastradio/1.1/vts/utils/include/broadcastradio-vts-utils/mock-timeout.h
+++ /dev/null
@@ -1,111 +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.
- */
-#ifndef ANDROID_HARDWARE_BROADCASTRADIO_V1_1_MOCK_TIMEOUT
-#define ANDROID_HARDWARE_BROADCASTRADIO_V1_1_MOCK_TIMEOUT
-
-#include <gmock/gmock.h>
-#include <thread>
-
-/**
- * Common helper objects for gmock timeout extension.
- *
- * INTERNAL IMPLEMENTATION - don't use in user code.
- */
-#define EGMOCK_TIMEOUT_METHOD_DEF_(Method, ...) \
- std::atomic<bool> egmock_called_##Method; \
- std::mutex egmock_mut_##Method; \
- std::condition_variable egmock_cond_##Method;
-
-/**
- * Common method body for gmock timeout extension.
- *
- * INTERNAL IMPLEMENTATION - don't use in user code.
- */
-#define EGMOCK_TIMEOUT_METHOD_BODY_(Method, ...) \
- auto ret = egmock_##Method(__VA_ARGS__); \
- { \
- std::lock_guard<std::mutex> lk(egmock_mut_##Method); \
- egmock_called_##Method = true; \
- egmock_cond_##Method.notify_all(); \
- } \
- return ret;
-
-/**
- * Gmock MOCK_METHOD0 timeout-capable extension.
- */
-#define MOCK_TIMEOUT_METHOD0(Method, ...) \
- MOCK_METHOD0(egmock_##Method, __VA_ARGS__); \
- EGMOCK_TIMEOUT_METHOD_DEF_(Method); \
- virtual GMOCK_RESULT_(, __VA_ARGS__) Method() { EGMOCK_TIMEOUT_METHOD_BODY_(Method); }
-
-/**
- * Gmock MOCK_METHOD1 timeout-capable extension.
- */
-#define MOCK_TIMEOUT_METHOD1(Method, ...) \
- MOCK_METHOD1(egmock_##Method, __VA_ARGS__); \
- EGMOCK_TIMEOUT_METHOD_DEF_(Method); \
- virtual GMOCK_RESULT_(, __VA_ARGS__) Method(GMOCK_ARG_(, 1, __VA_ARGS__) egmock_a1) { \
- EGMOCK_TIMEOUT_METHOD_BODY_(Method, egmock_a1); \
- }
-
-/**
- * Gmock MOCK_METHOD2 timeout-capable extension.
- */
-#define MOCK_TIMEOUT_METHOD2(Method, ...) \
- MOCK_METHOD2(egmock_##Method, __VA_ARGS__); \
- EGMOCK_TIMEOUT_METHOD_DEF_(Method); \
- virtual GMOCK_RESULT_(, __VA_ARGS__) \
- Method(GMOCK_ARG_(, 1, __VA_ARGS__) egmock_a1, GMOCK_ARG_(, 2, __VA_ARGS__) egmock_a2) { \
- EGMOCK_TIMEOUT_METHOD_BODY_(Method, egmock_a1, egmock_a2); \
- }
-
-/**
- * Gmock EXPECT_CALL timeout-capable extension.
- *
- * It has slightly different syntax from the original macro, to make method name accessible.
- * So, instead of typing
- * EXPECT_CALL(account, charge(100, Currency::USD));
- * you need to inline arguments
- * EXPECT_TIMEOUT_CALL(account, charge, 100, Currency::USD);
- */
-#define EXPECT_TIMEOUT_CALL(obj, Method, ...) \
- (obj).egmock_called_##Method = false; \
- EXPECT_CALL(obj, egmock_##Method(__VA_ARGS__))
-
-/**
- * Waits for an earlier EXPECT_TIMEOUT_CALL to execute.
- *
- * It does not fully support special constraints of the EXPECT_CALL clause, just proceeds when the
- * first call to a given method comes. For example, in the following code:
- * EXPECT_TIMEOUT_CALL(account, charge, 100, _);
- * account.charge(50, Currency::USD);
- * EXPECT_TIMEOUT_CALL_WAIT(account, charge, 500ms);
- * the wait clause will just continue, as the charge method was called.
- *
- * @param obj object for a call
- * @param Method the method to wait for
- * @param timeout the maximum time for waiting
- */
-#define EXPECT_TIMEOUT_CALL_WAIT(obj, Method, timeout) \
- { \
- std::unique_lock<std::mutex> lk((obj).egmock_mut_##Method); \
- if (!(obj).egmock_called_##Method) { \
- auto status = (obj).egmock_cond_##Method.wait_for(lk, timeout); \
- EXPECT_EQ(std::cv_status::no_timeout, status); \
- } \
- }
-
-#endif // ANDROID_HARDWARE_BROADCASTRADIO_V1_1_MOCK_TIMEOUT