Merge "Add non-dds check for startNetworkScan" into qt-dev
This commit is contained in:
commit
53861e16c3
5 changed files with 194 additions and 1 deletions
|
@ -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"],
|
||||
|
|
59
radio/1.2/vts/functional/radio_config_response.cpp
Normal file
59
radio/1.2/vts/functional/radio_config_response.cpp
Normal file
|
@ -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();
|
||||
}
|
|
@ -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,
|
||||
|
|
|
@ -36,6 +36,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());
|
||||
|
@ -49,6 +50,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}));
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -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;
|
||||
};
|
Loading…
Reference in a new issue