Add a new vts directory under 1.1 for radio 1.1 APIs vts tests.
Bug: 38034125
Test: compile; adb shell compiled_vts_binary
Change-Id: I05d4f03db40ac712f120ac0e3e52301a6252f041
diff --git a/radio/1.0/vts/functional/Android.bp b/radio/1.0/vts/functional/Android.bp
index 5403971..8cd823e 100644
--- a/radio/1.0/vts/functional/Android.bp
+++ b/radio/1.0/vts/functional/Android.bp
@@ -70,3 +70,38 @@
"-g",
],
}
+
+cc_library_static {
+ name: "RadioHidlHalUtilsBase",
+ srcs : [
+ "radio_hidl_hal_test.cpp",
+ "radio_response.cpp"
+ ],
+ shared_libs: [
+ "libbase",
+ "liblog",
+ "libcutils",
+ "libhidlbase",
+ "libhidltransport",
+ "libnativehelper",
+ "libutils",
+ "android.hardware.radio@1.0",
+ ],
+ static_libs: ["VtsHalHidlTargetTestBase"],
+ cflags: [
+ "-O0",
+ "-g",
+ ],
+}
+
+cc_library_static {
+ name: "RadioVtsTestUtilBase",
+ srcs : [
+ "vts_test_util.cpp"
+ ],
+}
+
+cc_library_headers {
+ name: "radio.util.header@1.0",
+ export_include_dirs: ["."],
+}
\ No newline at end of file
diff --git a/radio/1.0/vts/functional/VtsHalRadioV1_0TargetTest.cpp b/radio/1.0/vts/functional/VtsHalRadioV1_0TargetTest.cpp
index 59881ef..3448494 100644
--- a/radio/1.0/vts/functional/VtsHalRadioV1_0TargetTest.cpp
+++ b/radio/1.0/vts/functional/VtsHalRadioV1_0TargetTest.cpp
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-#include <radio_hidl_hal_utils.h>
+#include <radio_hidl_hal_utils_v1_0.h>
int main(int argc, char** argv) {
::testing::AddGlobalTestEnvironment(new RadioHidlEnvironment);
diff --git a/radio/1.0/vts/functional/radio_hidl_hal_cell_broadcast.cpp b/radio/1.0/vts/functional/radio_hidl_hal_cell_broadcast.cpp
index 14d14d4..747b2f4 100644
--- a/radio/1.0/vts/functional/radio_hidl_hal_cell_broadcast.cpp
+++ b/radio/1.0/vts/functional/radio_hidl_hal_cell_broadcast.cpp
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-#include <radio_hidl_hal_utils.h>
+#include <radio_hidl_hal_utils_v1_0.h>
using namespace ::android::hardware::radio::V1_0;
diff --git a/radio/1.0/vts/functional/radio_hidl_hal_data.cpp b/radio/1.0/vts/functional/radio_hidl_hal_data.cpp
index 108676b..35d97ee 100644
--- a/radio/1.0/vts/functional/radio_hidl_hal_data.cpp
+++ b/radio/1.0/vts/functional/radio_hidl_hal_data.cpp
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-#include <radio_hidl_hal_utils.h>
+#include <radio_hidl_hal_utils_v1_0.h>
using namespace ::android::hardware::radio::V1_0;
diff --git a/radio/1.0/vts/functional/radio_hidl_hal_icc.cpp b/radio/1.0/vts/functional/radio_hidl_hal_icc.cpp
index 4841185..9e003e2 100644
--- a/radio/1.0/vts/functional/radio_hidl_hal_icc.cpp
+++ b/radio/1.0/vts/functional/radio_hidl_hal_icc.cpp
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-#include <radio_hidl_hal_utils.h>
+#include <radio_hidl_hal_utils_v1_0.h>
/*
* Test IRadio.getIccCardStatus() for the response returned.
diff --git a/radio/1.0/vts/functional/radio_hidl_hal_ims.cpp b/radio/1.0/vts/functional/radio_hidl_hal_ims.cpp
index 16465c7..c1834c5 100644
--- a/radio/1.0/vts/functional/radio_hidl_hal_ims.cpp
+++ b/radio/1.0/vts/functional/radio_hidl_hal_ims.cpp
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-#include <radio_hidl_hal_utils.h>
+#include <radio_hidl_hal_utils_v1_0.h>
using namespace ::android::hardware::radio::V1_0;
diff --git a/radio/1.0/vts/functional/radio_hidl_hal_misc.cpp b/radio/1.0/vts/functional/radio_hidl_hal_misc.cpp
index 69da6b2..98bb4e9 100644
--- a/radio/1.0/vts/functional/radio_hidl_hal_misc.cpp
+++ b/radio/1.0/vts/functional/radio_hidl_hal_misc.cpp
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-#include <radio_hidl_hal_utils.h>
+#include <radio_hidl_hal_utils_v1_0.h>
/*
* Test IRadio.getSignalStrength() for the response returned.
diff --git a/radio/1.0/vts/functional/radio_hidl_hal_sms.cpp b/radio/1.0/vts/functional/radio_hidl_hal_sms.cpp
index 9aa7663..271a23a 100644
--- a/radio/1.0/vts/functional/radio_hidl_hal_sms.cpp
+++ b/radio/1.0/vts/functional/radio_hidl_hal_sms.cpp
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-#include <radio_hidl_hal_utils.h>
+#include <radio_hidl_hal_utils_v1_0.h>
using namespace ::android::hardware::radio::V1_0;
diff --git a/radio/1.0/vts/functional/radio_hidl_hal_stk.cpp b/radio/1.0/vts/functional/radio_hidl_hal_stk.cpp
index 6ff0330..27a294e 100644
--- a/radio/1.0/vts/functional/radio_hidl_hal_stk.cpp
+++ b/radio/1.0/vts/functional/radio_hidl_hal_stk.cpp
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-#include <radio_hidl_hal_utils.h>
+#include <radio_hidl_hal_utils_v1_0.h>
using namespace ::android::hardware::radio::V1_0;
diff --git a/radio/1.0/vts/functional/radio_hidl_hal_test.cpp b/radio/1.0/vts/functional/radio_hidl_hal_test.cpp
index b957c6e..2fa2827 100644
--- a/radio/1.0/vts/functional/radio_hidl_hal_test.cpp
+++ b/radio/1.0/vts/functional/radio_hidl_hal_test.cpp
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-#include <radio_hidl_hal_utils.h>
+#include <radio_hidl_hal_utils_v1_0.h>
void RadioHidlTest::SetUp() {
radio =
diff --git a/radio/1.0/vts/functional/radio_hidl_hal_utils.h b/radio/1.0/vts/functional/radio_hidl_hal_utils_v1_0.h
similarity index 99%
rename from radio/1.0/vts/functional/radio_hidl_hal_utils.h
rename to radio/1.0/vts/functional/radio_hidl_hal_utils_v1_0.h
index a0d7f70..c126da4 100644
--- a/radio/1.0/vts/functional/radio_hidl_hal_utils.h
+++ b/radio/1.0/vts/functional/radio_hidl_hal_utils_v1_0.h
@@ -26,7 +26,7 @@
#include <android/hardware/radio/1.0/IRadioResponse.h>
#include <android/hardware/radio/1.0/types.h>
-#include <vts_test_util.h>
+#include "vts_test_util.h"
using ::android::hardware::radio::V1_0::ActivityStatsInfo;
using ::android::hardware::radio::V1_0::AppType;
@@ -90,7 +90,7 @@
/* Callback class for radio response */
class RadioResponse : public IRadioResponse {
- private:
+ protected:
RadioHidlTest& parent;
public:
@@ -442,7 +442,7 @@
// The main test class for Radio HIDL.
class RadioHidlTest : public ::testing::VtsHalHidlTargetTestBase {
- private:
+ protected:
std::mutex mtx;
std::condition_variable cv;
int count;
diff --git a/radio/1.0/vts/functional/radio_hidl_hal_voice.cpp b/radio/1.0/vts/functional/radio_hidl_hal_voice.cpp
index 8fe04fd..14ac916 100644
--- a/radio/1.0/vts/functional/radio_hidl_hal_voice.cpp
+++ b/radio/1.0/vts/functional/radio_hidl_hal_voice.cpp
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-#include <radio_hidl_hal_utils.h>
+#include <radio_hidl_hal_utils_v1_0.h>
/*
* Test IRadio.getCurrentCalls() for the response returned.
diff --git a/radio/1.0/vts/functional/radio_response.cpp b/radio/1.0/vts/functional/radio_response.cpp
index ef887eb..434d488 100644
--- a/radio/1.0/vts/functional/radio_response.cpp
+++ b/radio/1.0/vts/functional/radio_response.cpp
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-#include <radio_hidl_hal_utils.h>
+#include <radio_hidl_hal_utils_v1_0.h>
CardStatus cardStatus;
diff --git a/radio/1.0/vts/functional/sap_hidl_hal_utils.h b/radio/1.0/vts/functional/sap_hidl_hal_utils.h
index fe93a4d..7126b06 100644
--- a/radio/1.0/vts/functional/sap_hidl_hal_utils.h
+++ b/radio/1.0/vts/functional/sap_hidl_hal_utils.h
@@ -25,7 +25,7 @@
#include <android/hardware/radio/1.0/ISapCallback.h>
#include <android/hardware/radio/1.0/types.h>
-#include <vts_test_util.h>
+#include "vts_test_util.h"
using namespace ::android::hardware::radio::V1_0;
diff --git a/radio/1.1/vts/functional/Android.bp b/radio/1.1/vts/functional/Android.bp
new file mode 100644
index 0000000..14a2544
--- /dev/null
+++ b/radio/1.1/vts/functional/Android.bp
@@ -0,0 +1,45 @@
+//
+// 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: "VtsHalRadioV1_1TargetTest",
+ defaults: ["hidl_defaults"],
+ srcs: ["radio_hidl_hal_api.cpp",
+ "radio_hidl_hal_test.cpp",
+ "radio_response.cpp",
+ "VtsHalRadioV1_1TargetTest.cpp"],
+ shared_libs: [
+ "libbase",
+ "liblog",
+ "libcutils",
+ "libhidlbase",
+ "libhidltransport",
+ "libnativehelper",
+ "libutils",
+ "android.hardware.radio@1.1",
+ "android.hardware.radio@1.0",
+ ],
+ static_libs: ["VtsHalHidlTargetTestBase",
+ "RadioHidlHalUtilsBase",
+ "RadioVtsTestUtilBase"],
+ header_libs: [
+ "radio.util.header@1.0",
+ ],
+ cflags: [
+ "-O0",
+ "-g",
+ ],
+}
diff --git a/radio/1.1/vts/functional/VtsHalRadioV1_1TargetTest.cpp b/radio/1.1/vts/functional/VtsHalRadioV1_1TargetTest.cpp
new file mode 100644
index 0000000..09351c8
--- /dev/null
+++ b/radio/1.1/vts/functional/VtsHalRadioV1_1TargetTest.cpp
@@ -0,0 +1,27 @@
+/*
+ * 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 <radio_hidl_hal_utils_v1_1.h>
+
+int main(int argc, char** argv) {
+ ::testing::AddGlobalTestEnvironment(new RadioHidlEnvironment);
+ ::testing::InitGoogleTest(&argc, argv);
+
+ int status = RUN_ALL_TESTS();
+ LOG(INFO) << "Test result = " << status;
+
+ return status;
+}
\ No newline at end of file
diff --git a/radio/1.1/vts/functional/radio_hidl_hal_api.cpp b/radio/1.1/vts/functional/radio_hidl_hal_api.cpp
new file mode 100644
index 0000000..666a317
--- /dev/null
+++ b/radio/1.1/vts/functional/radio_hidl_hal_api.cpp
@@ -0,0 +1,36 @@
+/*
+ * 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 <radio_hidl_hal_utils_v1_1.h>
+
+/*
+ * Test IRadio.setSimCardPower() for the response returned.
+ */
+TEST_F(RadioHidlTest_v1_1, setSimCardPower_1_1) {
+ int serial = GetRandomSerialNumber();
+
+ radio_v1_1->setSimCardPower_1_1(serial, CardPowerState::POWER_DOWN);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_v1_1->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_v1_1->rspInfo.serial);
+
+ if (cardStatus.cardState == CardState::ABSENT) {
+ ASSERT_TRUE(radioRsp_v1_1->rspInfo.error == RadioError::NONE ||
+ radioRsp_v1_1->rspInfo.error == RadioError::REQUEST_NOT_SUPPORTED ||
+ radioRsp_v1_1->rspInfo.error == RadioError::INVALID_ARGUMENTS ||
+ radioRsp_v1_1->rspInfo.error == RadioError::RADIO_NOT_AVAILABLE);
+ }
+}
\ No newline at end of file
diff --git a/radio/1.1/vts/functional/radio_hidl_hal_test.cpp b/radio/1.1/vts/functional/radio_hidl_hal_test.cpp
new file mode 100644
index 0000000..164128b
--- /dev/null
+++ b/radio/1.1/vts/functional/radio_hidl_hal_test.cpp
@@ -0,0 +1,39 @@
+/*
+ * 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 <radio_hidl_hal_utils_v1_1.h>
+
+void RadioHidlTest_v1_1::SetUp() {
+ radio_v1_1 =
+ ::testing::VtsHalHidlTargetTestBase::getService<::android::hardware::radio::V1_1::IRadio>(
+ hidl_string(RADIO_SERVICE_NAME));
+ ASSERT_NE(radio_v1_1, nullptr);
+
+ radioRsp_v1_1 = new RadioResponse_v1_1(*this);
+ ASSERT_NE(radioRsp_v1_1, nullptr);
+
+ count = 0;
+
+ radioInd_v1_1 = NULL;
+ radio_v1_1->setResponseFunctions(radioRsp_v1_1, radioInd_v1_1);
+
+ int serial = GetRandomSerialNumber();
+ radio_v1_1->getIccCardStatus(serial);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_v1_1->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_v1_1->rspInfo.serial);
+ EXPECT_EQ(RadioError::NONE, radioRsp_v1_1->rspInfo.error);
+}
\ No newline at end of file
diff --git a/radio/1.1/vts/functional/radio_hidl_hal_utils_v1_1.h b/radio/1.1/vts/functional/radio_hidl_hal_utils_v1_1.h
new file mode 100644
index 0000000..ae72d8f
--- /dev/null
+++ b/radio/1.1/vts/functional/radio_hidl_hal_utils_v1_1.h
@@ -0,0 +1,54 @@
+/*
+ * 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 <android/hardware/radio/1.1/IRadio.h>
+#include <android/hardware/radio/1.1/IRadioIndication.h>
+#include <android/hardware/radio/1.1/IRadioResponse.h>
+#include <android/hardware/radio/1.1/types.h>
+
+#include "radio_hidl_hal_utils_v1_0.h"
+
+using namespace ::android::hardware::radio::V1_1;
+
+class RadioHidlTest_v1_1;
+
+/* Callback class for radio response v1_1*/
+class RadioResponse_v1_1 : public RadioResponse {
+ protected:
+ RadioHidlTest_v1_1& parent_v1_1;
+
+ public:
+ RadioResponse_v1_1(RadioHidlTest_v1_1& parent_v1_1);
+ virtual ~RadioResponse_v1_1() = default;
+
+ /* 1.1 Api */
+ Return<void> setCarrierInfoForImsiEncryptionResponse(const RadioResponseInfo& info);
+
+ Return<void> setSimCardPowerResponse_1_1(const RadioResponseInfo& info);
+
+ Return<void> startNetworkScanResponse(const RadioResponseInfo& info);
+
+ Return<void> stopNetworkScanResponse(const RadioResponseInfo& info);
+};
+
+// The main test class for Radio HIDL.
+class RadioHidlTest_v1_1 : public RadioHidlTest {
+ public:
+ virtual void SetUp() override;
+ sp<::android::hardware::radio::V1_1::IRadio> radio_v1_1;
+ sp<RadioResponse_v1_1> radioRsp_v1_1;
+ sp<::android::hardware::radio::V1_1::IRadioIndication> radioInd_v1_1;
+};
\ No newline at end of file
diff --git a/radio/1.1/vts/functional/radio_response.cpp b/radio/1.1/vts/functional/radio_response.cpp
new file mode 100644
index 0000000..c5c8fd7
--- /dev/null
+++ b/radio/1.1/vts/functional/radio_response.cpp
@@ -0,0 +1,40 @@
+/*
+ * 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 <radio_hidl_hal_utils_v1_1.h>
+
+RadioResponse_v1_1::RadioResponse_v1_1(RadioHidlTest_v1_1& parent)
+ : RadioResponse(parent), parent_v1_1(parent) {}
+
+/* 1.1 Apis */
+Return<void> RadioResponse_v1_1::setCarrierInfoForImsiEncryptionResponse(
+ const RadioResponseInfo& /*info*/) {
+ return Void();
+}
+
+Return<void> RadioResponse_v1_1::setSimCardPowerResponse_1_1(const RadioResponseInfo& info) {
+ rspInfo = info;
+ parent_v1_1.notify();
+ return Void();
+}
+
+Return<void> RadioResponse_v1_1::startNetworkScanResponse(const RadioResponseInfo& /*info*/) {
+ return Void();
+}
+
+Return<void> RadioResponse_v1_1::stopNetworkScanResponse(const RadioResponseInfo& /*info*/) {
+ return Void();
+}
\ No newline at end of file
diff --git a/radio/Android.bp b/radio/Android.bp
index dbeca0c..0acb2ee 100644
--- a/radio/Android.bp
+++ b/radio/Android.bp
@@ -3,5 +3,6 @@
"1.0",
"1.0/vts/functional",
"1.1",
+ "1.1/vts/functional",
"deprecated/1.0",
]