summaryrefslogtreecommitdiffstats
path: root/radio
diff options
context:
space:
mode:
authorXin Li <delphij@google.com>2019-08-23 06:45:16 +0000
committerXin Li <delphij@google.com>2019-08-23 06:45:16 +0000
commit68464fb5a0cf6e37eb8810f16fa8d6cc7ba6bb28 (patch)
treedcdb9dc881bd445be6713a3d0c8af32bc7ed6283 /radio
parentcdac17ba8a8c5e756c2379cb6d20729ea3f9282e (diff)
parent4dd458dab6c7a29fc5394fd20b1e7931a3caabec (diff)
downloadplatform_hardware_interfaces-68464fb5a0cf6e37eb8810f16fa8d6cc7ba6bb28.tar.gz
platform_hardware_interfaces-68464fb5a0cf6e37eb8810f16fa8d6cc7ba6bb28.tar.bz2
platform_hardware_interfaces-68464fb5a0cf6e37eb8810f16fa8d6cc7ba6bb28.zip
DO NOT MERGE - Merge build QP1A.190711.019 into stage-aosp-master
Bug: 139893257 Change-Id: I7e48b5477b2edda72c940e05531782dd28a2f784
Diffstat (limited to 'radio')
-rw-r--r--radio/1.2/vts/functional/Android.bp3
-rw-r--r--radio/1.2/vts/functional/radio_config_response.cpp59
-rw-r--r--radio/1.2/vts/functional/radio_hidl_hal_api.cpp9
-rw-r--r--radio/1.2/vts/functional/radio_hidl_hal_test.cpp66
-rw-r--r--radio/1.2/vts/functional/radio_hidl_hal_utils_v1_2.h58
5 files changed, 194 insertions, 1 deletions
diff --git a/radio/1.2/vts/functional/Android.bp b/radio/1.2/vts/functional/Android.bp
index 6782f143d0..c5838a8edb 100644
--- a/radio/1.2/vts/functional/Android.bp
+++ b/radio/1.2/vts/functional/Android.bp
@@ -20,6 +20,7 @@ cc_test {
srcs: [
"radio_hidl_hal_api.cpp",
"radio_hidl_hal_test.cpp",
+ "radio_config_response.cpp",
"radio_response.cpp",
"radio_indication.cpp",
"VtsHalRadioV1_2TargetTest.cpp",
@@ -29,6 +30,8 @@ cc_test {
"android.hardware.radio@1.2",
"android.hardware.radio@1.1",
"android.hardware.radio@1.0",
+ "android.hardware.radio.config@1.0",
+ "android.hardware.radio.config@1.1",
],
header_libs: ["radio.util.header@1.0"],
test_suites: ["general-tests"],
diff --git a/radio/1.2/vts/functional/radio_config_response.cpp b/radio/1.2/vts/functional/radio_config_response.cpp
new file mode 100644
index 0000000000..71b74979af
--- /dev/null
+++ b/radio/1.2/vts/functional/radio_config_response.cpp
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 2019 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_2.h>
+
+RadioConfigResponse::RadioConfigResponse(RadioHidlTest_v1_2& parent) : parent_v1_2(parent) {}
+
+Return<void> RadioConfigResponse::getSimSlotsStatusResponse(
+ const RadioResponseInfo& info,
+ const ::android::hardware::hidl_vec<SimSlotStatus>& slotStatus) {
+ rspInfo = info;
+ simSlotStatus = slotStatus;
+ parent_v1_2.notify(info.serial);
+ return Void();
+}
+
+Return<void> RadioConfigResponse::setSimSlotsMappingResponse(const RadioResponseInfo& /* info */) {
+ return Void();
+}
+
+Return<void> RadioConfigResponse::getPhoneCapabilityResponse(
+ const RadioResponseInfo& info, const PhoneCapability& phoneCapability) {
+ rspInfo = info;
+ phoneCap = phoneCapability;
+ parent_v1_2.notify(info.serial);
+ return Void();
+}
+
+Return<void> RadioConfigResponse::setPreferredDataModemResponse(const RadioResponseInfo& info) {
+ rspInfo = info;
+ parent_v1_2.notify(info.serial);
+ return Void();
+}
+
+Return<void> RadioConfigResponse::getModemsConfigResponse(const RadioResponseInfo& info,
+ const ModemsConfig& /* mConfig */) {
+ rspInfo = info;
+ parent_v1_2.notify(info.serial);
+ return Void();
+}
+
+Return<void> RadioConfigResponse::setModemsConfigResponse(const RadioResponseInfo& info) {
+ rspInfo = info;
+ parent_v1_2.notify(info.serial);
+ return Void();
+}
diff --git a/radio/1.2/vts/functional/radio_hidl_hal_api.cpp b/radio/1.2/vts/functional/radio_hidl_hal_api.cpp
index f11f0d8e9e..5184ef962c 100644
--- a/radio/1.2/vts/functional/radio_hidl_hal_api.cpp
+++ b/radio/1.2/vts/functional/radio_hidl_hal_api.cpp
@@ -34,6 +34,15 @@ const RadioAccessSpecifier GERAN_SPECIFIER_850 = {.radioAccessNetwork = RadioAcc
TEST_F(RadioHidlTest_v1_2, startNetworkScan) {
serial = GetRandomSerialNumber();
+ if (radioConfig != NULL && DDS_LOGICAL_SLOT_INDEX != logicalSlotId) {
+ // Some DSDS devices have a limitation that network scans can only be performed on the
+ // logical modem that currently used for packet data. For now, skip the test on the
+ // non-data SIM. This exemption is removed in HAL version 1.4. See b/135243177 for
+ // additional information.
+ ALOGI("Skip network scan on non-dds SIM, slot id = %d", logicalSlotId);
+ return;
+ }
+
::android::hardware::radio::V1_2::NetworkScanRequest request = {
.type = ScanType::ONE_SHOT,
.interval = 60,
diff --git a/radio/1.2/vts/functional/radio_hidl_hal_test.cpp b/radio/1.2/vts/functional/radio_hidl_hal_test.cpp
index bff7481bed..835d9b8d16 100644
--- a/radio/1.2/vts/functional/radio_hidl_hal_test.cpp
+++ b/radio/1.2/vts/functional/radio_hidl_hal_test.cpp
@@ -37,6 +37,7 @@ void RadioHidlTest_v1_2::SetUp() {
ASSERT_NE(nullptr, radioRsp_v1_2.get());
count_ = 0;
+ logicalSlotId = -1;
radioInd_v1_2 = new (std::nothrow) RadioIndication_v1_2(*this);
ASSERT_NE(nullptr, radioInd_v1_2.get());
@@ -50,6 +51,71 @@ void RadioHidlTest_v1_2::SetUp() {
/* Enforce Vts Testing with Sim Status Present only. */
EXPECT_EQ(CardState::PRESENT, cardStatus.base.cardState);
+
+ radioConfig = ::testing::VtsHalHidlTargetTestBase::getService<
+ ::android::hardware::radio::config::V1_1::IRadioConfig>();
+
+ /* Enforce Vts tesing with RadioConfig for network scan excemption. */
+ // Some devices can only perform network scan on logical modem that currently used for packet
+ // data. This exemption is removed in HAL version 1.4. See b/135243177 for additional info.
+ if (radioConfig != NULL) {
+ // RadioConfig 1.1 available, some devices fall in excepmtion category.
+ ASSERT_NE(nullptr, radioConfig.get());
+
+ radioConfigRsp = new (std::nothrow) RadioConfigResponse(*this);
+ ASSERT_NE(nullptr, radioConfigRsp.get());
+
+ /* Set radio config response functions */
+ radioConfig->setResponseFunctions(radioConfigRsp, nullptr);
+
+ /* set preferred data modem */
+ setPreferredDataModem();
+
+ /* get current logical sim id */
+ getLogicalSimId();
+ }
+}
+
+void RadioHidlTest_v1_2::getLogicalSimId() {
+ serial = GetRandomSerialNumber();
+ radioConfig->getSimSlotsStatus(serial);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioConfigRsp->rspInfo.type);
+ EXPECT_EQ(serial, radioConfigRsp->rspInfo.serial);
+
+ ASSERT_TRUE(CheckAnyOfErrors(radioConfigRsp->rspInfo.error,
+ {RadioError::NONE, RadioError::REQUEST_NOT_SUPPORTED}));
+
+ if (radioConfigRsp->rspInfo.error != RadioError ::NONE) {
+ ALOGI("Failed to get sim slot status, rspInfo.error = %s\n",
+ toString(radioConfigRsp->rspInfo.error).c_str());
+ return;
+ }
+
+ if (cardStatus.physicalSlotId < 0 ||
+ cardStatus.physicalSlotId >= radioConfigRsp->simSlotStatus.size()) {
+ ALOGI("Physical slot id: %d is out of range", cardStatus.physicalSlotId);
+ return;
+ }
+
+ logicalSlotId = radioConfigRsp->simSlotStatus[cardStatus.physicalSlotId].logicalSlotId;
+}
+
+/*
+ * Set preferred data modem
+ */
+void RadioHidlTest_v1_2::setPreferredDataModem() {
+ serial = GetRandomSerialNumber();
+ // Even for single sim device, the setPreferredDataModem should still success. Enforce dds on
+ // first logical modem.
+ radioConfig->setPreferredDataModem(serial, DDS_LOGICAL_SLOT_INDEX);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioConfigRsp->rspInfo.type);
+ EXPECT_EQ(serial, radioConfigRsp->rspInfo.serial);
+
+ ASSERT_TRUE(CheckAnyOfErrors(
+ radioConfigRsp->rspInfo.error,
+ {RadioError::NONE, RadioError::RADIO_NOT_AVAILABLE, RadioError::INTERNAL_ERR}));
}
/*
diff --git a/radio/1.2/vts/functional/radio_hidl_hal_utils_v1_2.h b/radio/1.2/vts/functional/radio_hidl_hal_utils_v1_2.h
index 3f780e555a..2db1cac724 100644
--- a/radio/1.2/vts/functional/radio_hidl_hal_utils_v1_2.h
+++ b/radio/1.2/vts/functional/radio_hidl_hal_utils_v1_2.h
@@ -22,6 +22,10 @@
#include <condition_variable>
#include <mutex>
+#include <android/hardware/radio/config/1.1/IRadioConfig.h>
+#include <android/hardware/radio/config/1.1/IRadioConfigResponse.h>
+#include <android/hardware/radio/config/1.1/types.h>
+
#include <android/hardware/radio/1.2/IRadio.h>
#include <android/hardware/radio/1.2/IRadioIndication.h>
#include <android/hardware/radio/1.2/IRadioResponse.h>
@@ -32,13 +36,17 @@
using namespace ::android::hardware::radio::V1_2;
using namespace ::android::hardware::radio::V1_1;
using namespace ::android::hardware::radio::V1_0;
+using namespace ::android::hardware::radio::config::V1_1;
+using ::android::sp;
using ::android::hardware::hidl_bitfield;
using ::android::hardware::hidl_string;
using ::android::hardware::hidl_vec;
using ::android::hardware::Return;
using ::android::hardware::Void;
-using ::android::sp;
+using ::android::hardware::radio::config::V1_0::SimSlotStatus;
+using ::android::hardware::radio::V1_0::RadioResponseInfo;
+using ::android::hardware::radio::V1_0::RadioResponseType;
#define TIMEOUT_PERIOD 75
#define RADIO_SERVICE_NAME "slot1"
@@ -46,6 +54,36 @@ using ::android::sp;
class RadioHidlTest_v1_2;
extern ::android::hardware::radio::V1_2::CardStatus cardStatus;
+/* Callback class for radio config response */
+class RadioConfigResponse : public IRadioConfigResponse {
+ protected:
+ RadioHidlTest_v1_2& parent_v1_2;
+
+ public:
+ RadioResponseInfo rspInfo;
+ PhoneCapability phoneCap;
+ hidl_vec<SimSlotStatus> simSlotStatus;
+
+ RadioConfigResponse(RadioHidlTest_v1_2& parent_v1_2);
+ virtual ~RadioConfigResponse() = default;
+
+ Return<void> getSimSlotsStatusResponse(
+ const RadioResponseInfo& info,
+ const ::android::hardware::hidl_vec<SimSlotStatus>& slotStatus);
+
+ Return<void> setSimSlotsMappingResponse(const RadioResponseInfo& info);
+
+ Return<void> getPhoneCapabilityResponse(const RadioResponseInfo& info,
+ const PhoneCapability& phoneCapability);
+
+ Return<void> setPreferredDataModemResponse(const RadioResponseInfo& info);
+
+ Return<void> getModemsConfigResponse(const RadioResponseInfo& info,
+ const ModemsConfig& mConfig);
+
+ Return<void> setModemsConfigResponse(const RadioResponseInfo& info);
+};
+
/* Callback class for radio response v1_2*/
class RadioResponse_v1_2 : public ::android::hardware::radio::V1_2::IRadioResponse {
protected:
@@ -616,15 +654,27 @@ class RadioHidlTest_v1_2 : public ::testing::VtsHalHidlTargetTestBase {
std::condition_variable cv_;
int count_;
+ /* Preferred data sim id */
+ const int DDS_LOGICAL_SLOT_INDEX = 0;
+
/* Serial number for radio request */
int serial;
+ /* Current logical slot id */
+ int logicalSlotId;
+
/* Update Sim Card Status */
void updateSimCardStatus();
/* Stop Network Scan Command */
void stopNetworkScan();
+ /* Set preferred data modem */
+ void setPreferredDataModem();
+
+ /* get current logical sim id */
+ void getLogicalSimId();
+
public:
virtual void SetUp() override;
@@ -642,4 +692,10 @@ class RadioHidlTest_v1_2 : public ::testing::VtsHalHidlTargetTestBase {
/* radio indication handle */
sp<RadioIndication_v1_2> radioInd_v1_2;
+
+ /* radio config response handle */
+ sp<RadioConfigResponse> radioConfigRsp;
+
+ /* radio config service handle */
+ sp<IRadioConfig> radioConfig;
}; \ No newline at end of file