Merge "Revert "VTS for IRadio AIDL"" am: 3a16f8fe50
am: d67460a55e
am: 554a0176d7
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/1932964 Change-Id: I9c559bc2d08794442fd2120b590bd80ea86d79bb
This commit is contained in:
commit
eec3b8b8e6
28 changed files with 0 additions and 4055 deletions
|
@ -1,71 +0,0 @@
|
|||
// Copyright 2021 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 {
|
||||
// See: http://go/android-license-faq
|
||||
// A large-scale-change added 'default_applicable_licenses' to import
|
||||
// all of the 'license_kinds' from "hardware_interfaces_license"
|
||||
// to get the below license kinds:
|
||||
// SPDX-license-identifier-Apache-2.0
|
||||
default_applicable_licenses: ["hardware_interfaces_license"],
|
||||
}
|
||||
|
||||
cc_test {
|
||||
name: "VtsHalRadioTargetTest",
|
||||
defaults: [
|
||||
"VtsHalTargetTestDefaults",
|
||||
"use_libaidlvintf_gtest_helper_static",
|
||||
],
|
||||
srcs: [
|
||||
"radio_aidl_hal_utils.cpp",
|
||||
"radio_data_indication.cpp",
|
||||
"radio_data_response.cpp",
|
||||
"radio_data_test.cpp",
|
||||
"radio_messaging_indication.cpp",
|
||||
"radio_messaging_response.cpp",
|
||||
"radio_messaging_test.cpp",
|
||||
"radio_modem_indication.cpp",
|
||||
"radio_modem_response.cpp",
|
||||
"radio_modem_test.cpp",
|
||||
"radio_network_indication.cpp",
|
||||
"radio_network_response.cpp",
|
||||
"radio_network_test.cpp",
|
||||
"radio_sim_indication.cpp",
|
||||
"radio_sim_response.cpp",
|
||||
"radio_sim_test.cpp",
|
||||
"radio_voice_indication.cpp",
|
||||
"radio_voice_response.cpp",
|
||||
"radio_voice_test.cpp",
|
||||
"VtsHalRadioTargetTest.cpp",
|
||||
],
|
||||
shared_libs: [
|
||||
"libbinder_ndk",
|
||||
"libvintf",
|
||||
],
|
||||
static_libs: [
|
||||
"android.hardware.radio-V1-ndk",
|
||||
"android.hardware.radio.config-V1-ndk",
|
||||
"android.hardware.radio.data-V1-ndk",
|
||||
"android.hardware.radio.messaging-V1-ndk",
|
||||
"android.hardware.radio.modem-V1-ndk",
|
||||
"android.hardware.radio.network-V1-ndk",
|
||||
"android.hardware.radio.sim-V1-ndk",
|
||||
"android.hardware.radio.voice-V1-ndk",
|
||||
],
|
||||
// TODO(b/210712359): enable after b/207695009 is resolved.
|
||||
//test_suites: [
|
||||
// "general-tests",
|
||||
// "vts",
|
||||
//],
|
||||
}
|
|
@ -1,66 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2021 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/binder_process.h>
|
||||
|
||||
#include "radio_data_utils.h"
|
||||
#include "radio_messaging_utils.h"
|
||||
#include "radio_modem_utils.h"
|
||||
#include "radio_network_utils.h"
|
||||
#include "radio_sim_utils.h"
|
||||
#include "radio_voice_utils.h"
|
||||
|
||||
GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(RadioDataTest);
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
PerInstance, RadioDataTest,
|
||||
testing::ValuesIn(android::getAidlHalInstanceNames(IRadioData::descriptor)),
|
||||
android::PrintInstanceNameToString);
|
||||
|
||||
GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(RadioMessagingTest);
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
PerInstance, RadioMessagingTest,
|
||||
testing::ValuesIn(android::getAidlHalInstanceNames(IRadioMessaging::descriptor)),
|
||||
android::PrintInstanceNameToString);
|
||||
|
||||
GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(RadioModemTest);
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
PerInstance, RadioModemTest,
|
||||
testing::ValuesIn(android::getAidlHalInstanceNames(IRadioModem::descriptor)),
|
||||
android::PrintInstanceNameToString);
|
||||
|
||||
GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(RadioNetworkTest);
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
PerInstance, RadioNetworkTest,
|
||||
testing::ValuesIn(android::getAidlHalInstanceNames(IRadioNetwork::descriptor)),
|
||||
android::PrintInstanceNameToString);
|
||||
|
||||
GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(RadioSimTest);
|
||||
INSTANTIATE_TEST_SUITE_P(PerInstance, RadioSimTest,
|
||||
testing::ValuesIn(android::getAidlHalInstanceNames(IRadioSim::descriptor)),
|
||||
android::PrintInstanceNameToString);
|
||||
|
||||
GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(RadioVoiceTest);
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
PerInstance, RadioVoiceTest,
|
||||
testing::ValuesIn(android::getAidlHalInstanceNames(IRadioVoice::descriptor)),
|
||||
android::PrintInstanceNameToString);
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
::testing::InitGoogleTest(&argc, argv);
|
||||
ABinderProcess_setThreadPoolMaxThreadCount(1);
|
||||
ABinderProcess_startThreadPool();
|
||||
return RUN_ALL_TESTS();
|
||||
}
|
|
@ -1,176 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2021 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.
|
||||
*/
|
||||
#define LOG_TAG "RadioTest"
|
||||
|
||||
#include "radio_aidl_hal_utils.h"
|
||||
#include <iostream>
|
||||
#include "VtsCoreUtil.h"
|
||||
|
||||
using namespace aidl::android::hardware::radio::network;
|
||||
|
||||
#define WAIT_TIMEOUT_PERIOD 75
|
||||
|
||||
aidl::android::hardware::radio::sim::CardStatus cardStatus = {};
|
||||
|
||||
int GetRandomSerialNumber() {
|
||||
return rand();
|
||||
}
|
||||
|
||||
::testing::AssertionResult CheckAnyOfErrors(RadioError err, std::vector<RadioError> errors,
|
||||
CheckFlag flag) {
|
||||
const static std::vector<RadioError> generalErrors = {
|
||||
RadioError::RADIO_NOT_AVAILABLE, RadioError::NO_MEMORY,
|
||||
RadioError::INTERNAL_ERR, RadioError::SYSTEM_ERR,
|
||||
RadioError::REQUEST_NOT_SUPPORTED, RadioError::CANCELLED};
|
||||
if (flag == CHECK_GENERAL_ERROR || flag == CHECK_OEM_AND_GENERAL_ERROR) {
|
||||
for (size_t i = 0; i < generalErrors.size(); i++) {
|
||||
if (err == generalErrors[i]) {
|
||||
return testing::AssertionSuccess();
|
||||
}
|
||||
}
|
||||
}
|
||||
if (flag == CHECK_OEM_ERROR || flag == CHECK_OEM_AND_GENERAL_ERROR) {
|
||||
if (err >= RadioError::OEM_ERROR_1 && err <= RadioError::OEM_ERROR_25) {
|
||||
return testing::AssertionSuccess();
|
||||
}
|
||||
}
|
||||
for (size_t i = 0; i < errors.size(); i++) {
|
||||
if (err == errors[i]) {
|
||||
return testing::AssertionSuccess();
|
||||
}
|
||||
}
|
||||
return testing::AssertionFailure() << "RadioError:" + toString(err) + " is returned";
|
||||
}
|
||||
|
||||
// Runs "pm list features" and attempts to find the specified feature in its output.
|
||||
bool deviceSupportsFeature(const char* feature) {
|
||||
bool hasFeature = false;
|
||||
FILE* p = popen("/system/bin/pm list features", "re");
|
||||
if (p) {
|
||||
char* line = NULL;
|
||||
size_t len = 0;
|
||||
while (getline(&line, &len, p) > 0) {
|
||||
if (strstr(line, feature)) {
|
||||
hasFeature = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
pclose(p);
|
||||
} else {
|
||||
__android_log_print(ANDROID_LOG_FATAL, LOG_TAG, "popen failed: %d", errno);
|
||||
_exit(EXIT_FAILURE);
|
||||
}
|
||||
__android_log_print(ANDROID_LOG_INFO, LOG_TAG, "Feature %s: %ssupported", feature,
|
||||
hasFeature ? "" : "not ");
|
||||
return hasFeature;
|
||||
}
|
||||
|
||||
bool isSsSsEnabled() {
|
||||
// Do not use checkSubstringInCommandOutput("getprop persist.radio.multisim.config", "")
|
||||
// until b/148904287 is fixed. We need exact matching instead of partial matching. (i.e.
|
||||
// by definition the empty string "" is a substring of any string).
|
||||
return !isDsDsEnabled() && !isTsTsEnabled();
|
||||
}
|
||||
|
||||
bool isDsDsEnabled() {
|
||||
return testing::checkSubstringInCommandOutput("getprop persist.radio.multisim.config", "dsds");
|
||||
}
|
||||
|
||||
bool isTsTsEnabled() {
|
||||
return testing::checkSubstringInCommandOutput("getprop persist.radio.multisim.config", "tsts");
|
||||
}
|
||||
|
||||
bool isVoiceInService(RegState state) {
|
||||
return RegState::REG_HOME == state || RegState::REG_ROAMING == state;
|
||||
}
|
||||
|
||||
bool isVoiceEmergencyOnly(RegState state) {
|
||||
return RegState::NOT_REG_MT_NOT_SEARCHING_OP_EM == state ||
|
||||
RegState::NOT_REG_MT_SEARCHING_OP_EM == state || RegState::REG_DENIED_EM == state ||
|
||||
RegState::UNKNOWN_EM == state;
|
||||
}
|
||||
|
||||
bool isServiceValidForDeviceConfiguration(std::string& serviceName) {
|
||||
if (isSsSsEnabled()) {
|
||||
// Device is configured as SSSS.
|
||||
if (serviceName != RADIO_SERVICE_SLOT1_NAME) {
|
||||
ALOGI("%s instance is not valid for SSSS device.", serviceName.c_str());
|
||||
return false;
|
||||
}
|
||||
} else if (isDsDsEnabled()) {
|
||||
// Device is configured as DSDS.
|
||||
if (serviceName != RADIO_SERVICE_SLOT1_NAME && serviceName != RADIO_SERVICE_SLOT2_NAME) {
|
||||
ALOGI("%s instance is not valid for DSDS device.", serviceName.c_str());
|
||||
return false;
|
||||
}
|
||||
} else if (isTsTsEnabled()) {
|
||||
// Device is configured as TSTS.
|
||||
if (serviceName != RADIO_SERVICE_SLOT1_NAME && serviceName != RADIO_SERVICE_SLOT2_NAME &&
|
||||
serviceName != RADIO_SERVICE_SLOT3_NAME) {
|
||||
ALOGI("%s instance is not valid for TSTS device.", serviceName.c_str());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
* Notify that the response message is received.
|
||||
*/
|
||||
void RadioResponseWaiter::notify(int receivedSerial) {
|
||||
std::unique_lock<std::mutex> lock(mtx_);
|
||||
if (serial == receivedSerial) {
|
||||
count_++;
|
||||
cv_.notify_one();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Wait till the response message is notified or till WAIT_TIMEOUT_PERIOD.
|
||||
*/
|
||||
std::cv_status RadioResponseWaiter::wait() {
|
||||
std::unique_lock<std::mutex> lock(mtx_);
|
||||
std::cv_status status = std::cv_status::no_timeout;
|
||||
auto now = std::chrono::system_clock::now();
|
||||
while (count_ == 0) {
|
||||
status = cv_.wait_until(lock, now + std::chrono::seconds(WAIT_TIMEOUT_PERIOD));
|
||||
if (status == std::cv_status::timeout) {
|
||||
return status;
|
||||
}
|
||||
}
|
||||
count_--;
|
||||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
* Specific features on the Radio HAL rely on Radio HAL Capabilities.
|
||||
* The VTS test related to those features must not run if the related capability is disabled.
|
||||
* Typical usage within VTS: if (getRadioHalCapabilities()) return;
|
||||
*/
|
||||
bool RadioResponseWaiter::getRadioHalCapabilities() {
|
||||
// TODO(b/210712359): implement after RadioConfig VTS is created
|
||||
/**
|
||||
// Get HalDeviceCapabilities from the radio config
|
||||
std::shared_ptr<RadioConfigResponse> radioConfigRsp = new (std::nothrow)
|
||||
RadioConfigResponse(*this); radioConfig->setResponseFunctions(radioConfigRsp, nullptr); serial =
|
||||
GetRandomSerialNumber();
|
||||
|
||||
radioConfig->getHalDeviceCapabilities(serial);
|
||||
EXPECT_EQ(std::cv_status::no_timeout, wait());
|
||||
return radioConfigRsp->modemReducedFeatureSet1;
|
||||
**/
|
||||
return true;
|
||||
}
|
|
@ -1,140 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2021 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.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <aidl/Gtest.h>
|
||||
#include <aidl/Vintf.h>
|
||||
#include <aidl/android/hardware/radio/RadioError.h>
|
||||
#include <aidl/android/hardware/radio/network/RegState.h>
|
||||
#include <aidl/android/hardware/radio/sim/CardStatus.h>
|
||||
#include <utils/Log.h>
|
||||
#include <vector>
|
||||
|
||||
using namespace aidl::android::hardware::radio;
|
||||
using aidl::android::hardware::radio::sim::CardStatus;
|
||||
|
||||
extern CardStatus cardStatus;
|
||||
|
||||
/*
|
||||
* MACRO used to skip test case when radio response return error REQUEST_NOT_SUPPORTED
|
||||
* on HAL versions which has deprecated the request interfaces. The MACRO can only be used
|
||||
* AFTER receiving radio response.
|
||||
*/
|
||||
#define SKIP_TEST_IF_REQUEST_NOT_SUPPORTED_WITH_HAL(__ver__, __radio__, __radioRsp__) \
|
||||
do { \
|
||||
sp<::android::hardware::radio::V##__ver__::IRadio> __radio = \
|
||||
::android::hardware::radio::V##__ver__::IRadio::castFrom(__radio__); \
|
||||
if (__radio && __radioRsp__->rspInfo.error == RadioError::REQUEST_NOT_SUPPORTED) { \
|
||||
GTEST_SKIP() << "REQUEST_NOT_SUPPORTED"; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
enum CheckFlag {
|
||||
CHECK_DEFAULT = 0,
|
||||
CHECK_GENERAL_ERROR = 1,
|
||||
CHECK_OEM_ERROR = 2,
|
||||
CHECK_OEM_AND_GENERAL_ERROR = 3,
|
||||
CHECK_SAP_ERROR = 4,
|
||||
};
|
||||
|
||||
static constexpr const char* FEATURE_VOICE_CALL = "android.software.connectionservice";
|
||||
|
||||
static constexpr const char* FEATURE_TELEPHONY = "android.hardware.telephony";
|
||||
|
||||
static constexpr const char* FEATURE_TELEPHONY_GSM = "android.hardware.telephony.gsm";
|
||||
|
||||
static constexpr const char* FEATURE_TELEPHONY_CDMA = "android.hardware.telephony.cdma";
|
||||
|
||||
#define MODEM_EMERGENCY_CALL_ESTABLISH_TIME 3
|
||||
#define MODEM_EMERGENCY_CALL_DISCONNECT_TIME 3
|
||||
#define MODEM_SET_SIM_POWER_DELAY_IN_SECONDS 2
|
||||
|
||||
#define RADIO_SERVICE_SLOT1_NAME "slot1" // HAL instance name for SIM slot 1 or single SIM device
|
||||
#define RADIO_SERVICE_SLOT2_NAME "slot2" // HAL instance name for SIM slot 2 on dual SIM device
|
||||
#define RADIO_SERVICE_SLOT3_NAME "slot3" // HAL instance name for SIM slot 3 on triple SIM device
|
||||
|
||||
/*
|
||||
* Generate random serial number for radio test
|
||||
*/
|
||||
int GetRandomSerialNumber();
|
||||
|
||||
/*
|
||||
* Check multiple radio error codes which are possibly returned because of the different
|
||||
* vendor/devices implementations. It allows optional checks for general errors or/and oem errors.
|
||||
*/
|
||||
::testing::AssertionResult CheckAnyOfErrors(RadioError err, std::vector<RadioError> generalError,
|
||||
CheckFlag flag = CHECK_DEFAULT);
|
||||
|
||||
/*
|
||||
* Check if device supports feature.
|
||||
*/
|
||||
bool deviceSupportsFeature(const char* feature);
|
||||
|
||||
/*
|
||||
* Check if device is in SsSs (Single SIM Single Standby).
|
||||
*/
|
||||
bool isSsSsEnabled();
|
||||
|
||||
/*
|
||||
* Check if device is in DSDS (Dual SIM Dual Standby).
|
||||
*/
|
||||
bool isDsDsEnabled();
|
||||
|
||||
/*
|
||||
* Check if device is in TSTS (Triple SIM Triple Standby).
|
||||
*/
|
||||
bool isTsTsEnabled();
|
||||
|
||||
/*
|
||||
* Check if voice status is in emergency only.
|
||||
*/
|
||||
bool isVoiceEmergencyOnly(aidl::android::hardware::radio::network::RegState state);
|
||||
|
||||
/*
|
||||
* Check if voice status is in service.
|
||||
*/
|
||||
bool isVoiceInService(aidl::android::hardware::radio::network::RegState state);
|
||||
|
||||
/*
|
||||
* Check if service is valid for device configuration
|
||||
*/
|
||||
bool isServiceValidForDeviceConfiguration(std::string& serviceName);
|
||||
|
||||
/**
|
||||
* Used when waiting for an asynchronous response from the HAL.
|
||||
*/
|
||||
class RadioResponseWaiter {
|
||||
protected:
|
||||
std::mutex mtx_;
|
||||
std::condition_variable cv_;
|
||||
int count_;
|
||||
|
||||
public:
|
||||
/* Serial number for radio request */
|
||||
int serial;
|
||||
|
||||
/* Used as a mechanism to inform the test about data/event callback */
|
||||
void notify(int receivedSerial);
|
||||
|
||||
/* Test code calls this function to wait for response */
|
||||
std::cv_status wait();
|
||||
|
||||
// TODO(b/210712359): this probably isn't the best place to put this, but it works for now
|
||||
// since all RadioXTest extend RadioResponseWaiter
|
||||
/* Used to get the radio HAL capabilities */
|
||||
bool getRadioHalCapabilities();
|
||||
};
|
|
@ -1,39 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2021 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_data_utils.h"
|
||||
|
||||
RadioDataIndication::RadioDataIndication(RadioDataTest& parent) : parent_data(parent) {}
|
||||
|
||||
ndk::ScopedAStatus RadioDataIndication::dataCallListChanged(
|
||||
RadioIndicationType /*type*/, const std::vector<SetupDataCallResult>& /*dcList*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioDataIndication::keepaliveStatus(RadioIndicationType /*type*/,
|
||||
const KeepaliveStatus& /*status*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioDataIndication::pcoData(RadioIndicationType /*type*/,
|
||||
const PcoDataInfo& /*pco*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioDataIndication::unthrottleApn(RadioIndicationType /*type*/,
|
||||
const DataProfileInfo& /*dataProfileInfo*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
|
@ -1,104 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2021 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_data_utils.h"
|
||||
|
||||
RadioDataResponse::RadioDataResponse(RadioResponseWaiter& parent) : parent_data(parent) {}
|
||||
|
||||
ndk::ScopedAStatus RadioDataResponse::acknowledgeRequest(int32_t /*serial*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioDataResponse::allocatePduSessionIdResponse(const RadioResponseInfo& info,
|
||||
int32_t id) {
|
||||
rspInfo = info;
|
||||
allocatedPduSessionId = id;
|
||||
parent_data.notify(info.serial);
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioDataResponse::cancelHandoverResponse(const RadioResponseInfo& info) {
|
||||
rspInfo = info;
|
||||
parent_data.notify(info.serial);
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioDataResponse::deactivateDataCallResponse(
|
||||
const RadioResponseInfo& /*info*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioDataResponse::getDataCallListResponse(
|
||||
const RadioResponseInfo& info, const std::vector<SetupDataCallResult>& /*dcResponse*/) {
|
||||
rspInfo = info;
|
||||
parent_data.notify(info.serial);
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioDataResponse::getSlicingConfigResponse(
|
||||
const RadioResponseInfo& info, const SlicingConfig& /*slicingConfig*/) {
|
||||
rspInfo = info;
|
||||
parent_data.notify(info.serial);
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioDataResponse::releasePduSessionIdResponse(const RadioResponseInfo& info) {
|
||||
rspInfo = info;
|
||||
parent_data.notify(info.serial);
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioDataResponse::setDataAllowedResponse(const RadioResponseInfo& /*info*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioDataResponse::setDataProfileResponse(const RadioResponseInfo& /*info*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioDataResponse::setDataThrottlingResponse(const RadioResponseInfo& info) {
|
||||
rspInfo = info;
|
||||
parent_data.notify(info.serial);
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioDataResponse::setInitialAttachApnResponse(
|
||||
const RadioResponseInfo& /*info*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioDataResponse::setupDataCallResponse(const RadioResponseInfo& info,
|
||||
const SetupDataCallResult& dcResponse) {
|
||||
rspInfo = info;
|
||||
setupDataCallResult = dcResponse;
|
||||
parent_data.notify(info.serial);
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioDataResponse::startHandoverResponse(const RadioResponseInfo& info) {
|
||||
rspInfo = info;
|
||||
parent_data.notify(info.serial);
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioDataResponse::startKeepaliveResponse(const RadioResponseInfo& /*info*/,
|
||||
const KeepaliveStatus& /*status*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioDataResponse::stopKeepaliveResponse(const RadioResponseInfo& /*info*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
|
@ -1,292 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2021 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 <aidl/android/hardware/radio/config/IRadioConfig.h>
|
||||
#include <android-base/logging.h>
|
||||
#include <android/binder_manager.h>
|
||||
#include <algorithm>
|
||||
|
||||
#include "radio_data_utils.h"
|
||||
|
||||
#define ASSERT_OK(ret) ASSERT_TRUE(ret.isOk())
|
||||
|
||||
void RadioDataTest::SetUp() {
|
||||
std::string serviceName = GetParam();
|
||||
|
||||
if (!isServiceValidForDeviceConfiguration(serviceName)) {
|
||||
ALOGI("Skipped the test due to device configuration.");
|
||||
GTEST_SKIP();
|
||||
}
|
||||
|
||||
radio_data = IRadioData::fromBinder(
|
||||
ndk::SpAIBinder(AServiceManager_waitForService(GetParam().c_str())));
|
||||
ASSERT_NE(nullptr, radio_data.get());
|
||||
|
||||
radioRsp_data = ndk::SharedRefBase::make<RadioDataResponse>(*this);
|
||||
ASSERT_NE(nullptr, radioRsp_data.get());
|
||||
|
||||
count_ = 0;
|
||||
|
||||
radioInd_data = ndk::SharedRefBase::make<RadioDataIndication>(*this);
|
||||
ASSERT_NE(nullptr, radioInd_data.get());
|
||||
|
||||
radio_data->setResponseFunctions(radioRsp_data, radioInd_data);
|
||||
|
||||
// Assert IRadioConfig exists before testing
|
||||
std::shared_ptr<aidl::android::hardware::radio::config::IRadioConfig> radioConfig =
|
||||
aidl::android::hardware::radio::config::IRadioConfig::fromBinder(
|
||||
ndk::SpAIBinder(AServiceManager_waitForService(
|
||||
"android.hardware.radio.config.IRadioConfig/default")));
|
||||
ASSERT_NE(nullptr, radioConfig.get());
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioDataTest::getDataCallList() {
|
||||
serial = GetRandomSerialNumber();
|
||||
radio_data->getDataCallList(serial);
|
||||
EXPECT_EQ(std::cv_status::no_timeout, wait());
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
/*
|
||||
* Test IRadioData.setupDataCall() for the response returned.
|
||||
*/
|
||||
TEST_P(RadioDataTest, setupDataCall) {
|
||||
serial = GetRandomSerialNumber();
|
||||
|
||||
AccessNetwork accessNetwork = AccessNetwork::EUTRAN;
|
||||
|
||||
DataProfileInfo dataProfileInfo;
|
||||
memset(&dataProfileInfo, 0, sizeof(dataProfileInfo));
|
||||
dataProfileInfo.profileId = DataProfileInfo::ID_DEFAULT;
|
||||
dataProfileInfo.apn = std::string("internet");
|
||||
dataProfileInfo.protocol = PdpProtocolType::IP;
|
||||
dataProfileInfo.roamingProtocol = PdpProtocolType::IP;
|
||||
dataProfileInfo.authType = ApnAuthType::NO_PAP_NO_CHAP;
|
||||
dataProfileInfo.user = std::string("username");
|
||||
dataProfileInfo.password = std::string("password");
|
||||
dataProfileInfo.type = DataProfileInfo::TYPE_THREE_GPP;
|
||||
dataProfileInfo.maxConnsTime = 300;
|
||||
dataProfileInfo.maxConns = 20;
|
||||
dataProfileInfo.waitTime = 0;
|
||||
dataProfileInfo.enabled = true;
|
||||
// TODO(b/210712359): 320 was the previous value; need to support bitmaps
|
||||
dataProfileInfo.supportedApnTypesBitmap = ApnTypes::DEFAULT;
|
||||
// TODO(b/210712359): 161543 was the previous value; need to support bitmaps
|
||||
dataProfileInfo.bearerBitmap = RadioAccessFamily::LTE;
|
||||
dataProfileInfo.mtuV4 = 0;
|
||||
dataProfileInfo.mtuV6 = 0;
|
||||
dataProfileInfo.preferred = true;
|
||||
dataProfileInfo.persistent = false;
|
||||
|
||||
bool roamingAllowed = false;
|
||||
|
||||
std::vector<LinkAddress> addresses = {};
|
||||
std::vector<std::string> dnses = {};
|
||||
|
||||
DataRequestReason reason = DataRequestReason::NORMAL;
|
||||
SliceInfo sliceInfo;
|
||||
bool matchAllRuleAllowed = true;
|
||||
|
||||
ndk::ScopedAStatus res =
|
||||
radio_data->setupDataCall(serial, accessNetwork, dataProfileInfo, roamingAllowed,
|
||||
reason, addresses, dnses, -1, sliceInfo, matchAllRuleAllowed);
|
||||
ASSERT_OK(res);
|
||||
|
||||
EXPECT_EQ(std::cv_status::no_timeout, wait());
|
||||
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_data->rspInfo.type);
|
||||
EXPECT_EQ(serial, radioRsp_data->rspInfo.serial);
|
||||
if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
|
||||
ASSERT_TRUE(CheckAnyOfErrors(radioRsp_data->rspInfo.error,
|
||||
{RadioError::SIM_ABSENT, RadioError::RADIO_NOT_AVAILABLE,
|
||||
RadioError::OP_NOT_ALLOWED_BEFORE_REG_TO_NW}));
|
||||
} else if (cardStatus.cardState == CardStatus::STATE_PRESENT) {
|
||||
ASSERT_TRUE(CheckAnyOfErrors(radioRsp_data->rspInfo.error,
|
||||
{RadioError::NONE, RadioError::RADIO_NOT_AVAILABLE,
|
||||
RadioError::OP_NOT_ALLOWED_BEFORE_REG_TO_NW}));
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Test IRadioData.setupDataCall() with osAppId for the response returned.
|
||||
*/
|
||||
TEST_P(RadioDataTest, setupDataCall_osAppId) {
|
||||
serial = GetRandomSerialNumber();
|
||||
|
||||
AccessNetwork accessNetwork = AccessNetwork::EUTRAN;
|
||||
|
||||
TrafficDescriptor trafficDescriptor;
|
||||
OsAppId osAppId;
|
||||
std::string osAppIdString("osAppId");
|
||||
// TODO(b/210712359): there should be a cleaner way to convert this
|
||||
std::vector<unsigned char> output(osAppIdString.length());
|
||||
std::transform(osAppIdString.begin(), osAppIdString.end(), output.begin(),
|
||||
[](char c) { return static_cast<unsigned char>(c); });
|
||||
osAppId.osAppId = output;
|
||||
trafficDescriptor.osAppId = osAppId;
|
||||
|
||||
DataProfileInfo dataProfileInfo;
|
||||
memset(&dataProfileInfo, 0, sizeof(dataProfileInfo));
|
||||
dataProfileInfo.profileId = DataProfileInfo::ID_DEFAULT;
|
||||
dataProfileInfo.apn = std::string("internet");
|
||||
dataProfileInfo.protocol = PdpProtocolType::IP;
|
||||
dataProfileInfo.roamingProtocol = PdpProtocolType::IP;
|
||||
dataProfileInfo.authType = ApnAuthType::NO_PAP_NO_CHAP;
|
||||
dataProfileInfo.user = std::string("username");
|
||||
dataProfileInfo.password = std::string("password");
|
||||
dataProfileInfo.type = DataProfileInfo::TYPE_THREE_GPP;
|
||||
dataProfileInfo.maxConnsTime = 300;
|
||||
dataProfileInfo.maxConns = 20;
|
||||
dataProfileInfo.waitTime = 0;
|
||||
dataProfileInfo.enabled = true;
|
||||
// TODO(b/210712359): 320 was the previous value; need to support bitmaps
|
||||
dataProfileInfo.supportedApnTypesBitmap = ApnTypes::DEFAULT;
|
||||
// TODO(b/210712359): 161543 was the previous value; need to support bitmaps
|
||||
dataProfileInfo.bearerBitmap = RadioAccessFamily::LTE;
|
||||
dataProfileInfo.mtuV4 = 0;
|
||||
dataProfileInfo.mtuV6 = 0;
|
||||
dataProfileInfo.preferred = true;
|
||||
dataProfileInfo.persistent = false;
|
||||
dataProfileInfo.trafficDescriptor = trafficDescriptor;
|
||||
|
||||
bool roamingAllowed = false;
|
||||
|
||||
std::vector<LinkAddress> addresses = {};
|
||||
std::vector<std::string> dnses = {};
|
||||
|
||||
DataRequestReason reason = DataRequestReason::NORMAL;
|
||||
SliceInfo sliceInfo;
|
||||
bool matchAllRuleAllowed = true;
|
||||
|
||||
ndk::ScopedAStatus res =
|
||||
radio_data->setupDataCall(serial, accessNetwork, dataProfileInfo, roamingAllowed,
|
||||
reason, addresses, dnses, -1, sliceInfo, matchAllRuleAllowed);
|
||||
ASSERT_OK(res);
|
||||
|
||||
EXPECT_EQ(std::cv_status::no_timeout, wait());
|
||||
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_data->rspInfo.type);
|
||||
EXPECT_EQ(serial, radioRsp_data->rspInfo.serial);
|
||||
if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
|
||||
ASSERT_TRUE(CheckAnyOfErrors(radioRsp_data->rspInfo.error,
|
||||
{RadioError::SIM_ABSENT, RadioError::RADIO_NOT_AVAILABLE,
|
||||
RadioError::OP_NOT_ALLOWED_BEFORE_REG_TO_NW}));
|
||||
} else if (cardStatus.cardState == CardStatus::STATE_PRESENT) {
|
||||
ASSERT_TRUE(CheckAnyOfErrors(radioRsp_data->rspInfo.error,
|
||||
{RadioError::NONE, RadioError::RADIO_NOT_AVAILABLE,
|
||||
RadioError::OP_NOT_ALLOWED_BEFORE_REG_TO_NW}));
|
||||
if (radioRsp_data->setupDataCallResult.trafficDescriptors.size() <= 0) {
|
||||
return;
|
||||
}
|
||||
EXPECT_EQ(trafficDescriptor.osAppId.value().osAppId,
|
||||
radioRsp_data->setupDataCallResult.trafficDescriptors[0].osAppId.value().osAppId);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Test IRadioData.getSlicingConfig() for the response returned.
|
||||
*/
|
||||
TEST_P(RadioDataTest, getSlicingConfig) {
|
||||
serial = GetRandomSerialNumber();
|
||||
radio_data->getSlicingConfig(serial);
|
||||
EXPECT_EQ(std::cv_status::no_timeout, wait());
|
||||
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_data->rspInfo.type);
|
||||
EXPECT_EQ(serial, radioRsp_data->rspInfo.serial);
|
||||
if (getRadioHalCapabilities()) {
|
||||
ASSERT_TRUE(CheckAnyOfErrors(radioRsp_data->rspInfo.error,
|
||||
{RadioError::REQUEST_NOT_SUPPORTED}));
|
||||
} else {
|
||||
ASSERT_TRUE(CheckAnyOfErrors(radioRsp_data->rspInfo.error,
|
||||
{RadioError::NONE, RadioError::RADIO_NOT_AVAILABLE,
|
||||
RadioError::INTERNAL_ERR, RadioError::MODEM_ERR}));
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Test IRadioData.setDataThrottling() for the response returned.
|
||||
*/
|
||||
TEST_P(RadioDataTest, setDataThrottling) {
|
||||
serial = GetRandomSerialNumber();
|
||||
|
||||
ndk::ScopedAStatus res = radio_data->setDataThrottling(
|
||||
serial, DataThrottlingAction::THROTTLE_SECONDARY_CARRIER, 60000);
|
||||
ASSERT_OK(res);
|
||||
|
||||
EXPECT_EQ(std::cv_status::no_timeout, wait());
|
||||
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_data->rspInfo.type);
|
||||
EXPECT_EQ(serial, radioRsp_data->rspInfo.serial);
|
||||
if (getRadioHalCapabilities()) {
|
||||
ASSERT_TRUE(CheckAnyOfErrors(radioRsp_data->rspInfo.error,
|
||||
{RadioError::REQUEST_NOT_SUPPORTED, RadioError::NONE}));
|
||||
} else {
|
||||
ASSERT_TRUE(CheckAnyOfErrors(radioRsp_data->rspInfo.error,
|
||||
{RadioError::RADIO_NOT_AVAILABLE, RadioError::MODEM_ERR,
|
||||
RadioError::NONE, RadioError::INVALID_ARGUMENTS}));
|
||||
}
|
||||
|
||||
sleep(1);
|
||||
serial = GetRandomSerialNumber();
|
||||
|
||||
res = radio_data->setDataThrottling(serial, DataThrottlingAction::THROTTLE_ANCHOR_CARRIER,
|
||||
60000);
|
||||
ASSERT_OK(res);
|
||||
EXPECT_EQ(std::cv_status::no_timeout, wait());
|
||||
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_data->rspInfo.type);
|
||||
EXPECT_EQ(serial, radioRsp_data->rspInfo.serial);
|
||||
if (getRadioHalCapabilities()) {
|
||||
ASSERT_TRUE(CheckAnyOfErrors(radioRsp_data->rspInfo.error,
|
||||
{RadioError::REQUEST_NOT_SUPPORTED, RadioError::NONE}));
|
||||
} else {
|
||||
ASSERT_TRUE(CheckAnyOfErrors(radioRsp_data->rspInfo.error,
|
||||
{RadioError::RADIO_NOT_AVAILABLE, RadioError::MODEM_ERR,
|
||||
RadioError::NONE, RadioError::INVALID_ARGUMENTS}));
|
||||
}
|
||||
|
||||
sleep(1);
|
||||
serial = GetRandomSerialNumber();
|
||||
|
||||
res = radio_data->setDataThrottling(serial, DataThrottlingAction::HOLD, 60000);
|
||||
ASSERT_OK(res);
|
||||
|
||||
EXPECT_EQ(std::cv_status::no_timeout, wait());
|
||||
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_data->rspInfo.type);
|
||||
EXPECT_EQ(serial, radioRsp_data->rspInfo.serial);
|
||||
if (getRadioHalCapabilities()) {
|
||||
ASSERT_TRUE(CheckAnyOfErrors(radioRsp_data->rspInfo.error,
|
||||
{RadioError::REQUEST_NOT_SUPPORTED, RadioError::NONE}));
|
||||
} else {
|
||||
ASSERT_TRUE(CheckAnyOfErrors(radioRsp_data->rspInfo.error,
|
||||
{RadioError::RADIO_NOT_AVAILABLE, RadioError::MODEM_ERR,
|
||||
RadioError::NONE, RadioError::INVALID_ARGUMENTS}));
|
||||
}
|
||||
|
||||
sleep(1);
|
||||
serial = GetRandomSerialNumber();
|
||||
|
||||
res = radio_data->setDataThrottling(serial, DataThrottlingAction::NO_DATA_THROTTLING, 60000);
|
||||
ASSERT_OK(res);
|
||||
EXPECT_EQ(std::cv_status::no_timeout, wait());
|
||||
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_data->rspInfo.type);
|
||||
EXPECT_EQ(serial, radioRsp_data->rspInfo.serial);
|
||||
if (getRadioHalCapabilities()) {
|
||||
ASSERT_TRUE(CheckAnyOfErrors(radioRsp_data->rspInfo.error,
|
||||
{RadioError::REQUEST_NOT_SUPPORTED, RadioError::NONE}));
|
||||
} else {
|
||||
ASSERT_TRUE(CheckAnyOfErrors(radioRsp_data->rspInfo.error,
|
||||
{RadioError::RADIO_NOT_AVAILABLE, RadioError::MODEM_ERR,
|
||||
RadioError::NONE, RadioError::INVALID_ARGUMENTS}));
|
||||
}
|
||||
|
||||
sleep(1);
|
||||
}
|
|
@ -1,116 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2021 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.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <aidl/android/hardware/radio/data/BnRadioDataIndication.h>
|
||||
#include <aidl/android/hardware/radio/data/BnRadioDataResponse.h>
|
||||
#include <aidl/android/hardware/radio/data/IRadioData.h>
|
||||
|
||||
#include "radio_aidl_hal_utils.h"
|
||||
|
||||
using namespace aidl::android::hardware::radio::data;
|
||||
using aidl::android::hardware::radio::sim::CardStatus;
|
||||
|
||||
class RadioDataTest;
|
||||
|
||||
/* Callback class for radio data response */
|
||||
class RadioDataResponse : public BnRadioDataResponse {
|
||||
protected:
|
||||
RadioResponseWaiter& parent_data;
|
||||
|
||||
public:
|
||||
RadioDataResponse(RadioResponseWaiter& parent_data);
|
||||
virtual ~RadioDataResponse() = default;
|
||||
|
||||
RadioResponseInfo rspInfo;
|
||||
int32_t allocatedPduSessionId;
|
||||
SetupDataCallResult setupDataCallResult;
|
||||
|
||||
virtual ndk::ScopedAStatus acknowledgeRequest(int32_t serial) override;
|
||||
|
||||
virtual ndk::ScopedAStatus allocatePduSessionIdResponse(const RadioResponseInfo& info,
|
||||
int32_t id) override;
|
||||
|
||||
virtual ndk::ScopedAStatus cancelHandoverResponse(const RadioResponseInfo& info) override;
|
||||
|
||||
virtual ndk::ScopedAStatus deactivateDataCallResponse(const RadioResponseInfo& info) override;
|
||||
|
||||
virtual ndk::ScopedAStatus getDataCallListResponse(
|
||||
const RadioResponseInfo& info,
|
||||
const std::vector<SetupDataCallResult>& dcResponse) override;
|
||||
|
||||
virtual ndk::ScopedAStatus getSlicingConfigResponse(
|
||||
const RadioResponseInfo& info, const SlicingConfig& slicingConfig) override;
|
||||
|
||||
virtual ndk::ScopedAStatus releasePduSessionIdResponse(const RadioResponseInfo& info) override;
|
||||
|
||||
virtual ndk::ScopedAStatus setDataAllowedResponse(const RadioResponseInfo& info) override;
|
||||
|
||||
virtual ndk::ScopedAStatus setDataProfileResponse(const RadioResponseInfo& info) override;
|
||||
|
||||
virtual ndk::ScopedAStatus setDataThrottlingResponse(const RadioResponseInfo& info) override;
|
||||
|
||||
virtual ndk::ScopedAStatus setInitialAttachApnResponse(const RadioResponseInfo& info) override;
|
||||
|
||||
virtual ndk::ScopedAStatus setupDataCallResponse(
|
||||
const RadioResponseInfo& info, const SetupDataCallResult& dcResponse) override;
|
||||
|
||||
virtual ndk::ScopedAStatus startHandoverResponse(const RadioResponseInfo& info) override;
|
||||
|
||||
virtual ndk::ScopedAStatus startKeepaliveResponse(const RadioResponseInfo& info,
|
||||
const KeepaliveStatus& status) override;
|
||||
|
||||
virtual ndk::ScopedAStatus stopKeepaliveResponse(const RadioResponseInfo& info) override;
|
||||
};
|
||||
|
||||
/* Callback class for radio data indication */
|
||||
class RadioDataIndication : public BnRadioDataIndication {
|
||||
protected:
|
||||
RadioDataTest& parent_data;
|
||||
|
||||
public:
|
||||
RadioDataIndication(RadioDataTest& parent_data);
|
||||
virtual ~RadioDataIndication() = default;
|
||||
|
||||
virtual ndk::ScopedAStatus dataCallListChanged(
|
||||
RadioIndicationType type, const std::vector<SetupDataCallResult>& dcList) override;
|
||||
|
||||
virtual ndk::ScopedAStatus keepaliveStatus(RadioIndicationType type,
|
||||
const KeepaliveStatus& status) override;
|
||||
|
||||
virtual ndk::ScopedAStatus pcoData(RadioIndicationType type, const PcoDataInfo& pco) override;
|
||||
|
||||
virtual ndk::ScopedAStatus unthrottleApn(RadioIndicationType type,
|
||||
const DataProfileInfo& dataProfile) override;
|
||||
};
|
||||
|
||||
// The main test class for Radio AIDL Data.
|
||||
class RadioDataTest : public ::testing::TestWithParam<std::string>, public RadioResponseWaiter {
|
||||
protected:
|
||||
/* Get current data call list */
|
||||
ndk::ScopedAStatus getDataCallList();
|
||||
|
||||
public:
|
||||
virtual void SetUp() override;
|
||||
|
||||
/* radio data service handle */
|
||||
std::shared_ptr<IRadioData> radio_data;
|
||||
/* radio data response handle */
|
||||
std::shared_ptr<RadioDataResponse> radioRsp_data;
|
||||
/* radio data indication handle */
|
||||
std::shared_ptr<RadioDataIndication> radioInd_data;
|
||||
};
|
|
@ -1,59 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2021 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_messaging_utils.h"
|
||||
|
||||
RadioMessagingIndication::RadioMessagingIndication(RadioMessagingTest& parent)
|
||||
: parent_messaging(parent) {}
|
||||
|
||||
ndk::ScopedAStatus RadioMessagingIndication::cdmaNewSms(RadioIndicationType /*type*/,
|
||||
const CdmaSmsMessage& /*msg*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioMessagingIndication::cdmaRuimSmsStorageFull(RadioIndicationType /*type*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioMessagingIndication::newBroadcastSms(RadioIndicationType /*type*/,
|
||||
const std::vector<uint8_t>& /*data*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioMessagingIndication::newSms(RadioIndicationType /*type*/,
|
||||
const std::vector<uint8_t>& /*pdu*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioMessagingIndication::newSmsOnSim(RadioIndicationType /*type*/,
|
||||
int32_t /*recordNumber*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioMessagingIndication::newSmsStatusReport(
|
||||
RadioIndicationType /*type*/, const std::vector<uint8_t>& /*pdu*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioMessagingIndication::onUssd(RadioIndicationType /*type*/,
|
||||
UssdModeType /*modeType*/,
|
||||
const std::string& /*msg*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioMessagingIndication::simSmsStorageFull(RadioIndicationType /*type*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
|
@ -1,152 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2021 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_messaging_utils.h"
|
||||
|
||||
RadioMessagingResponse::RadioMessagingResponse(RadioResponseWaiter& parent)
|
||||
: parent_messaging(parent) {}
|
||||
|
||||
ndk::ScopedAStatus RadioMessagingResponse::acknowledgeIncomingGsmSmsWithPduResponse(
|
||||
const RadioResponseInfo& /*info*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioMessagingResponse::acknowledgeLastIncomingCdmaSmsResponse(
|
||||
const RadioResponseInfo& /*info*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioMessagingResponse::acknowledgeLastIncomingGsmSmsResponse(
|
||||
const RadioResponseInfo& /*info*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioMessagingResponse::acknowledgeRequest(int32_t /*serial*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioMessagingResponse::cancelPendingUssdResponse(
|
||||
const RadioResponseInfo& /*info*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioMessagingResponse::deleteSmsOnRuimResponse(
|
||||
const RadioResponseInfo& /*info*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioMessagingResponse::deleteSmsOnSimResponse(
|
||||
const RadioResponseInfo& /*info*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioMessagingResponse::getCdmaBroadcastConfigResponse(
|
||||
const RadioResponseInfo& /*info*/,
|
||||
const std::vector<CdmaBroadcastSmsConfigInfo>& /*configs*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioMessagingResponse::getGsmBroadcastConfigResponse(
|
||||
const RadioResponseInfo& /*info*/,
|
||||
const std::vector<GsmBroadcastSmsConfigInfo>& /*configs*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioMessagingResponse::getSmscAddressResponse(const RadioResponseInfo& /*info*/,
|
||||
const std::string& /*smsc*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioMessagingResponse::reportSmsMemoryStatusResponse(
|
||||
const RadioResponseInfo& /*info*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioMessagingResponse::sendCdmaSmsExpectMoreResponse(
|
||||
const RadioResponseInfo& info, const SendSmsResult& sms) {
|
||||
rspInfo = info;
|
||||
sendSmsResult = sms;
|
||||
parent_messaging.notify(info.serial);
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioMessagingResponse::sendCdmaSmsResponse(const RadioResponseInfo& info,
|
||||
const SendSmsResult& sms) {
|
||||
rspInfo = info;
|
||||
sendSmsResult = sms;
|
||||
parent_messaging.notify(info.serial);
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioMessagingResponse::sendImsSmsResponse(const RadioResponseInfo& /*info*/,
|
||||
const SendSmsResult& /*sms*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioMessagingResponse::sendSmsExpectMoreResponse(const RadioResponseInfo& info,
|
||||
const SendSmsResult& sms) {
|
||||
rspInfo = info;
|
||||
sendSmsResult = sms;
|
||||
parent_messaging.notify(info.serial);
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioMessagingResponse::sendSmsResponse(const RadioResponseInfo& info,
|
||||
const SendSmsResult& sms) {
|
||||
rspInfo = info;
|
||||
sendSmsResult = sms;
|
||||
parent_messaging.notify(info.serial);
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioMessagingResponse::sendUssdResponse(const RadioResponseInfo& /*info*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioMessagingResponse::setCdmaBroadcastActivationResponse(
|
||||
const RadioResponseInfo& /*info*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioMessagingResponse::setCdmaBroadcastConfigResponse(
|
||||
const RadioResponseInfo& /*info*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioMessagingResponse::setGsmBroadcastActivationResponse(
|
||||
const RadioResponseInfo& /*info*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioMessagingResponse::setGsmBroadcastConfigResponse(
|
||||
const RadioResponseInfo& /*info*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioMessagingResponse::setSmscAddressResponse(
|
||||
const RadioResponseInfo& /*info*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioMessagingResponse::writeSmsToRuimResponse(const RadioResponseInfo& /*info*/,
|
||||
int32_t /*index*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioMessagingResponse::writeSmsToSimResponse(const RadioResponseInfo& /*info*/,
|
||||
int32_t /*index*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
|
@ -1,194 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2021 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 <aidl/android/hardware/radio/config/IRadioConfig.h>
|
||||
#include <android-base/logging.h>
|
||||
#include <android/binder_manager.h>
|
||||
|
||||
#include "radio_messaging_utils.h"
|
||||
|
||||
#define ASSERT_OK(ret) ASSERT_TRUE(ret.isOk())
|
||||
|
||||
void RadioMessagingTest::SetUp() {
|
||||
std::string serviceName = GetParam();
|
||||
|
||||
if (!isServiceValidForDeviceConfiguration(serviceName)) {
|
||||
ALOGI("Skipped the test due to device configuration.");
|
||||
GTEST_SKIP();
|
||||
}
|
||||
|
||||
radio_messaging = IRadioMessaging::fromBinder(
|
||||
ndk::SpAIBinder(AServiceManager_waitForService(GetParam().c_str())));
|
||||
ASSERT_NE(nullptr, radio_messaging.get());
|
||||
|
||||
radioRsp_messaging = ndk::SharedRefBase::make<RadioMessagingResponse>(*this);
|
||||
ASSERT_NE(nullptr, radioRsp_messaging.get());
|
||||
|
||||
count_ = 0;
|
||||
|
||||
radioInd_messaging = ndk::SharedRefBase::make<RadioMessagingIndication>(*this);
|
||||
ASSERT_NE(nullptr, radioInd_messaging.get());
|
||||
|
||||
radio_messaging->setResponseFunctions(radioRsp_messaging, radioInd_messaging);
|
||||
|
||||
// Assert IRadioConfig exists before testing
|
||||
std::shared_ptr<aidl::android::hardware::radio::config::IRadioConfig> radioConfig =
|
||||
aidl::android::hardware::radio::config::IRadioConfig::fromBinder(
|
||||
ndk::SpAIBinder(AServiceManager_waitForService(
|
||||
"android.hardware.radio.config.IRadioConfig/default")));
|
||||
ASSERT_NE(nullptr, radioConfig.get());
|
||||
}
|
||||
|
||||
/*
|
||||
* Test IRadioMessaging.sendSms() for the response returned.
|
||||
*/
|
||||
TEST_P(RadioMessagingTest, sendSms) {
|
||||
LOG(DEBUG) << "sendSms";
|
||||
serial = GetRandomSerialNumber();
|
||||
GsmSmsMessage msg;
|
||||
msg.smscPdu = "";
|
||||
msg.pdu = "01000b916105770203f3000006d4f29c3e9b01";
|
||||
|
||||
radio_messaging->sendSms(serial, msg);
|
||||
|
||||
EXPECT_EQ(std::cv_status::no_timeout, wait());
|
||||
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_messaging->rspInfo.type);
|
||||
EXPECT_EQ(serial, radioRsp_messaging->rspInfo.serial);
|
||||
|
||||
if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
|
||||
ASSERT_TRUE(CheckAnyOfErrors(
|
||||
radioRsp_messaging->rspInfo.error,
|
||||
{RadioError::INVALID_ARGUMENTS, RadioError::INVALID_STATE, RadioError::SIM_ABSENT},
|
||||
CHECK_GENERAL_ERROR));
|
||||
EXPECT_EQ(0, radioRsp_messaging->sendSmsResult.errorCode);
|
||||
}
|
||||
LOG(DEBUG) << "sendSms finished";
|
||||
}
|
||||
|
||||
/*
|
||||
* Test IRadioMessaging.sendSmsExpectMore() for the response returned.
|
||||
*/
|
||||
TEST_P(RadioMessagingTest, sendSmsExpectMore) {
|
||||
LOG(DEBUG) << "sendSmsExpectMore";
|
||||
serial = GetRandomSerialNumber();
|
||||
GsmSmsMessage msg;
|
||||
msg.smscPdu = "";
|
||||
msg.pdu = "01000b916105770203f3000006d4f29c3e9b01";
|
||||
|
||||
radio_messaging->sendSmsExpectMore(serial, msg);
|
||||
|
||||
EXPECT_EQ(std::cv_status::no_timeout, wait());
|
||||
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_messaging->rspInfo.type);
|
||||
EXPECT_EQ(serial, radioRsp_messaging->rspInfo.serial);
|
||||
|
||||
if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
|
||||
ASSERT_TRUE(CheckAnyOfErrors(
|
||||
radioRsp_messaging->rspInfo.error,
|
||||
{RadioError::INVALID_ARGUMENTS, RadioError::INVALID_STATE, RadioError::SIM_ABSENT},
|
||||
CHECK_GENERAL_ERROR));
|
||||
}
|
||||
LOG(DEBUG) << "sendSmsExpectMore finished";
|
||||
}
|
||||
|
||||
/*
|
||||
* Test IRadioMessaging.sendCdmaSms() for the response returned.
|
||||
*/
|
||||
TEST_P(RadioMessagingTest, sendCdmaSms) {
|
||||
LOG(DEBUG) << "sendCdmaSms";
|
||||
serial = GetRandomSerialNumber();
|
||||
|
||||
// Create a CdmaSmsAddress
|
||||
CdmaSmsAddress cdmaSmsAddress;
|
||||
cdmaSmsAddress.digitMode = CdmaSmsAddress::DIGIT_MODE_FOUR_BIT;
|
||||
cdmaSmsAddress.isNumberModeDataNetwork = false;
|
||||
cdmaSmsAddress.numberType = CdmaSmsAddress::NUMBER_TYPE_UNKNOWN;
|
||||
cdmaSmsAddress.numberPlan = CdmaSmsAddress::NUMBER_PLAN_UNKNOWN;
|
||||
cdmaSmsAddress.digits = (std::vector<uint8_t>){11, 1, 6, 5, 10, 7, 7, 2, 10, 3, 10, 3};
|
||||
|
||||
// Create a CdmaSmsSubAddress
|
||||
CdmaSmsSubaddress cdmaSmsSubaddress;
|
||||
cdmaSmsSubaddress.subaddressType = CdmaSmsSubaddress::SUBADDRESS_TYPE_NSAP;
|
||||
cdmaSmsSubaddress.odd = false;
|
||||
cdmaSmsSubaddress.digits = (std::vector<uint8_t>){};
|
||||
|
||||
// Create a CdmaSmsMessage
|
||||
CdmaSmsMessage cdmaSmsMessage;
|
||||
cdmaSmsMessage.teleserviceId = 4098;
|
||||
cdmaSmsMessage.isServicePresent = false;
|
||||
cdmaSmsMessage.serviceCategory = 0;
|
||||
cdmaSmsMessage.address = cdmaSmsAddress;
|
||||
cdmaSmsMessage.subAddress = cdmaSmsSubaddress;
|
||||
cdmaSmsMessage.bearerData =
|
||||
(std::vector<uint8_t>){15, 0, 3, 32, 3, 16, 1, 8, 16, 53, 76, 68, 6, 51, 106, 0};
|
||||
|
||||
radio_messaging->sendCdmaSms(serial, cdmaSmsMessage);
|
||||
|
||||
EXPECT_EQ(std::cv_status::no_timeout, wait());
|
||||
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_messaging->rspInfo.type);
|
||||
EXPECT_EQ(serial, radioRsp_messaging->rspInfo.serial);
|
||||
|
||||
if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
|
||||
ASSERT_TRUE(CheckAnyOfErrors(
|
||||
radioRsp_messaging->rspInfo.error,
|
||||
{RadioError::INVALID_ARGUMENTS, RadioError::INVALID_STATE, RadioError::SIM_ABSENT},
|
||||
CHECK_GENERAL_ERROR));
|
||||
}
|
||||
LOG(DEBUG) << "sendCdmaSms finished";
|
||||
}
|
||||
|
||||
/*
|
||||
* Test IRadioMessaging.sendCdmaSmsExpectMore() for the response returned.
|
||||
*/
|
||||
TEST_P(RadioMessagingTest, sendCdmaSmsExpectMore) {
|
||||
serial = GetRandomSerialNumber();
|
||||
|
||||
// Create a CdmaSmsAddress
|
||||
CdmaSmsAddress cdmaSmsAddress;
|
||||
cdmaSmsAddress.digitMode = CdmaSmsAddress::DIGIT_MODE_FOUR_BIT;
|
||||
cdmaSmsAddress.isNumberModeDataNetwork = false;
|
||||
cdmaSmsAddress.numberType = CdmaSmsAddress::NUMBER_TYPE_UNKNOWN;
|
||||
cdmaSmsAddress.numberPlan = CdmaSmsAddress::NUMBER_PLAN_UNKNOWN;
|
||||
cdmaSmsAddress.digits = (std::vector<uint8_t>){11, 1, 6, 5, 10, 7, 7, 2, 10, 3, 10, 3};
|
||||
|
||||
// Create a CdmaSmsSubAddress
|
||||
CdmaSmsSubaddress cdmaSmsSubaddress;
|
||||
cdmaSmsSubaddress.subaddressType = CdmaSmsSubaddress::SUBADDRESS_TYPE_NSAP;
|
||||
cdmaSmsSubaddress.odd = false;
|
||||
cdmaSmsSubaddress.digits = (std::vector<uint8_t>){};
|
||||
|
||||
// Create a CdmaSmsMessage
|
||||
CdmaSmsMessage cdmaSmsMessage;
|
||||
cdmaSmsMessage.teleserviceId = 4098;
|
||||
cdmaSmsMessage.isServicePresent = false;
|
||||
cdmaSmsMessage.serviceCategory = 0;
|
||||
cdmaSmsMessage.address = cdmaSmsAddress;
|
||||
cdmaSmsMessage.subAddress = cdmaSmsSubaddress;
|
||||
cdmaSmsMessage.bearerData =
|
||||
(std::vector<uint8_t>){15, 0, 3, 32, 3, 16, 1, 8, 16, 53, 76, 68, 6, 51, 106, 0};
|
||||
|
||||
radio_messaging->sendCdmaSmsExpectMore(serial, cdmaSmsMessage);
|
||||
|
||||
EXPECT_EQ(std::cv_status::no_timeout, wait());
|
||||
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_messaging->rspInfo.type);
|
||||
EXPECT_EQ(serial, radioRsp_messaging->rspInfo.serial);
|
||||
|
||||
if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
|
||||
ASSERT_TRUE(CheckAnyOfErrors(
|
||||
radioRsp_messaging->rspInfo.error,
|
||||
{RadioError::INVALID_ARGUMENTS, RadioError::INVALID_STATE, RadioError::SIM_ABSENT},
|
||||
CHECK_GENERAL_ERROR));
|
||||
}
|
||||
}
|
|
@ -1,153 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2021 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.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <aidl/android/hardware/radio/messaging/BnRadioMessagingIndication.h>
|
||||
#include <aidl/android/hardware/radio/messaging/BnRadioMessagingResponse.h>
|
||||
#include <aidl/android/hardware/radio/messaging/IRadioMessaging.h>
|
||||
|
||||
#include "radio_aidl_hal_utils.h"
|
||||
|
||||
using namespace aidl::android::hardware::radio::messaging;
|
||||
|
||||
class RadioMessagingTest;
|
||||
|
||||
/* Callback class for radio messaging response */
|
||||
class RadioMessagingResponse : public BnRadioMessagingResponse {
|
||||
protected:
|
||||
RadioResponseWaiter& parent_messaging;
|
||||
|
||||
public:
|
||||
RadioMessagingResponse(RadioResponseWaiter& parent_messaging);
|
||||
virtual ~RadioMessagingResponse() = default;
|
||||
|
||||
RadioResponseInfo rspInfo;
|
||||
SendSmsResult sendSmsResult;
|
||||
|
||||
virtual ndk::ScopedAStatus acknowledgeIncomingGsmSmsWithPduResponse(
|
||||
const RadioResponseInfo& info) override;
|
||||
|
||||
virtual ndk::ScopedAStatus acknowledgeLastIncomingCdmaSmsResponse(
|
||||
const RadioResponseInfo& info) override;
|
||||
|
||||
virtual ndk::ScopedAStatus acknowledgeLastIncomingGsmSmsResponse(
|
||||
const RadioResponseInfo& info) override;
|
||||
|
||||
virtual ndk::ScopedAStatus acknowledgeRequest(int32_t serial) override;
|
||||
|
||||
virtual ndk::ScopedAStatus cancelPendingUssdResponse(const RadioResponseInfo& info) override;
|
||||
|
||||
virtual ndk::ScopedAStatus deleteSmsOnRuimResponse(const RadioResponseInfo& info) override;
|
||||
|
||||
virtual ndk::ScopedAStatus deleteSmsOnSimResponse(const RadioResponseInfo& info) override;
|
||||
|
||||
virtual ndk::ScopedAStatus getCdmaBroadcastConfigResponse(
|
||||
const RadioResponseInfo& info,
|
||||
const std::vector<CdmaBroadcastSmsConfigInfo>& configs) override;
|
||||
|
||||
virtual ndk::ScopedAStatus getGsmBroadcastConfigResponse(
|
||||
const RadioResponseInfo& info,
|
||||
const std::vector<GsmBroadcastSmsConfigInfo>& configs) override;
|
||||
|
||||
virtual ndk::ScopedAStatus getSmscAddressResponse(const RadioResponseInfo& info,
|
||||
const std::string& smsc) override;
|
||||
|
||||
virtual ndk::ScopedAStatus reportSmsMemoryStatusResponse(
|
||||
const RadioResponseInfo& info) override;
|
||||
|
||||
virtual ndk::ScopedAStatus sendCdmaSmsExpectMoreResponse(const RadioResponseInfo& info,
|
||||
const SendSmsResult& sms) override;
|
||||
|
||||
virtual ndk::ScopedAStatus sendCdmaSmsResponse(const RadioResponseInfo& info,
|
||||
const SendSmsResult& sms) override;
|
||||
|
||||
virtual ndk::ScopedAStatus sendImsSmsResponse(const RadioResponseInfo& info,
|
||||
const SendSmsResult& sms) override;
|
||||
|
||||
virtual ndk::ScopedAStatus sendSmsExpectMoreResponse(const RadioResponseInfo& info,
|
||||
const SendSmsResult& sms) override;
|
||||
|
||||
virtual ndk::ScopedAStatus sendSmsResponse(const RadioResponseInfo& info,
|
||||
const SendSmsResult& sms) override;
|
||||
|
||||
virtual ndk::ScopedAStatus sendUssdResponse(const RadioResponseInfo& info) override;
|
||||
|
||||
virtual ndk::ScopedAStatus setCdmaBroadcastActivationResponse(
|
||||
const RadioResponseInfo& info) override;
|
||||
|
||||
virtual ndk::ScopedAStatus setCdmaBroadcastConfigResponse(
|
||||
const RadioResponseInfo& info) override;
|
||||
|
||||
virtual ndk::ScopedAStatus setGsmBroadcastActivationResponse(
|
||||
const RadioResponseInfo& info) override;
|
||||
|
||||
virtual ndk::ScopedAStatus setGsmBroadcastConfigResponse(
|
||||
const RadioResponseInfo& info) override;
|
||||
|
||||
virtual ndk::ScopedAStatus setSmscAddressResponse(const RadioResponseInfo& info) override;
|
||||
|
||||
virtual ndk::ScopedAStatus writeSmsToRuimResponse(const RadioResponseInfo& info,
|
||||
int32_t index) override;
|
||||
|
||||
virtual ndk::ScopedAStatus writeSmsToSimResponse(const RadioResponseInfo& info,
|
||||
int32_t index) override;
|
||||
};
|
||||
|
||||
/* Callback class for radio messaging indication */
|
||||
class RadioMessagingIndication : public BnRadioMessagingIndication {
|
||||
protected:
|
||||
RadioMessagingTest& parent_messaging;
|
||||
|
||||
public:
|
||||
RadioMessagingIndication(RadioMessagingTest& parent_messaging);
|
||||
virtual ~RadioMessagingIndication() = default;
|
||||
|
||||
virtual ndk::ScopedAStatus cdmaNewSms(RadioIndicationType type,
|
||||
const CdmaSmsMessage& msg) override;
|
||||
|
||||
virtual ndk::ScopedAStatus cdmaRuimSmsStorageFull(RadioIndicationType type) override;
|
||||
|
||||
virtual ndk::ScopedAStatus newBroadcastSms(RadioIndicationType type,
|
||||
const std::vector<uint8_t>& data) override;
|
||||
|
||||
virtual ndk::ScopedAStatus newSms(RadioIndicationType type,
|
||||
const std::vector<uint8_t>& pdu) override;
|
||||
|
||||
virtual ndk::ScopedAStatus newSmsOnSim(RadioIndicationType type, int32_t recordNumber) override;
|
||||
|
||||
virtual ndk::ScopedAStatus newSmsStatusReport(RadioIndicationType type,
|
||||
const std::vector<uint8_t>& pdu) override;
|
||||
|
||||
virtual ndk::ScopedAStatus onUssd(RadioIndicationType type, UssdModeType modeType,
|
||||
const std::string& msg) override;
|
||||
|
||||
virtual ndk::ScopedAStatus simSmsStorageFull(RadioIndicationType type) override;
|
||||
};
|
||||
|
||||
// The main test class for Radio AIDL Messaging.
|
||||
class RadioMessagingTest : public ::testing::TestWithParam<std::string>,
|
||||
public RadioResponseWaiter {
|
||||
public:
|
||||
virtual void SetUp() override;
|
||||
|
||||
/* radio messaging service handle */
|
||||
std::shared_ptr<IRadioMessaging> radio_messaging;
|
||||
/* radio messaging response handle */
|
||||
std::shared_ptr<RadioMessagingResponse> radioRsp_messaging;
|
||||
/* radio messaging indication handle */
|
||||
std::shared_ptr<RadioMessagingIndication> radioInd_messaging;
|
||||
};
|
|
@ -1,43 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2021 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_modem_utils.h"
|
||||
|
||||
RadioModemIndication::RadioModemIndication(RadioModemTest& parent) : parent_modem(parent) {}
|
||||
|
||||
ndk::ScopedAStatus RadioModemIndication::hardwareConfigChanged(
|
||||
RadioIndicationType /*type*/, const std::vector<HardwareConfig>& /*configs*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioModemIndication::modemReset(RadioIndicationType /*type*/,
|
||||
const std::string& /*reason*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioModemIndication::radioCapabilityIndication(RadioIndicationType /*type*/,
|
||||
const RadioCapability& /*rc*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioModemIndication::radioStateChanged(RadioIndicationType /*type*/,
|
||||
RadioState /*radioState*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioModemIndication::rilConnected(RadioIndicationType /*type*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
|
@ -1,96 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2021 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_modem_utils.h"
|
||||
|
||||
RadioModemResponse::RadioModemResponse(RadioResponseWaiter& parent) : parent_modem(parent) {}
|
||||
|
||||
ndk::ScopedAStatus RadioModemResponse::acknowledgeRequest(int32_t /*serial*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioModemResponse::enableModemResponse(const RadioResponseInfo& /*info*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioModemResponse::getBasebandVersionResponse(const RadioResponseInfo& /*info*/,
|
||||
const std::string& /*version*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioModemResponse::getDeviceIdentityResponse(const RadioResponseInfo& /*info*/,
|
||||
const std::string& /*imei*/,
|
||||
const std::string& /*imeisv*/,
|
||||
const std::string& /*esn*/,
|
||||
const std::string& /*meid*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioModemResponse::getHardwareConfigResponse(
|
||||
const RadioResponseInfo& /*info*/, const std::vector<HardwareConfig>& /*config*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioModemResponse::getModemActivityInfoResponse(
|
||||
const RadioResponseInfo& /*info*/, const ActivityStatsInfo& /*activityInfo*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioModemResponse::getModemStackStatusResponse(
|
||||
const RadioResponseInfo& /*info*/, const bool /*enabled*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioModemResponse::getRadioCapabilityResponse(const RadioResponseInfo& /*info*/,
|
||||
const RadioCapability& /*rc*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioModemResponse::nvReadItemResponse(const RadioResponseInfo& /*info*/,
|
||||
const std::string& /*result*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioModemResponse::nvResetConfigResponse(const RadioResponseInfo& /*info*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioModemResponse::nvWriteCdmaPrlResponse(const RadioResponseInfo& /*info*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioModemResponse::nvWriteItemResponse(const RadioResponseInfo& /*info*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioModemResponse::requestShutdownResponse(const RadioResponseInfo& /*info*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioModemResponse::sendDeviceStateResponse(const RadioResponseInfo& /*info*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioModemResponse::setRadioCapabilityResponse(const RadioResponseInfo& /*info*/,
|
||||
const RadioCapability& /*rc*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioModemResponse::setRadioPowerResponse(const RadioResponseInfo& info) {
|
||||
rspInfo = info;
|
||||
parent_modem.notify(info.serial);
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
|
@ -1,84 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2021 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 <aidl/android/hardware/radio/config/IRadioConfig.h>
|
||||
#include <android-base/logging.h>
|
||||
#include <android/binder_manager.h>
|
||||
|
||||
#include "radio_modem_utils.h"
|
||||
|
||||
#define ASSERT_OK(ret) ASSERT_TRUE(ret.isOk())
|
||||
|
||||
void RadioModemTest::SetUp() {
|
||||
std::string serviceName = GetParam();
|
||||
|
||||
if (!isServiceValidForDeviceConfiguration(serviceName)) {
|
||||
ALOGI("Skipped the test due to device configuration.");
|
||||
GTEST_SKIP();
|
||||
}
|
||||
|
||||
radio_modem = IRadioModem::fromBinder(
|
||||
ndk::SpAIBinder(AServiceManager_waitForService(GetParam().c_str())));
|
||||
ASSERT_NE(nullptr, radio_modem.get());
|
||||
|
||||
radioRsp_modem = ndk::SharedRefBase::make<RadioModemResponse>(*this);
|
||||
ASSERT_NE(nullptr, radioRsp_modem.get());
|
||||
|
||||
count_ = 0;
|
||||
|
||||
radioInd_modem = ndk::SharedRefBase::make<RadioModemIndication>(*this);
|
||||
ASSERT_NE(nullptr, radioInd_modem.get());
|
||||
|
||||
radio_modem->setResponseFunctions(radioRsp_modem, radioInd_modem);
|
||||
|
||||
// Assert IRadioConfig exists before testing
|
||||
std::shared_ptr<aidl::android::hardware::radio::config::IRadioConfig> radioConfig =
|
||||
aidl::android::hardware::radio::config::IRadioConfig::fromBinder(
|
||||
ndk::SpAIBinder(AServiceManager_waitForService(
|
||||
"android.hardware.radio.config.IRadioConfig/default")));
|
||||
ASSERT_NE(nullptr, radioConfig.get());
|
||||
}
|
||||
|
||||
/*
|
||||
* Test IRadioModem.setRadioPower() for the response returned.
|
||||
*/
|
||||
TEST_P(RadioModemTest, setRadioPower_emergencyCall_cancelled) {
|
||||
// Set radio power to off.
|
||||
serial = GetRandomSerialNumber();
|
||||
radio_modem->setRadioPower(serial, false, false, false);
|
||||
EXPECT_EQ(std::cv_status::no_timeout, wait());
|
||||
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_modem->rspInfo.type);
|
||||
EXPECT_EQ(serial, radioRsp_modem->rspInfo.serial);
|
||||
EXPECT_EQ(RadioError::NONE, radioRsp_modem->rspInfo.error);
|
||||
|
||||
// Set radio power to on with forEmergencyCall being true. This should put modem to only scan
|
||||
// emergency call bands.
|
||||
serial = GetRandomSerialNumber();
|
||||
radio_modem->setRadioPower(serial, true, true, true);
|
||||
EXPECT_EQ(std::cv_status::no_timeout, wait());
|
||||
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_modem->rspInfo.type);
|
||||
EXPECT_EQ(serial, radioRsp_modem->rspInfo.serial);
|
||||
EXPECT_EQ(RadioError::NONE, radioRsp_modem->rspInfo.error);
|
||||
|
||||
// Set radio power to on with forEmergencyCall being false. This should put modem in regular
|
||||
// operation modem.
|
||||
serial = GetRandomSerialNumber();
|
||||
radio_modem->setRadioPower(serial, true, false, false);
|
||||
EXPECT_EQ(std::cv_status::no_timeout, wait());
|
||||
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_modem->rspInfo.type);
|
||||
EXPECT_EQ(serial, radioRsp_modem->rspInfo.serial);
|
||||
EXPECT_EQ(RadioError::NONE, radioRsp_modem->rspInfo.error);
|
||||
}
|
|
@ -1,122 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2021 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.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <aidl/android/hardware/radio/modem/BnRadioModemIndication.h>
|
||||
#include <aidl/android/hardware/radio/modem/BnRadioModemResponse.h>
|
||||
#include <aidl/android/hardware/radio/modem/IRadioModem.h>
|
||||
|
||||
#include "radio_aidl_hal_utils.h"
|
||||
|
||||
using namespace aidl::android::hardware::radio::config;
|
||||
using namespace aidl::android::hardware::radio::modem;
|
||||
|
||||
class RadioModemTest;
|
||||
|
||||
/* Callback class for radio modem response */
|
||||
class RadioModemResponse : public BnRadioModemResponse {
|
||||
protected:
|
||||
RadioResponseWaiter& parent_modem;
|
||||
|
||||
public:
|
||||
RadioModemResponse(RadioResponseWaiter& parent_modem);
|
||||
virtual ~RadioModemResponse() = default;
|
||||
|
||||
RadioResponseInfo rspInfo;
|
||||
bool isModemEnabled;
|
||||
bool enableModemResponseToggle;
|
||||
|
||||
virtual ndk::ScopedAStatus acknowledgeRequest(int32_t serial) override;
|
||||
|
||||
virtual ndk::ScopedAStatus enableModemResponse(const RadioResponseInfo& info) override;
|
||||
|
||||
virtual ndk::ScopedAStatus getBasebandVersionResponse(const RadioResponseInfo& info,
|
||||
const std::string& version) override;
|
||||
|
||||
virtual ndk::ScopedAStatus getDeviceIdentityResponse(const RadioResponseInfo& info,
|
||||
const std::string& imei,
|
||||
const std::string& imeisv,
|
||||
const std::string& esn,
|
||||
const std::string& meid) override;
|
||||
|
||||
virtual ndk::ScopedAStatus getHardwareConfigResponse(
|
||||
const RadioResponseInfo& info, const std::vector<HardwareConfig>& config) override;
|
||||
|
||||
virtual ndk::ScopedAStatus getModemActivityInfoResponse(
|
||||
const RadioResponseInfo& info, const ActivityStatsInfo& activityInfo) override;
|
||||
|
||||
virtual ndk::ScopedAStatus getModemStackStatusResponse(const RadioResponseInfo& info,
|
||||
const bool enabled) override;
|
||||
|
||||
virtual ndk::ScopedAStatus getRadioCapabilityResponse(const RadioResponseInfo& info,
|
||||
const RadioCapability& rc) override;
|
||||
|
||||
virtual ndk::ScopedAStatus nvReadItemResponse(const RadioResponseInfo& info,
|
||||
const std::string& result) override;
|
||||
|
||||
virtual ndk::ScopedAStatus nvResetConfigResponse(const RadioResponseInfo& info) override;
|
||||
|
||||
virtual ndk::ScopedAStatus nvWriteCdmaPrlResponse(const RadioResponseInfo& info) override;
|
||||
|
||||
virtual ndk::ScopedAStatus nvWriteItemResponse(const RadioResponseInfo& info) override;
|
||||
|
||||
virtual ndk::ScopedAStatus requestShutdownResponse(const RadioResponseInfo& info) override;
|
||||
|
||||
virtual ndk::ScopedAStatus sendDeviceStateResponse(const RadioResponseInfo& info) override;
|
||||
|
||||
virtual ndk::ScopedAStatus setRadioCapabilityResponse(const RadioResponseInfo& info,
|
||||
const RadioCapability& rc) override;
|
||||
|
||||
virtual ndk::ScopedAStatus setRadioPowerResponse(const RadioResponseInfo& info) override;
|
||||
};
|
||||
|
||||
/* Callback class for radio modem indication */
|
||||
class RadioModemIndication : public BnRadioModemIndication {
|
||||
protected:
|
||||
RadioModemTest& parent_modem;
|
||||
|
||||
public:
|
||||
RadioModemIndication(RadioModemTest& parent_modem);
|
||||
virtual ~RadioModemIndication() = default;
|
||||
|
||||
virtual ndk::ScopedAStatus hardwareConfigChanged(
|
||||
RadioIndicationType type, const std::vector<HardwareConfig>& configs) override;
|
||||
|
||||
virtual ndk::ScopedAStatus modemReset(RadioIndicationType type,
|
||||
const std::string& reason) override;
|
||||
|
||||
virtual ndk::ScopedAStatus radioCapabilityIndication(RadioIndicationType type,
|
||||
const RadioCapability& rc) override;
|
||||
|
||||
virtual ndk::ScopedAStatus radioStateChanged(RadioIndicationType type,
|
||||
RadioState radioState) override;
|
||||
|
||||
virtual ndk::ScopedAStatus rilConnected(RadioIndicationType type) override;
|
||||
};
|
||||
|
||||
// The main test class for Radio AIDL Modem.
|
||||
class RadioModemTest : public ::testing::TestWithParam<std::string>, public RadioResponseWaiter {
|
||||
public:
|
||||
virtual void SetUp() override;
|
||||
|
||||
/* radio modem service handle */
|
||||
std::shared_ptr<IRadioModem> radio_modem;
|
||||
/* radio modem response handle */
|
||||
std::shared_ptr<RadioModemResponse> radioRsp_modem;
|
||||
/* radio modem indication handle */
|
||||
std::shared_ptr<RadioModemIndication> radioInd_modem;
|
||||
};
|
|
@ -1,94 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2021 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_network_utils.h"
|
||||
|
||||
RadioNetworkIndication::RadioNetworkIndication(RadioNetworkTest& parent) : parent_network(parent) {}
|
||||
|
||||
ndk::ScopedAStatus RadioNetworkIndication::barringInfoChanged(
|
||||
RadioIndicationType /*type*/, const CellIdentity& /*cellIdentity*/,
|
||||
const std::vector<BarringInfo>& /*barringInfos*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioNetworkIndication::cdmaPrlChanged(RadioIndicationType /*type*/,
|
||||
int32_t /*version*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioNetworkIndication::cellInfoList(RadioIndicationType /*type*/,
|
||||
const std::vector<CellInfo>& /*records*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioNetworkIndication::currentLinkCapacityEstimate(
|
||||
RadioIndicationType /*type*/, const LinkCapacityEstimate& /*lce*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioNetworkIndication::currentPhysicalChannelConfigs(
|
||||
RadioIndicationType /*type*/, const std::vector<PhysicalChannelConfig>& /*configs*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioNetworkIndication::currentSignalStrength(
|
||||
RadioIndicationType /*type*/, const SignalStrength& /*signalStrength*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioNetworkIndication::imsNetworkStateChanged(RadioIndicationType /*type*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioNetworkIndication::networkScanResult(RadioIndicationType /*type*/,
|
||||
const NetworkScanResult& /*result*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioNetworkIndication::networkStateChanged(RadioIndicationType /*type*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioNetworkIndication::nitzTimeReceived(RadioIndicationType /*type*/,
|
||||
const std::string& /*nitzTime*/,
|
||||
int64_t /*receivedTime*/,
|
||||
int64_t /*age*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioNetworkIndication::registrationFailed(RadioIndicationType /*type*/,
|
||||
const CellIdentity& /*cellIdentity*/,
|
||||
const std::string& /*chosenPlmn*/,
|
||||
Domain /*domain*/,
|
||||
int32_t /*causeCode*/,
|
||||
int32_t /*additionalCauseCode*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioNetworkIndication::restrictedStateChanged(RadioIndicationType /*type*/,
|
||||
PhoneRestrictedState /*state*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioNetworkIndication::suppSvcNotify(RadioIndicationType /*type*/,
|
||||
const SuppSvcNotification& /*suppSvc*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioNetworkIndication::voiceRadioTechChanged(RadioIndicationType /*type*/,
|
||||
RadioTechnology /*rat*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
|
@ -1,216 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2021 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_network_utils.h"
|
||||
|
||||
RadioNetworkResponse::RadioNetworkResponse(RadioResponseWaiter& parent) : parent_network(parent) {}
|
||||
|
||||
ndk::ScopedAStatus RadioNetworkResponse::acknowledgeRequest(int32_t /*serial*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioNetworkResponse::getAllowedNetworkTypesBitmapResponse(
|
||||
const RadioResponseInfo& info, const RadioAccessFamily networkTypeBitmap) {
|
||||
rspInfo = info;
|
||||
networkTypeBitmapResponse = networkTypeBitmap;
|
||||
parent_network.notify(info.serial);
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioNetworkResponse::getAvailableBandModesResponse(
|
||||
const RadioResponseInfo& /*info*/, const std::vector<RadioBandMode>& /*bandModes*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioNetworkResponse::getAvailableNetworksResponse(
|
||||
const RadioResponseInfo& info, const std::vector<OperatorInfo>& operatorInfos) {
|
||||
rspInfo = info;
|
||||
networkInfos = operatorInfos;
|
||||
parent_network.notify(info.serial);
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioNetworkResponse::getBarringInfoResponse(
|
||||
const RadioResponseInfo& /*info*/, const CellIdentity& /*cellIdentity*/,
|
||||
const std::vector<BarringInfo>& /*barringInfos*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioNetworkResponse::getCdmaRoamingPreferenceResponse(
|
||||
const RadioResponseInfo& /*info*/, CdmaRoamingType /*type*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioNetworkResponse::getCellInfoListResponse(
|
||||
const RadioResponseInfo& /*info*/, const std::vector<CellInfo>& /*cellInfo*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioNetworkResponse::getDataRegistrationStateResponse(
|
||||
const RadioResponseInfo& info, const RegStateResult& /*regResponse*/) {
|
||||
rspInfo = info;
|
||||
parent_network.notify(info.serial);
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioNetworkResponse::getImsRegistrationStateResponse(
|
||||
const RadioResponseInfo& /*info*/, bool /*isRegistered*/,
|
||||
RadioTechnologyFamily /*ratFamily*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioNetworkResponse::getNetworkSelectionModeResponse(
|
||||
const RadioResponseInfo& /*info*/, bool /*manual*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioNetworkResponse::getOperatorResponse(const RadioResponseInfo& /*info*/,
|
||||
const std::string& /*longName*/,
|
||||
const std::string& /*shortName*/,
|
||||
const std::string& /*numeric*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioNetworkResponse::getSignalStrengthResponse(
|
||||
const RadioResponseInfo& /*info*/, const SignalStrength& /*sig_strength*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioNetworkResponse::getSystemSelectionChannelsResponse(
|
||||
const RadioResponseInfo& info, const std::vector<RadioAccessSpecifier>& /*specifier*/) {
|
||||
rspInfo = info;
|
||||
parent_network.notify(info.serial);
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioNetworkResponse::getUsageSettingResponse(
|
||||
const RadioResponseInfo& /*info*/, const UsageSetting /*usageSetting*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioNetworkResponse::getVoiceRadioTechnologyResponse(
|
||||
const RadioResponseInfo& /*info*/, RadioTechnology /*rat*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioNetworkResponse::getVoiceRegistrationStateResponse(
|
||||
const RadioResponseInfo& info, const RegStateResult& regResponse) {
|
||||
rspInfo = info;
|
||||
regStateResp.regState = regResponse.regState;
|
||||
parent_network.notify(info.serial);
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioNetworkResponse::isNrDualConnectivityEnabledResponse(
|
||||
const RadioResponseInfo& info, bool isEnabled) {
|
||||
rspInfo = info;
|
||||
isNrDualConnectivityEnabled = isEnabled;
|
||||
parent_network.notify(info.serial);
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioNetworkResponse::setAllowedNetworkTypesBitmapResponse(
|
||||
const RadioResponseInfo& info) {
|
||||
rspInfo = info;
|
||||
parent_network.notify(info.serial);
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioNetworkResponse::setBandModeResponse(const RadioResponseInfo& /*info*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioNetworkResponse::setBarringPasswordResponse(
|
||||
const RadioResponseInfo& /*info*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioNetworkResponse::setCdmaRoamingPreferenceResponse(
|
||||
const RadioResponseInfo& /*info*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioNetworkResponse::setCellInfoListRateResponse(
|
||||
const RadioResponseInfo& /*info*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioNetworkResponse::setIndicationFilterResponse(
|
||||
const RadioResponseInfo& /*info*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioNetworkResponse::setLinkCapacityReportingCriteriaResponse(
|
||||
const RadioResponseInfo& /*info*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioNetworkResponse::setLocationUpdatesResponse(
|
||||
const RadioResponseInfo& /*info*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioNetworkResponse::setNetworkSelectionModeAutomaticResponse(
|
||||
const RadioResponseInfo& /*info*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioNetworkResponse::setNetworkSelectionModeManualResponse(
|
||||
const RadioResponseInfo& /*info*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioNetworkResponse::setNrDualConnectivityStateResponse(
|
||||
const RadioResponseInfo& info) {
|
||||
rspInfo = info;
|
||||
parent_network.notify(info.serial);
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioNetworkResponse::setSignalStrengthReportingCriteriaResponse(
|
||||
const RadioResponseInfo& /*info*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioNetworkResponse::setSuppServiceNotificationsResponse(
|
||||
const RadioResponseInfo& /*info*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioNetworkResponse::setSystemSelectionChannelsResponse(
|
||||
const RadioResponseInfo& /*info*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioNetworkResponse::setUsageSettingResponse(
|
||||
const RadioResponseInfo& /*info*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioNetworkResponse::startNetworkScanResponse(
|
||||
const RadioResponseInfo& /*info*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioNetworkResponse::stopNetworkScanResponse(
|
||||
const RadioResponseInfo& /*info*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioNetworkResponse::supplyNetworkDepersonalizationResponse(
|
||||
const RadioResponseInfo& /*info*/, int32_t /*remainingRetries*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
|
@ -1,149 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2021 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 <aidl/android/hardware/radio/config/IRadioConfig.h>
|
||||
#include <android-base/logging.h>
|
||||
#include <android/binder_manager.h>
|
||||
|
||||
#include "radio_network_utils.h"
|
||||
|
||||
#define ASSERT_OK(ret) ASSERT_TRUE(ret.isOk())
|
||||
|
||||
void RadioNetworkTest::SetUp() {
|
||||
std::string serviceName = GetParam();
|
||||
|
||||
if (!isServiceValidForDeviceConfiguration(serviceName)) {
|
||||
ALOGI("Skipped the test due to device configuration.");
|
||||
GTEST_SKIP();
|
||||
}
|
||||
|
||||
radio_network = IRadioNetwork::fromBinder(
|
||||
ndk::SpAIBinder(AServiceManager_waitForService(GetParam().c_str())));
|
||||
ASSERT_NE(nullptr, radio_network.get());
|
||||
|
||||
radioRsp_network = ndk::SharedRefBase::make<RadioNetworkResponse>(*this);
|
||||
ASSERT_NE(nullptr, radioRsp_network.get());
|
||||
|
||||
count_ = 0;
|
||||
|
||||
radioInd_network = ndk::SharedRefBase::make<RadioNetworkIndication>(*this);
|
||||
ASSERT_NE(nullptr, radioInd_network.get());
|
||||
|
||||
radio_network->setResponseFunctions(radioRsp_network, radioInd_network);
|
||||
|
||||
// Assert IRadioConfig exists before testing
|
||||
std::shared_ptr<aidl::android::hardware::radio::config::IRadioConfig> radioConfig =
|
||||
aidl::android::hardware::radio::config::IRadioConfig::fromBinder(
|
||||
ndk::SpAIBinder(AServiceManager_waitForService(
|
||||
"android.hardware.radio.config.IRadioConfig/default")));
|
||||
ASSERT_NE(nullptr, radioConfig.get());
|
||||
}
|
||||
|
||||
/*
|
||||
* Test IRadioNetwork.setAllowedNetworkTypesBitmap for the response returned.
|
||||
*/
|
||||
TEST_P(RadioNetworkTest, setAllowedNetworkTypesBitmap) {
|
||||
serial = GetRandomSerialNumber();
|
||||
RadioAccessFamily allowedNetworkTypesBitmap = RadioAccessFamily::LTE;
|
||||
|
||||
radio_network->setAllowedNetworkTypesBitmap(serial, allowedNetworkTypesBitmap);
|
||||
|
||||
EXPECT_EQ(std::cv_status::no_timeout, wait());
|
||||
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_network->rspInfo.type);
|
||||
EXPECT_EQ(serial, radioRsp_network->rspInfo.serial);
|
||||
ASSERT_TRUE(CheckAnyOfErrors(
|
||||
radioRsp_network->rspInfo.error,
|
||||
{RadioError::NONE, RadioError::RADIO_NOT_AVAILABLE, RadioError::OPERATION_NOT_ALLOWED,
|
||||
RadioError::MODE_NOT_SUPPORTED, RadioError::INTERNAL_ERR, RadioError::MODEM_ERR,
|
||||
RadioError::INVALID_ARGUMENTS, RadioError::REQUEST_NOT_SUPPORTED,
|
||||
RadioError::NO_RESOURCES}));
|
||||
}
|
||||
|
||||
/*
|
||||
* Test IRadioNetwork.getAllowedNetworkTypesBitmap for the response returned.
|
||||
*/
|
||||
TEST_P(RadioNetworkTest, getAllowedNetworkTypesBitmap) {
|
||||
serial = GetRandomSerialNumber();
|
||||
RadioAccessFamily allowedNetworkTypesBitmap = RadioAccessFamily::LTE;
|
||||
|
||||
radio_network->setAllowedNetworkTypesBitmap(serial, allowedNetworkTypesBitmap);
|
||||
|
||||
EXPECT_EQ(std::cv_status::no_timeout, wait());
|
||||
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_network->rspInfo.type);
|
||||
EXPECT_EQ(serial, radioRsp_network->rspInfo.serial);
|
||||
|
||||
if (radioRsp_network->rspInfo.error == RadioError::NONE) {
|
||||
sleep(3); // wait for modem
|
||||
serial = GetRandomSerialNumber();
|
||||
radio_network->getAllowedNetworkTypesBitmap(serial);
|
||||
|
||||
EXPECT_EQ(std::cv_status::no_timeout, wait());
|
||||
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_network->rspInfo.type);
|
||||
EXPECT_EQ(serial, radioRsp_network->rspInfo.serial);
|
||||
ASSERT_TRUE(CheckAnyOfErrors(
|
||||
radioRsp_network->rspInfo.error,
|
||||
{RadioError::NONE, RadioError::RADIO_NOT_AVAILABLE, RadioError::INTERNAL_ERR,
|
||||
RadioError::OPERATION_NOT_ALLOWED, RadioError::MODE_NOT_SUPPORTED,
|
||||
RadioError::INVALID_ARGUMENTS, RadioError::MODEM_ERR,
|
||||
RadioError::REQUEST_NOT_SUPPORTED, RadioError::NO_RESOURCES}));
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Test IRadioNetwork.setNrDualConnectivityState() for the response returned.
|
||||
*/
|
||||
TEST_P(RadioNetworkTest, setNrDualConnectivityState) {
|
||||
serial = GetRandomSerialNumber();
|
||||
|
||||
ndk::ScopedAStatus res =
|
||||
radio_network->setNrDualConnectivityState(serial, NrDualConnectivityState::DISABLE);
|
||||
ASSERT_OK(res);
|
||||
|
||||
EXPECT_EQ(std::cv_status::no_timeout, wait());
|
||||
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_network->rspInfo.type);
|
||||
EXPECT_EQ(serial, radioRsp_network->rspInfo.serial);
|
||||
if (getRadioHalCapabilities()) {
|
||||
ASSERT_TRUE(CheckAnyOfErrors(radioRsp_network->rspInfo.error,
|
||||
{RadioError::REQUEST_NOT_SUPPORTED}));
|
||||
} else {
|
||||
ASSERT_TRUE(CheckAnyOfErrors(
|
||||
radioRsp_network->rspInfo.error,
|
||||
{RadioError::RADIO_NOT_AVAILABLE, RadioError::INTERNAL_ERR,
|
||||
RadioError::INVALID_STATE, RadioError::REQUEST_NOT_SUPPORTED, RadioError::NONE}));
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Test IRadioNetwork.isNrDualConnectivityEnabled() for the response returned.
|
||||
*/
|
||||
TEST_P(RadioNetworkTest, isNrDualConnectivityEnabled) {
|
||||
serial = GetRandomSerialNumber();
|
||||
|
||||
ndk::ScopedAStatus res = radio_network->isNrDualConnectivityEnabled(serial);
|
||||
ASSERT_OK(res);
|
||||
|
||||
EXPECT_EQ(std::cv_status::no_timeout, wait());
|
||||
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_network->rspInfo.type);
|
||||
EXPECT_EQ(serial, radioRsp_network->rspInfo.serial);
|
||||
if (getRadioHalCapabilities()) {
|
||||
ASSERT_TRUE(CheckAnyOfErrors(radioRsp_network->rspInfo.error,
|
||||
{RadioError::REQUEST_NOT_SUPPORTED}));
|
||||
} else {
|
||||
ASSERT_TRUE(CheckAnyOfErrors(
|
||||
radioRsp_network->rspInfo.error,
|
||||
{RadioError::RADIO_NOT_AVAILABLE, RadioError::INTERNAL_ERR, RadioError::NONE}));
|
||||
}
|
||||
}
|
|
@ -1,214 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2021 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.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <aidl/android/hardware/radio/network/BnRadioNetworkIndication.h>
|
||||
#include <aidl/android/hardware/radio/network/BnRadioNetworkResponse.h>
|
||||
#include <aidl/android/hardware/radio/network/IRadioNetwork.h>
|
||||
|
||||
#include "radio_aidl_hal_utils.h"
|
||||
|
||||
using namespace aidl::android::hardware::radio::network;
|
||||
|
||||
class RadioNetworkTest;
|
||||
|
||||
/* Callback class for radio network response */
|
||||
class RadioNetworkResponse : public BnRadioNetworkResponse {
|
||||
protected:
|
||||
RadioResponseWaiter& parent_network;
|
||||
|
||||
public:
|
||||
RadioNetworkResponse(RadioResponseWaiter& parent_network);
|
||||
virtual ~RadioNetworkResponse() = default;
|
||||
|
||||
RadioResponseInfo rspInfo;
|
||||
std::vector<RadioBandMode> radioBandModes;
|
||||
std::vector<OperatorInfo> networkInfos;
|
||||
bool isNrDualConnectivityEnabled;
|
||||
RadioAccessFamily networkTypeBitmapResponse;
|
||||
RegStateResult regStateResp;
|
||||
CellIdentity barringCellIdentity;
|
||||
std::vector<BarringInfo> barringInfos;
|
||||
|
||||
virtual ndk::ScopedAStatus acknowledgeRequest(int32_t serial) override;
|
||||
|
||||
virtual ndk::ScopedAStatus getAllowedNetworkTypesBitmapResponse(
|
||||
const RadioResponseInfo& info, const RadioAccessFamily networkTypeBitmap) override;
|
||||
|
||||
virtual ndk::ScopedAStatus getAvailableBandModesResponse(
|
||||
const RadioResponseInfo& info, const std::vector<RadioBandMode>& bandModes) override;
|
||||
|
||||
virtual ndk::ScopedAStatus getAvailableNetworksResponse(
|
||||
const RadioResponseInfo& info, const std::vector<OperatorInfo>& networkInfos) override;
|
||||
|
||||
virtual ndk::ScopedAStatus getBarringInfoResponse(
|
||||
const RadioResponseInfo& info, const CellIdentity& cellIdentity,
|
||||
const std::vector<BarringInfo>& barringInfos) override;
|
||||
|
||||
virtual ndk::ScopedAStatus getCdmaRoamingPreferenceResponse(const RadioResponseInfo& info,
|
||||
CdmaRoamingType type) override;
|
||||
|
||||
virtual ndk::ScopedAStatus getCellInfoListResponse(
|
||||
const RadioResponseInfo& info, const std::vector<CellInfo>& cellInfo) override;
|
||||
|
||||
virtual ndk::ScopedAStatus getDataRegistrationStateResponse(
|
||||
const RadioResponseInfo& info, const RegStateResult& dataRegResponse) override;
|
||||
|
||||
virtual ndk::ScopedAStatus getImsRegistrationStateResponse(
|
||||
const RadioResponseInfo& info, bool isRegistered,
|
||||
RadioTechnologyFamily ratFamily) override;
|
||||
|
||||
virtual ndk::ScopedAStatus getNetworkSelectionModeResponse(const RadioResponseInfo& info,
|
||||
bool manual) override;
|
||||
|
||||
virtual ndk::ScopedAStatus getOperatorResponse(const RadioResponseInfo& info,
|
||||
const std::string& longName,
|
||||
const std::string& shortName,
|
||||
const std::string& numeric) override;
|
||||
|
||||
virtual ndk::ScopedAStatus getSignalStrengthResponse(
|
||||
const RadioResponseInfo& info, const SignalStrength& sigStrength) override;
|
||||
|
||||
virtual ndk::ScopedAStatus getSystemSelectionChannelsResponse(
|
||||
const RadioResponseInfo& info,
|
||||
const std::vector<RadioAccessSpecifier>& specifier) override;
|
||||
|
||||
virtual ndk::ScopedAStatus getUsageSettingResponse(const RadioResponseInfo& info,
|
||||
UsageSetting usageSetting) override;
|
||||
|
||||
virtual ndk::ScopedAStatus getVoiceRadioTechnologyResponse(const RadioResponseInfo& info,
|
||||
RadioTechnology rat) override;
|
||||
|
||||
virtual ndk::ScopedAStatus getVoiceRegistrationStateResponse(
|
||||
const RadioResponseInfo& info, const RegStateResult& voiceRegResponse) override;
|
||||
|
||||
virtual ndk::ScopedAStatus isNrDualConnectivityEnabledResponse(const RadioResponseInfo& info,
|
||||
bool isEnabled) override;
|
||||
|
||||
virtual ndk::ScopedAStatus setAllowedNetworkTypesBitmapResponse(
|
||||
const RadioResponseInfo& info) override;
|
||||
|
||||
virtual ndk::ScopedAStatus setBandModeResponse(const RadioResponseInfo& info) override;
|
||||
|
||||
virtual ndk::ScopedAStatus setBarringPasswordResponse(const RadioResponseInfo& info) override;
|
||||
|
||||
virtual ndk::ScopedAStatus setCdmaRoamingPreferenceResponse(
|
||||
const RadioResponseInfo& info) override;
|
||||
|
||||
virtual ndk::ScopedAStatus setCellInfoListRateResponse(const RadioResponseInfo& info) override;
|
||||
|
||||
virtual ndk::ScopedAStatus setIndicationFilterResponse(const RadioResponseInfo& info) override;
|
||||
|
||||
virtual ndk::ScopedAStatus setLinkCapacityReportingCriteriaResponse(
|
||||
const RadioResponseInfo& info) override;
|
||||
|
||||
virtual ndk::ScopedAStatus setLocationUpdatesResponse(const RadioResponseInfo& info) override;
|
||||
|
||||
virtual ndk::ScopedAStatus setNetworkSelectionModeAutomaticResponse(
|
||||
const RadioResponseInfo& info) override;
|
||||
|
||||
virtual ndk::ScopedAStatus setNetworkSelectionModeManualResponse(
|
||||
const RadioResponseInfo& info) override;
|
||||
|
||||
virtual ndk::ScopedAStatus setNrDualConnectivityStateResponse(
|
||||
const RadioResponseInfo& info) override;
|
||||
|
||||
virtual ndk::ScopedAStatus setSignalStrengthReportingCriteriaResponse(
|
||||
const RadioResponseInfo& info) override;
|
||||
|
||||
virtual ndk::ScopedAStatus setSuppServiceNotificationsResponse(
|
||||
const RadioResponseInfo& info) override;
|
||||
|
||||
virtual ndk::ScopedAStatus setSystemSelectionChannelsResponse(
|
||||
const RadioResponseInfo& info) override;
|
||||
|
||||
virtual ndk::ScopedAStatus setUsageSettingResponse(const RadioResponseInfo& info) override;
|
||||
|
||||
virtual ndk::ScopedAStatus startNetworkScanResponse(const RadioResponseInfo& info) override;
|
||||
|
||||
virtual ndk::ScopedAStatus stopNetworkScanResponse(const RadioResponseInfo& info) override;
|
||||
|
||||
virtual ndk::ScopedAStatus supplyNetworkDepersonalizationResponse(
|
||||
const RadioResponseInfo& info, int32_t remainingRetries) override;
|
||||
};
|
||||
|
||||
/* Callback class for radio network indication */
|
||||
class RadioNetworkIndication : public BnRadioNetworkIndication {
|
||||
protected:
|
||||
RadioNetworkTest& parent_network;
|
||||
|
||||
public:
|
||||
RadioNetworkIndication(RadioNetworkTest& parent_network);
|
||||
virtual ~RadioNetworkIndication() = default;
|
||||
|
||||
virtual ndk::ScopedAStatus barringInfoChanged(
|
||||
RadioIndicationType type, const CellIdentity& cellIdentity,
|
||||
const std::vector<BarringInfo>& barringInfos) override;
|
||||
|
||||
virtual ndk::ScopedAStatus cdmaPrlChanged(RadioIndicationType type, int32_t version) override;
|
||||
|
||||
virtual ndk::ScopedAStatus cellInfoList(RadioIndicationType type,
|
||||
const std::vector<CellInfo>& records) override;
|
||||
|
||||
virtual ndk::ScopedAStatus currentLinkCapacityEstimate(
|
||||
RadioIndicationType type, const LinkCapacityEstimate& lce) override;
|
||||
|
||||
virtual ndk::ScopedAStatus currentPhysicalChannelConfigs(
|
||||
RadioIndicationType type, const std::vector<PhysicalChannelConfig>& configs) override;
|
||||
|
||||
virtual ndk::ScopedAStatus currentSignalStrength(RadioIndicationType type,
|
||||
const SignalStrength& signalStrength) override;
|
||||
|
||||
virtual ndk::ScopedAStatus imsNetworkStateChanged(RadioIndicationType type) override;
|
||||
|
||||
virtual ndk::ScopedAStatus networkScanResult(RadioIndicationType type,
|
||||
const NetworkScanResult& result) override;
|
||||
|
||||
virtual ndk::ScopedAStatus networkStateChanged(RadioIndicationType type) override;
|
||||
|
||||
virtual ndk::ScopedAStatus nitzTimeReceived(RadioIndicationType type,
|
||||
const std::string& nitzTime, int64_t receivedTimeMs,
|
||||
int64_t ageMs) override;
|
||||
|
||||
virtual ndk::ScopedAStatus registrationFailed(RadioIndicationType type,
|
||||
const CellIdentity& cellIdentity,
|
||||
const std::string& chosenPlmn, Domain domain,
|
||||
int32_t causeCode,
|
||||
int32_t additionalCauseCode) override;
|
||||
|
||||
virtual ndk::ScopedAStatus restrictedStateChanged(RadioIndicationType type,
|
||||
PhoneRestrictedState state) override;
|
||||
|
||||
virtual ndk::ScopedAStatus suppSvcNotify(RadioIndicationType type,
|
||||
const SuppSvcNotification& suppSvc) override;
|
||||
|
||||
virtual ndk::ScopedAStatus voiceRadioTechChanged(RadioIndicationType type,
|
||||
RadioTechnology rat) override;
|
||||
};
|
||||
|
||||
// The main test class for Radio AIDL Network.
|
||||
class RadioNetworkTest : public ::testing::TestWithParam<std::string>, public RadioResponseWaiter {
|
||||
public:
|
||||
virtual void SetUp() override;
|
||||
|
||||
/* radio network service handle */
|
||||
std::shared_ptr<IRadioNetwork> radio_network;
|
||||
/* radio network response handle */
|
||||
std::shared_ptr<RadioNetworkResponse> radioRsp_network;
|
||||
/* radio network indication handle */
|
||||
std::shared_ptr<RadioNetworkIndication> radioInd_network;
|
||||
};
|
|
@ -1,71 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2021 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_sim_utils.h"
|
||||
|
||||
RadioSimIndication::RadioSimIndication(RadioSimTest& parent) : parent_sim(parent) {}
|
||||
|
||||
ndk::ScopedAStatus RadioSimIndication::carrierInfoForImsiEncryption(RadioIndicationType /*info*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioSimIndication::cdmaSubscriptionSourceChanged(
|
||||
RadioIndicationType /*type*/, CdmaSubscriptionSource /*cdmaSource*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioSimIndication::simPhonebookChanged(RadioIndicationType /*type*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioSimIndication::simPhonebookRecordsReceived(
|
||||
RadioIndicationType /*type*/, PbReceivedStatus /*status*/,
|
||||
const std::vector<PhonebookRecordInfo>& /*records*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioSimIndication::simRefresh(RadioIndicationType /*type*/,
|
||||
const SimRefreshResult& /*refreshResult*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioSimIndication::simStatusChanged(RadioIndicationType /*type*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioSimIndication::stkEventNotify(RadioIndicationType /*type*/,
|
||||
const std::string& /*cmd*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioSimIndication::stkProactiveCommand(RadioIndicationType /*type*/,
|
||||
const std::string& /*cmd*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioSimIndication::stkSessionEnd(RadioIndicationType /*type*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioSimIndication::subscriptionStatusChanged(RadioIndicationType /*type*/,
|
||||
bool /*activate*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioSimIndication::uiccApplicationsEnablementChanged(
|
||||
RadioIndicationType /*type*/, bool /*enabled*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
|
@ -1,209 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2021 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_sim_utils.h"
|
||||
|
||||
RadioSimResponse::RadioSimResponse(RadioResponseWaiter& parent) : parent_sim(parent) {}
|
||||
|
||||
ndk::ScopedAStatus RadioSimResponse::acknowledgeRequest(int32_t /*serial*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioSimResponse::areUiccApplicationsEnabledResponse(
|
||||
const RadioResponseInfo& /*info*/, bool /*enabled*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioSimResponse::changeIccPin2ForAppResponse(const RadioResponseInfo& /*info*/,
|
||||
int32_t /*remainingRetries*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioSimResponse::changeIccPinForAppResponse(const RadioResponseInfo& /*info*/,
|
||||
int32_t /*remainingRetries*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioSimResponse::enableUiccApplicationsResponse(
|
||||
const RadioResponseInfo& /*info*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioSimResponse::getAllowedCarriersResponse(
|
||||
const RadioResponseInfo& /*info*/, const CarrierRestrictions& /*carriers*/,
|
||||
SimLockMultiSimPolicy /*multiSimPolicy*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioSimResponse::getCdmaSubscriptionResponse(
|
||||
const RadioResponseInfo& /*info*/, const std::string& /*mdn*/, const std::string& /*hSid*/,
|
||||
const std::string& /*hNid*/, const std::string& /*min*/, const std::string& /*prl*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioSimResponse::getCdmaSubscriptionSourceResponse(
|
||||
const RadioResponseInfo& /*info*/, CdmaSubscriptionSource /*source*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioSimResponse::getFacilityLockForAppResponse(
|
||||
const RadioResponseInfo& /*info*/, int32_t /*response*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioSimResponse::getIccCardStatusResponse(const RadioResponseInfo& info,
|
||||
const CardStatus& card_status) {
|
||||
rspInfo = info;
|
||||
cardStatus = card_status;
|
||||
parent_sim.notify(info.serial);
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioSimResponse::getImsiForAppResponse(const RadioResponseInfo& /*info*/,
|
||||
const std::string& /*imsi*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioSimResponse::getSimPhonebookCapacityResponse(
|
||||
const RadioResponseInfo& info, const PhonebookCapacity& pbCapacity) {
|
||||
rspInfo = info;
|
||||
capacity = pbCapacity;
|
||||
parent_sim.notify(info.serial);
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioSimResponse::getSimPhonebookRecordsResponse(const RadioResponseInfo& info) {
|
||||
rspInfo = info;
|
||||
parent_sim.notify(info.serial);
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioSimResponse::iccCloseLogicalChannelResponse(
|
||||
const RadioResponseInfo& /*info*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioSimResponse::iccIoForAppResponse(const RadioResponseInfo& /*info*/,
|
||||
const IccIoResult& /*iccIo*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioSimResponse::iccOpenLogicalChannelResponse(
|
||||
const RadioResponseInfo& /*info*/, int32_t /*channelId*/,
|
||||
const std::vector<uint8_t>& /*selectResponse*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioSimResponse::iccTransmitApduBasicChannelResponse(
|
||||
const RadioResponseInfo& /*info*/, const IccIoResult& /*result*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioSimResponse::iccTransmitApduLogicalChannelResponse(
|
||||
const RadioResponseInfo& /*info*/, const IccIoResult& /*result*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioSimResponse::reportStkServiceIsRunningResponse(
|
||||
const RadioResponseInfo& /*info*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioSimResponse::requestIccSimAuthenticationResponse(
|
||||
const RadioResponseInfo& /*info*/, const IccIoResult& /*result*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioSimResponse::sendEnvelopeResponse(const RadioResponseInfo& /*info*/,
|
||||
const std::string& /*commandResponse*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioSimResponse::sendEnvelopeWithStatusResponse(
|
||||
const RadioResponseInfo& /*info*/, const IccIoResult& /*iccIo*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioSimResponse::sendTerminalResponseToSimResponse(
|
||||
const RadioResponseInfo& /*info*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioSimResponse::setAllowedCarriersResponse(const RadioResponseInfo& /*info*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioSimResponse::setCarrierInfoForImsiEncryptionResponse(
|
||||
const RadioResponseInfo& info) {
|
||||
rspInfo = info;
|
||||
parent_sim.notify(info.serial);
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioSimResponse::setCdmaSubscriptionSourceResponse(
|
||||
const RadioResponseInfo& /*info*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioSimResponse::setFacilityLockForAppResponse(
|
||||
const RadioResponseInfo& /*info*/, int32_t /*retry*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioSimResponse::setSimCardPowerResponse(const RadioResponseInfo& info) {
|
||||
rspInfo = info;
|
||||
parent_sim.notify(info.serial);
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioSimResponse::setUiccSubscriptionResponse(
|
||||
const RadioResponseInfo& /*info*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioSimResponse::supplyIccPin2ForAppResponse(const RadioResponseInfo& /*info*/,
|
||||
int32_t /*remainingRetries*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioSimResponse::supplyIccPinForAppResponse(const RadioResponseInfo& /*info*/,
|
||||
int32_t /*remainingRetries*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioSimResponse::supplyIccPuk2ForAppResponse(const RadioResponseInfo& /*info*/,
|
||||
int32_t /*remainingRetries*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioSimResponse::supplyIccPukForAppResponse(const RadioResponseInfo& /*info*/,
|
||||
int32_t /*remainingRetries*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioSimResponse::supplySimDepersonalizationResponse(
|
||||
const RadioResponseInfo& /*info*/, PersoSubstate /*persoType*/,
|
||||
int32_t /*remainingRetries*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioSimResponse::updateSimPhonebookRecordsResponse(
|
||||
const RadioResponseInfo& info, int32_t recordIndex) {
|
||||
rspInfo = info;
|
||||
updatedRecordIndex = recordIndex;
|
||||
parent_sim.notify(info.serial);
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
|
@ -1,259 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2021 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 <aidl/android/hardware/radio/config/IRadioConfig.h>
|
||||
#include <android-base/logging.h>
|
||||
#include <android/binder_manager.h>
|
||||
|
||||
#include "radio_sim_utils.h"
|
||||
|
||||
#define ASSERT_OK(ret) ASSERT_TRUE(ret.isOk())
|
||||
|
||||
void RadioSimTest::SetUp() {
|
||||
std::string serviceName = GetParam();
|
||||
|
||||
if (!isServiceValidForDeviceConfiguration(serviceName)) {
|
||||
ALOGI("Skipped the test due to device configuration.");
|
||||
GTEST_SKIP();
|
||||
}
|
||||
|
||||
radio_sim = IRadioSim::fromBinder(
|
||||
ndk::SpAIBinder(AServiceManager_waitForService(GetParam().c_str())));
|
||||
ASSERT_NE(nullptr, radio_sim.get());
|
||||
|
||||
radioRsp_sim = ndk::SharedRefBase::make<RadioSimResponse>(*this);
|
||||
ASSERT_NE(nullptr, radioRsp_sim.get());
|
||||
|
||||
count_ = 0;
|
||||
|
||||
radioInd_sim = ndk::SharedRefBase::make<RadioSimIndication>(*this);
|
||||
ASSERT_NE(nullptr, radioInd_sim.get());
|
||||
|
||||
radio_sim->setResponseFunctions(radioRsp_sim, radioInd_sim);
|
||||
|
||||
// Assert IRadioConfig exists before testing
|
||||
std::shared_ptr<aidl::android::hardware::radio::config::IRadioConfig> radioConfig =
|
||||
aidl::android::hardware::radio::config::IRadioConfig::fromBinder(
|
||||
ndk::SpAIBinder(AServiceManager_waitForService(
|
||||
"android.hardware.radio.config.IRadioConfig/default")));
|
||||
ASSERT_NE(nullptr, radioConfig.get());
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioSimTest::updateSimCardStatus() {
|
||||
serial = GetRandomSerialNumber();
|
||||
radio_sim->getIccCardStatus(serial);
|
||||
EXPECT_EQ(std::cv_status::no_timeout, wait());
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
/*
|
||||
* Test IRadioSim.setSimCardPower() for the response returned.
|
||||
*/
|
||||
TEST_P(RadioSimTest, setSimCardPower) {
|
||||
/* Test setSimCardPower power down */
|
||||
serial = GetRandomSerialNumber();
|
||||
radio_sim->setSimCardPower(serial, CardPowerState::POWER_DOWN);
|
||||
EXPECT_EQ(std::cv_status::no_timeout, wait());
|
||||
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_sim->rspInfo.type);
|
||||
EXPECT_EQ(serial, radioRsp_sim->rspInfo.serial);
|
||||
ASSERT_TRUE(CheckAnyOfErrors(radioRsp_sim->rspInfo.error,
|
||||
{RadioError::NONE, RadioError::INVALID_ARGUMENTS,
|
||||
RadioError::RADIO_NOT_AVAILABLE, RadioError::SIM_ERR}));
|
||||
|
||||
// setSimCardPower does not return until the request is handled, and should not trigger
|
||||
// CardStatus::STATE_ABSENT when turning off power
|
||||
if (radioRsp_sim->rspInfo.error == RadioError::NONE) {
|
||||
/* Wait some time for setting sim power down and then verify it */
|
||||
updateSimCardStatus();
|
||||
// We cannot assert the consistency of CardState here due to b/203031664
|
||||
// EXPECT_EQ(CardStatus::STATE_PRESENT, cardStatus.cardState);
|
||||
// applications should be an empty vector of AppStatus
|
||||
EXPECT_EQ(0, cardStatus.applications.size());
|
||||
}
|
||||
|
||||
// Give some time for modem to fully power down the SIM card
|
||||
sleep(MODEM_SET_SIM_POWER_DELAY_IN_SECONDS);
|
||||
|
||||
/* Test setSimCardPower power up */
|
||||
serial = GetRandomSerialNumber();
|
||||
radio_sim->setSimCardPower(serial, CardPowerState::POWER_UP);
|
||||
EXPECT_EQ(std::cv_status::no_timeout, wait());
|
||||
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_sim->rspInfo.type);
|
||||
EXPECT_EQ(serial, radioRsp_sim->rspInfo.serial);
|
||||
ASSERT_TRUE(CheckAnyOfErrors(radioRsp_sim->rspInfo.error,
|
||||
{RadioError::NONE, RadioError::INVALID_ARGUMENTS,
|
||||
RadioError::RADIO_NOT_AVAILABLE, RadioError::SIM_ERR}));
|
||||
|
||||
// Give some time for modem to fully power up the SIM card
|
||||
sleep(MODEM_SET_SIM_POWER_DELAY_IN_SECONDS);
|
||||
|
||||
// setSimCardPower does not return until the request is handled. Just verify that we still
|
||||
// have CardStatus::STATE_PRESENT after turning the power back on
|
||||
if (radioRsp_sim->rspInfo.error == RadioError::NONE) {
|
||||
updateSimCardStatus();
|
||||
EXPECT_EQ(CardStatus::STATE_PRESENT, cardStatus.cardState);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Test IRadioSim.setCarrierInfoForImsiEncryption() for the response returned.
|
||||
*/
|
||||
TEST_P(RadioSimTest, setCarrierInfoForImsiEncryption) {
|
||||
serial = GetRandomSerialNumber();
|
||||
ImsiEncryptionInfo imsiInfo;
|
||||
imsiInfo.mcc = "310";
|
||||
imsiInfo.mnc = "004";
|
||||
imsiInfo.carrierKey = (std::vector<uint8_t>){1, 2, 3, 4, 5, 6};
|
||||
imsiInfo.keyIdentifier = "Test";
|
||||
imsiInfo.expirationTime = 20180101;
|
||||
imsiInfo.keyType = ImsiEncryptionInfo::PUBLIC_KEY_TYPE_EPDG;
|
||||
|
||||
radio_sim->setCarrierInfoForImsiEncryption(serial, imsiInfo);
|
||||
EXPECT_EQ(std::cv_status::no_timeout, wait());
|
||||
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_sim->rspInfo.type);
|
||||
EXPECT_EQ(serial, radioRsp_sim->rspInfo.serial);
|
||||
|
||||
if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
|
||||
ASSERT_TRUE(CheckAnyOfErrors(radioRsp_sim->rspInfo.error,
|
||||
{RadioError::NONE, RadioError::REQUEST_NOT_SUPPORTED}));
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Test IRadioSim.getSimPhonebookRecords() for the response returned.
|
||||
*/
|
||||
TEST_P(RadioSimTest, getSimPhonebookRecords) {
|
||||
serial = GetRandomSerialNumber();
|
||||
radio_sim->getSimPhonebookRecords(serial);
|
||||
EXPECT_EQ(std::cv_status::no_timeout, wait());
|
||||
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_sim->rspInfo.type);
|
||||
EXPECT_EQ(serial, radioRsp_sim->rspInfo.serial);
|
||||
if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
|
||||
ASSERT_TRUE(
|
||||
CheckAnyOfErrors(radioRsp_sim->rspInfo.error,
|
||||
{RadioError::INVALID_SIM_STATE, RadioError::RADIO_NOT_AVAILABLE,
|
||||
RadioError::MODEM_ERR, RadioError::INVALID_ARGUMENTS,
|
||||
RadioError::REQUEST_NOT_SUPPORTED},
|
||||
CHECK_GENERAL_ERROR));
|
||||
} else if (cardStatus.cardState == CardStatus::STATE_PRESENT) {
|
||||
ASSERT_TRUE(CheckAnyOfErrors(radioRsp_sim->rspInfo.error,
|
||||
{RadioError::NONE, RadioError::REQUEST_NOT_SUPPORTED},
|
||||
CHECK_GENERAL_ERROR));
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Test IRadioSim.getSimPhonebookCapacity for the response returned.
|
||||
*/
|
||||
TEST_P(RadioSimTest, getSimPhonebookCapacity) {
|
||||
serial = GetRandomSerialNumber();
|
||||
radio_sim->getSimPhonebookCapacity(serial);
|
||||
EXPECT_EQ(std::cv_status::no_timeout, wait());
|
||||
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_sim->rspInfo.type);
|
||||
EXPECT_EQ(serial, radioRsp_sim->rspInfo.serial);
|
||||
if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
|
||||
ASSERT_TRUE(
|
||||
CheckAnyOfErrors(radioRsp_sim->rspInfo.error,
|
||||
{RadioError::INVALID_SIM_STATE, RadioError::RADIO_NOT_AVAILABLE,
|
||||
RadioError::MODEM_ERR, RadioError::INVALID_ARGUMENTS,
|
||||
RadioError::REQUEST_NOT_SUPPORTED},
|
||||
CHECK_GENERAL_ERROR));
|
||||
} else if (cardStatus.cardState == CardStatus::STATE_PRESENT) {
|
||||
ASSERT_TRUE(CheckAnyOfErrors(radioRsp_sim->rspInfo.error,
|
||||
{RadioError::NONE, RadioError::REQUEST_NOT_SUPPORTED},
|
||||
CHECK_GENERAL_ERROR));
|
||||
|
||||
PhonebookCapacity pbCapacity = radioRsp_sim->capacity;
|
||||
if (pbCapacity.maxAdnRecords > 0) {
|
||||
EXPECT_TRUE(pbCapacity.maxNameLen > 0 && pbCapacity.maxNumberLen > 0);
|
||||
EXPECT_TRUE(pbCapacity.usedAdnRecords <= pbCapacity.maxAdnRecords);
|
||||
}
|
||||
|
||||
if (pbCapacity.maxEmailRecords > 0) {
|
||||
EXPECT_TRUE(pbCapacity.maxEmailLen > 0);
|
||||
EXPECT_TRUE(pbCapacity.usedEmailRecords <= pbCapacity.maxEmailRecords);
|
||||
}
|
||||
|
||||
if (pbCapacity.maxAdditionalNumberRecords > 0) {
|
||||
EXPECT_TRUE(pbCapacity.maxAdditionalNumberLen > 0);
|
||||
EXPECT_TRUE(pbCapacity.usedAdditionalNumberRecords <=
|
||||
pbCapacity.maxAdditionalNumberRecords);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Test IRadioSim.updateSimPhonebookRecords() for the response returned.
|
||||
*/
|
||||
TEST_P(RadioSimTest, updateSimPhonebookRecords) {
|
||||
serial = GetRandomSerialNumber();
|
||||
radio_sim->getSimPhonebookCapacity(serial);
|
||||
EXPECT_EQ(std::cv_status::no_timeout, wait());
|
||||
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_sim->rspInfo.type);
|
||||
EXPECT_EQ(serial, radioRsp_sim->rspInfo.serial);
|
||||
if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
|
||||
ASSERT_TRUE(
|
||||
CheckAnyOfErrors(radioRsp_sim->rspInfo.error,
|
||||
{RadioError::INVALID_SIM_STATE, RadioError::RADIO_NOT_AVAILABLE,
|
||||
RadioError::MODEM_ERR, RadioError::INVALID_ARGUMENTS,
|
||||
RadioError::REQUEST_NOT_SUPPORTED},
|
||||
CHECK_GENERAL_ERROR));
|
||||
} else if (cardStatus.cardState == CardStatus::STATE_PRESENT) {
|
||||
ASSERT_TRUE(CheckAnyOfErrors(radioRsp_sim->rspInfo.error,
|
||||
{RadioError::NONE, RadioError::REQUEST_NOT_SUPPORTED},
|
||||
CHECK_GENERAL_ERROR));
|
||||
PhonebookCapacity pbCapacity = radioRsp_sim->capacity;
|
||||
|
||||
serial = GetRandomSerialNumber();
|
||||
radio_sim->getSimPhonebookRecords(serial);
|
||||
|
||||
EXPECT_EQ(std::cv_status::no_timeout, wait());
|
||||
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_sim->rspInfo.type);
|
||||
EXPECT_EQ(serial, radioRsp_sim->rspInfo.serial);
|
||||
ASSERT_TRUE(CheckAnyOfErrors(radioRsp_sim->rspInfo.error,
|
||||
{RadioError::NONE, RadioError::REQUEST_NOT_SUPPORTED},
|
||||
CHECK_GENERAL_ERROR));
|
||||
|
||||
if (pbCapacity.maxAdnRecords > 0 && pbCapacity.usedAdnRecords < pbCapacity.maxAdnRecords) {
|
||||
// Add a phonebook record
|
||||
PhonebookRecordInfo recordInfo;
|
||||
recordInfo.recordId = 0;
|
||||
recordInfo.name = "ABC";
|
||||
recordInfo.number = "1234567890";
|
||||
serial = GetRandomSerialNumber();
|
||||
radio_sim->updateSimPhonebookRecords(serial, recordInfo);
|
||||
|
||||
EXPECT_EQ(std::cv_status::no_timeout, wait());
|
||||
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_sim->rspInfo.type);
|
||||
EXPECT_EQ(serial, radioRsp_sim->rspInfo.serial);
|
||||
EXPECT_EQ(RadioError::NONE, radioRsp_sim->rspInfo.error);
|
||||
int index = radioRsp_sim->updatedRecordIndex;
|
||||
EXPECT_TRUE(index > 0);
|
||||
|
||||
// Deleted a phonebook record
|
||||
recordInfo.recordId = index;
|
||||
recordInfo.name = "";
|
||||
recordInfo.number = "";
|
||||
serial = GetRandomSerialNumber();
|
||||
radio_sim->updateSimPhonebookRecords(serial, recordInfo);
|
||||
|
||||
EXPECT_EQ(std::cv_status::no_timeout, wait());
|
||||
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_sim->rspInfo.type);
|
||||
EXPECT_EQ(serial, radioRsp_sim->rspInfo.serial);
|
||||
EXPECT_EQ(RadioError::NONE, radioRsp_sim->rspInfo.error);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,207 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2021 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.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <aidl/android/hardware/radio/sim/BnRadioSimIndication.h>
|
||||
#include <aidl/android/hardware/radio/sim/BnRadioSimResponse.h>
|
||||
#include <aidl/android/hardware/radio/sim/IRadioSim.h>
|
||||
|
||||
#include "radio_aidl_hal_utils.h"
|
||||
|
||||
using namespace aidl::android::hardware::radio::sim;
|
||||
|
||||
class RadioSimTest;
|
||||
|
||||
/* Callback class for radio SIM response */
|
||||
class RadioSimResponse : public BnRadioSimResponse {
|
||||
protected:
|
||||
RadioResponseWaiter& parent_sim;
|
||||
|
||||
public:
|
||||
RadioSimResponse(RadioResponseWaiter& parent_sim);
|
||||
virtual ~RadioSimResponse() = default;
|
||||
|
||||
RadioResponseInfo rspInfo;
|
||||
CarrierRestrictions carrierRestrictionsResp;
|
||||
SimLockMultiSimPolicy multiSimPolicyResp;
|
||||
bool canToggleUiccApplicationsEnablement;
|
||||
bool areUiccApplicationsEnabled;
|
||||
PhonebookCapacity capacity;
|
||||
int32_t updatedRecordIndex;
|
||||
|
||||
virtual ndk::ScopedAStatus acknowledgeRequest(int32_t serial) override;
|
||||
|
||||
virtual ndk::ScopedAStatus areUiccApplicationsEnabledResponse(const RadioResponseInfo& info,
|
||||
bool enabled) override;
|
||||
|
||||
virtual ndk::ScopedAStatus changeIccPin2ForAppResponse(const RadioResponseInfo& info,
|
||||
int32_t remainingRetries) override;
|
||||
|
||||
virtual ndk::ScopedAStatus changeIccPinForAppResponse(const RadioResponseInfo& info,
|
||||
int32_t remainingRetries) override;
|
||||
|
||||
virtual ndk::ScopedAStatus enableUiccApplicationsResponse(
|
||||
const RadioResponseInfo& info) override;
|
||||
|
||||
virtual ndk::ScopedAStatus getAllowedCarriersResponse(
|
||||
const RadioResponseInfo& info, const CarrierRestrictions& carriers,
|
||||
const SimLockMultiSimPolicy multiSimPolicy) override;
|
||||
|
||||
virtual ndk::ScopedAStatus getCdmaSubscriptionResponse(
|
||||
const RadioResponseInfo& info, const std::string& mdn, const std::string& hSid,
|
||||
const std::string& hNid, const std::string& min, const std::string& prl) override;
|
||||
|
||||
virtual ndk::ScopedAStatus getCdmaSubscriptionSourceResponse(
|
||||
const RadioResponseInfo& info, CdmaSubscriptionSource source) override;
|
||||
|
||||
virtual ndk::ScopedAStatus getFacilityLockForAppResponse(const RadioResponseInfo& info,
|
||||
int32_t response) override;
|
||||
|
||||
virtual ndk::ScopedAStatus getIccCardStatusResponse(const RadioResponseInfo& info,
|
||||
const CardStatus& cardStatus) override;
|
||||
|
||||
virtual ndk::ScopedAStatus getImsiForAppResponse(const RadioResponseInfo& info,
|
||||
const std::string& imsi) override;
|
||||
|
||||
virtual ndk::ScopedAStatus getSimPhonebookCapacityResponse(
|
||||
const RadioResponseInfo& info, const PhonebookCapacity& capacity) override;
|
||||
|
||||
virtual ndk::ScopedAStatus getSimPhonebookRecordsResponse(
|
||||
const RadioResponseInfo& info) override;
|
||||
|
||||
virtual ndk::ScopedAStatus iccCloseLogicalChannelResponse(
|
||||
const RadioResponseInfo& info) override;
|
||||
|
||||
virtual ndk::ScopedAStatus iccIoForAppResponse(const RadioResponseInfo& info,
|
||||
const IccIoResult& iccIo) override;
|
||||
|
||||
virtual ndk::ScopedAStatus iccOpenLogicalChannelResponse(
|
||||
const RadioResponseInfo& info, int32_t channelId,
|
||||
const std::vector<uint8_t>& selectResponse) override;
|
||||
|
||||
virtual ndk::ScopedAStatus iccTransmitApduBasicChannelResponse(
|
||||
const RadioResponseInfo& info, const IccIoResult& result) override;
|
||||
|
||||
virtual ndk::ScopedAStatus iccTransmitApduLogicalChannelResponse(
|
||||
const RadioResponseInfo& info, const IccIoResult& result) override;
|
||||
|
||||
virtual ndk::ScopedAStatus reportStkServiceIsRunningResponse(
|
||||
const RadioResponseInfo& info) override;
|
||||
|
||||
virtual ndk::ScopedAStatus requestIccSimAuthenticationResponse(
|
||||
const RadioResponseInfo& info, const IccIoResult& result) override;
|
||||
|
||||
virtual ndk::ScopedAStatus sendEnvelopeResponse(const RadioResponseInfo& info,
|
||||
const std::string& commandResponse) override;
|
||||
|
||||
virtual ndk::ScopedAStatus sendEnvelopeWithStatusResponse(const RadioResponseInfo& info,
|
||||
const IccIoResult& iccIo) override;
|
||||
|
||||
virtual ndk::ScopedAStatus sendTerminalResponseToSimResponse(
|
||||
const RadioResponseInfo& info) override;
|
||||
|
||||
virtual ndk::ScopedAStatus setAllowedCarriersResponse(const RadioResponseInfo& info) override;
|
||||
|
||||
virtual ndk::ScopedAStatus setCarrierInfoForImsiEncryptionResponse(
|
||||
const RadioResponseInfo& info) override;
|
||||
|
||||
virtual ndk::ScopedAStatus setCdmaSubscriptionSourceResponse(
|
||||
const RadioResponseInfo& info) override;
|
||||
|
||||
virtual ndk::ScopedAStatus setFacilityLockForAppResponse(const RadioResponseInfo& info,
|
||||
int32_t retry) override;
|
||||
|
||||
virtual ndk::ScopedAStatus setSimCardPowerResponse(const RadioResponseInfo& info) override;
|
||||
|
||||
virtual ndk::ScopedAStatus setUiccSubscriptionResponse(const RadioResponseInfo& info) override;
|
||||
|
||||
virtual ndk::ScopedAStatus supplyIccPin2ForAppResponse(const RadioResponseInfo& info,
|
||||
int32_t remainingRetries) override;
|
||||
|
||||
virtual ndk::ScopedAStatus supplyIccPinForAppResponse(const RadioResponseInfo& info,
|
||||
int32_t remainingRetries) override;
|
||||
|
||||
virtual ndk::ScopedAStatus supplyIccPuk2ForAppResponse(const RadioResponseInfo& info,
|
||||
int32_t remainingRetries) override;
|
||||
|
||||
virtual ndk::ScopedAStatus supplyIccPukForAppResponse(const RadioResponseInfo& info,
|
||||
int32_t remainingRetries) override;
|
||||
|
||||
virtual ndk::ScopedAStatus supplySimDepersonalizationResponse(
|
||||
const RadioResponseInfo& info, PersoSubstate persoType,
|
||||
int32_t remainingRetries) override;
|
||||
|
||||
virtual ndk::ScopedAStatus updateSimPhonebookRecordsResponse(
|
||||
const RadioResponseInfo& info, int32_t updatedRecordIndex) override;
|
||||
};
|
||||
|
||||
/* Callback class for radio SIM indication */
|
||||
class RadioSimIndication : public BnRadioSimIndication {
|
||||
protected:
|
||||
RadioSimTest& parent_sim;
|
||||
|
||||
public:
|
||||
RadioSimIndication(RadioSimTest& parent_sim);
|
||||
virtual ~RadioSimIndication() = default;
|
||||
|
||||
virtual ndk::ScopedAStatus carrierInfoForImsiEncryption(RadioIndicationType info) override;
|
||||
|
||||
virtual ndk::ScopedAStatus cdmaSubscriptionSourceChanged(
|
||||
RadioIndicationType type, CdmaSubscriptionSource cdmaSource) override;
|
||||
|
||||
virtual ndk::ScopedAStatus simPhonebookChanged(RadioIndicationType type) override;
|
||||
|
||||
virtual ndk::ScopedAStatus simPhonebookRecordsReceived(
|
||||
RadioIndicationType type, PbReceivedStatus status,
|
||||
const std::vector<PhonebookRecordInfo>& records) override;
|
||||
|
||||
virtual ndk::ScopedAStatus simRefresh(RadioIndicationType type,
|
||||
const SimRefreshResult& refreshResult) override;
|
||||
|
||||
virtual ndk::ScopedAStatus simStatusChanged(RadioIndicationType type) override;
|
||||
|
||||
virtual ndk::ScopedAStatus stkEventNotify(RadioIndicationType type,
|
||||
const std::string& cmd) override;
|
||||
|
||||
virtual ndk::ScopedAStatus stkProactiveCommand(RadioIndicationType type,
|
||||
const std::string& cmd) override;
|
||||
|
||||
virtual ndk::ScopedAStatus stkSessionEnd(RadioIndicationType type) override;
|
||||
|
||||
virtual ndk::ScopedAStatus subscriptionStatusChanged(RadioIndicationType type,
|
||||
bool activate) override;
|
||||
|
||||
virtual ndk::ScopedAStatus uiccApplicationsEnablementChanged(RadioIndicationType type,
|
||||
bool enabled) override;
|
||||
};
|
||||
|
||||
// The main test class for Radio AIDL SIM.
|
||||
class RadioSimTest : public ::testing::TestWithParam<std::string>, public RadioResponseWaiter {
|
||||
protected:
|
||||
/* Update Sim Card Status */
|
||||
virtual ndk::ScopedAStatus updateSimCardStatus();
|
||||
|
||||
public:
|
||||
virtual void SetUp() override;
|
||||
|
||||
/* radio SIM service handle */
|
||||
std::shared_ptr<IRadioSim> radio_sim;
|
||||
/* radio SIM response handle */
|
||||
std::shared_ptr<RadioSimResponse> radioRsp_sim;
|
||||
/* radio SIM indication handle */
|
||||
std::shared_ptr<RadioSimIndication> radioInd_sim;
|
||||
};
|
|
@ -1,85 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2021 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_voice_utils.h"
|
||||
|
||||
RadioVoiceIndication::RadioVoiceIndication(RadioVoiceTest& parent) : parent_voice(parent) {}
|
||||
|
||||
ndk::ScopedAStatus RadioVoiceIndication::callRing(RadioIndicationType /*type*/, bool /*isGsm*/,
|
||||
const CdmaSignalInfoRecord& /*record*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioVoiceIndication::callStateChanged(RadioIndicationType /*type*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioVoiceIndication::cdmaCallWaiting(
|
||||
RadioIndicationType /*type*/, const CdmaCallWaiting& /*callWaitingRecord*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioVoiceIndication::cdmaInfoRec(
|
||||
RadioIndicationType /*type*/, const std::vector<CdmaInformationRecord>& /*records*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioVoiceIndication::cdmaOtaProvisionStatus(RadioIndicationType /*type*/,
|
||||
CdmaOtaProvisionStatus /*status*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioVoiceIndication::currentEmergencyNumberList(
|
||||
RadioIndicationType /*type*/, const std::vector<EmergencyNumber>& /*emergencyNumberList*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioVoiceIndication::enterEmergencyCallbackMode(RadioIndicationType /*type*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioVoiceIndication::exitEmergencyCallbackMode(RadioIndicationType /*type*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioVoiceIndication::indicateRingbackTone(RadioIndicationType /*type*/,
|
||||
bool /*start*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioVoiceIndication::onSupplementaryServiceIndication(
|
||||
RadioIndicationType /*type*/, const StkCcUnsolSsResult& /*ss*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioVoiceIndication::resendIncallMute(RadioIndicationType /*type*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioVoiceIndication::srvccStateNotify(RadioIndicationType /*type*/,
|
||||
SrvccState /*state*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioVoiceIndication::stkCallControlAlphaNotify(RadioIndicationType /*type*/,
|
||||
const std::string& /*alpha*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioVoiceIndication::stkCallSetup(RadioIndicationType /*type*/,
|
||||
int64_t /*timeout*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
|
@ -1,191 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2021 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_voice_utils.h"
|
||||
|
||||
RadioVoiceResponse::RadioVoiceResponse(RadioResponseWaiter& parent) : parent_voice(parent) {}
|
||||
|
||||
ndk::ScopedAStatus RadioVoiceResponse::acceptCallResponse(const RadioResponseInfo& /*info*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioVoiceResponse::acknowledgeRequest(int32_t /*serial*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioVoiceResponse::conferenceResponse(const RadioResponseInfo& /*info*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioVoiceResponse::dialResponse(const RadioResponseInfo& /*info*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioVoiceResponse::emergencyDialResponse(const RadioResponseInfo& info) {
|
||||
rspInfo = info;
|
||||
parent_voice.notify(info.serial);
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioVoiceResponse::exitEmergencyCallbackModeResponse(
|
||||
const RadioResponseInfo& /*info*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioVoiceResponse::explicitCallTransferResponse(
|
||||
const RadioResponseInfo& /*info*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioVoiceResponse::getCallForwardStatusResponse(
|
||||
const RadioResponseInfo& /*info*/,
|
||||
const std::vector<CallForwardInfo>& /*callForwardInfos*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioVoiceResponse::getCallWaitingResponse(const RadioResponseInfo& /*info*/,
|
||||
bool /*enable*/,
|
||||
int32_t /*serviceClass*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioVoiceResponse::getClipResponse(const RadioResponseInfo& /*info*/,
|
||||
ClipStatus /*status*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioVoiceResponse::getClirResponse(const RadioResponseInfo& /*info*/,
|
||||
int32_t /*n*/, int32_t /*m*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioVoiceResponse::getCurrentCallsResponse(const RadioResponseInfo& info,
|
||||
const std::vector<Call>& calls) {
|
||||
rspInfo = info;
|
||||
currentCalls = calls;
|
||||
parent_voice.notify(info.serial);
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioVoiceResponse::getLastCallFailCauseResponse(
|
||||
const RadioResponseInfo& /*info*/, const LastCallFailCauseInfo& /*failCauseInfo*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioVoiceResponse::getMuteResponse(const RadioResponseInfo& /*info*/,
|
||||
bool /*enable*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioVoiceResponse::getPreferredVoicePrivacyResponse(
|
||||
const RadioResponseInfo& /*info*/, bool /*enable*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioVoiceResponse::getTtyModeResponse(const RadioResponseInfo& /*info*/,
|
||||
TtyMode /*mode*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioVoiceResponse::handleStkCallSetupRequestFromSimResponse(
|
||||
const RadioResponseInfo& /*info*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioVoiceResponse::hangupConnectionResponse(const RadioResponseInfo& info) {
|
||||
rspInfo = info;
|
||||
parent_voice.notify(info.serial);
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioVoiceResponse::hangupForegroundResumeBackgroundResponse(
|
||||
const RadioResponseInfo& /*info*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioVoiceResponse::hangupWaitingOrBackgroundResponse(
|
||||
const RadioResponseInfo& /*info*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioVoiceResponse::isVoNrEnabledResponse(const RadioResponseInfo& /*info*/,
|
||||
bool /*enabled*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioVoiceResponse::rejectCallResponse(const RadioResponseInfo& /*info*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioVoiceResponse::sendBurstDtmfResponse(const RadioResponseInfo& /*info*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioVoiceResponse::sendCdmaFeatureCodeResponse(
|
||||
const RadioResponseInfo& /*info*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioVoiceResponse::sendDtmfResponse(const RadioResponseInfo& /*info*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioVoiceResponse::separateConnectionResponse(
|
||||
const RadioResponseInfo& /*info*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioVoiceResponse::setCallForwardResponse(const RadioResponseInfo& /*info*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioVoiceResponse::setCallWaitingResponse(const RadioResponseInfo& /*info*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioVoiceResponse::setClirResponse(const RadioResponseInfo& /*info*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioVoiceResponse::setMuteResponse(const RadioResponseInfo& /*info*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioVoiceResponse::setPreferredVoicePrivacyResponse(
|
||||
const RadioResponseInfo& /*info*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioVoiceResponse::setTtyModeResponse(const RadioResponseInfo& /*info*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioVoiceResponse::setVoNrEnabledResponse(const RadioResponseInfo& /*info*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioVoiceResponse::startDtmfResponse(const RadioResponseInfo& /*info*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioVoiceResponse::stopDtmfResponse(const RadioResponseInfo& /*info*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioVoiceResponse::switchWaitingOrHoldingAndActiveResponse(
|
||||
const RadioResponseInfo& /*info*/) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
|
@ -1,261 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2021 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 <aidl/android/hardware/radio/config/IRadioConfig.h>
|
||||
#include <android-base/logging.h>
|
||||
#include <android/binder_manager.h>
|
||||
|
||||
#include "radio_voice_utils.h"
|
||||
|
||||
#define ASSERT_OK(ret) ASSERT_TRUE(ret.isOk())
|
||||
|
||||
void RadioVoiceTest::SetUp() {
|
||||
std::string serviceName = GetParam();
|
||||
|
||||
if (!isServiceValidForDeviceConfiguration(serviceName)) {
|
||||
ALOGI("Skipped the test due to device configuration.");
|
||||
GTEST_SKIP();
|
||||
}
|
||||
|
||||
radio_voice = IRadioVoice::fromBinder(
|
||||
ndk::SpAIBinder(AServiceManager_waitForService(GetParam().c_str())));
|
||||
ASSERT_NE(nullptr, radio_voice.get());
|
||||
|
||||
radioRsp_voice = ndk::SharedRefBase::make<RadioVoiceResponse>(*this);
|
||||
ASSERT_NE(nullptr, radioRsp_voice.get());
|
||||
|
||||
count_ = 0;
|
||||
|
||||
radioInd_voice = ndk::SharedRefBase::make<RadioVoiceIndication>(*this);
|
||||
ASSERT_NE(nullptr, radioInd_voice.get());
|
||||
|
||||
radio_voice->setResponseFunctions(radioRsp_voice, radioInd_voice);
|
||||
|
||||
// Assert IRadioConfig exists before testing
|
||||
std::shared_ptr<aidl::android::hardware::radio::config::IRadioConfig> radioConfig =
|
||||
aidl::android::hardware::radio::config::IRadioConfig::fromBinder(
|
||||
ndk::SpAIBinder(AServiceManager_waitForService(
|
||||
"android.hardware.radio.config.IRadioConfig/default")));
|
||||
ASSERT_NE(nullptr, radioConfig.get());
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus RadioVoiceTest::clearPotentialEstablishedCalls() {
|
||||
// Get the current call Id to hangup the established emergency call.
|
||||
serial = GetRandomSerialNumber();
|
||||
radio_voice->getCurrentCalls(serial);
|
||||
EXPECT_EQ(std::cv_status::no_timeout, wait());
|
||||
|
||||
// Hang up to disconnect the established call channels.
|
||||
for (const Call& call : radioRsp_voice->currentCalls) {
|
||||
serial = GetRandomSerialNumber();
|
||||
radio_voice->hangup(serial, call.index);
|
||||
ALOGI("Hang up to disconnect the established call channel: %d", call.index);
|
||||
EXPECT_EQ(std::cv_status::no_timeout, wait());
|
||||
// Give some time for modem to disconnect the established call channel.
|
||||
sleep(MODEM_EMERGENCY_CALL_DISCONNECT_TIME);
|
||||
}
|
||||
|
||||
// Verify there are no more current calls.
|
||||
serial = GetRandomSerialNumber();
|
||||
radio_voice->getCurrentCalls(serial);
|
||||
EXPECT_EQ(std::cv_status::no_timeout, wait());
|
||||
EXPECT_EQ(0, radioRsp_voice->currentCalls.size());
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
/*
|
||||
* Test IRadioVoice.emergencyDial() for the response returned.
|
||||
*/
|
||||
TEST_P(RadioVoiceTest, emergencyDial) {
|
||||
if (!deviceSupportsFeature(FEATURE_VOICE_CALL)) {
|
||||
ALOGI("Skipping emergencyDial because voice call is not supported in device");
|
||||
return;
|
||||
} else if (!deviceSupportsFeature(FEATURE_TELEPHONY_GSM) &&
|
||||
!deviceSupportsFeature(FEATURE_TELEPHONY_CDMA)) {
|
||||
ALOGI("Skipping emergencyDial because gsm/cdma radio is not supported in device");
|
||||
return;
|
||||
} else {
|
||||
ALOGI("Running emergencyDial because voice call is supported in device");
|
||||
}
|
||||
|
||||
serial = GetRandomSerialNumber();
|
||||
|
||||
Dial dialInfo;
|
||||
dialInfo.address = std::string("911");
|
||||
EmergencyServiceCategory categories = EmergencyServiceCategory::UNSPECIFIED;
|
||||
std::vector<std::string> urns = {""};
|
||||
EmergencyCallRouting routing = EmergencyCallRouting::UNKNOWN;
|
||||
|
||||
ndk::ScopedAStatus res =
|
||||
radio_voice->emergencyDial(serial, dialInfo, categories, urns, routing, true, true);
|
||||
ASSERT_OK(res);
|
||||
EXPECT_EQ(std::cv_status::no_timeout, wait());
|
||||
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type);
|
||||
EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial);
|
||||
|
||||
ALOGI("emergencyDial, rspInfo.error = %s\n", toString(radioRsp_voice->rspInfo.error).c_str());
|
||||
|
||||
RadioError rspEmergencyDial = radioRsp_voice->rspInfo.error;
|
||||
// In DSDS or TSTS, we only check the result if the current slot is IN_SERVICE
|
||||
// or Emergency_Only.
|
||||
if (isDsDsEnabled() || isTsTsEnabled()) {
|
||||
// TODO(b/210712359): maybe create a local RadioNetwork instance
|
||||
/**
|
||||
serial = GetRandomSerialNumber();
|
||||
radio_v1_6->getVoiceRegistrationState(serial);
|
||||
EXPECT_EQ(std::cv_status::no_timeout, wait());
|
||||
if (isVoiceEmergencyOnly(radioRsp_v1_6->voiceRegResp.regState) ||
|
||||
isVoiceInService(radioRsp_v1_6->voiceRegResp.regState)) {
|
||||
EXPECT_EQ(RadioError::NONE, rspEmergencyDial);
|
||||
}
|
||||
**/
|
||||
} else {
|
||||
EXPECT_EQ(RadioError::NONE, rspEmergencyDial);
|
||||
}
|
||||
|
||||
// Give some time for modem to establish the emergency call channel.
|
||||
sleep(MODEM_EMERGENCY_CALL_ESTABLISH_TIME);
|
||||
|
||||
// Disconnect all the potential established calls to prevent them affecting other tests.
|
||||
clearPotentialEstablishedCalls();
|
||||
}
|
||||
|
||||
/*
|
||||
* Test IRadioVoice.emergencyDial() with specified service and its response returned.
|
||||
*/
|
||||
TEST_P(RadioVoiceTest, emergencyDial_withServices) {
|
||||
if (!deviceSupportsFeature(FEATURE_VOICE_CALL)) {
|
||||
ALOGI("Skipping emergencyDial because voice call is not supported in device");
|
||||
return;
|
||||
} else if (!deviceSupportsFeature(FEATURE_TELEPHONY_GSM) &&
|
||||
!deviceSupportsFeature(FEATURE_TELEPHONY_CDMA)) {
|
||||
ALOGI("Skipping emergencyDial because gsm/cdma radio is not supported in device");
|
||||
return;
|
||||
} else {
|
||||
ALOGI("Running emergencyDial because voice call is supported in device");
|
||||
}
|
||||
|
||||
serial = GetRandomSerialNumber();
|
||||
|
||||
Dial dialInfo;
|
||||
dialInfo.address = std::string("911");
|
||||
EmergencyServiceCategory categories = EmergencyServiceCategory::AMBULANCE;
|
||||
std::vector<std::string> urns = {"urn:service:sos.ambulance"};
|
||||
EmergencyCallRouting routing = EmergencyCallRouting::UNKNOWN;
|
||||
|
||||
ndk::ScopedAStatus res =
|
||||
radio_voice->emergencyDial(serial, dialInfo, categories, urns, routing, true, true);
|
||||
ASSERT_OK(res);
|
||||
EXPECT_EQ(std::cv_status::no_timeout, wait());
|
||||
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type);
|
||||
EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial);
|
||||
|
||||
ALOGI("emergencyDial_withServices, rspInfo.error = %s\n",
|
||||
toString(radioRsp_voice->rspInfo.error).c_str());
|
||||
RadioError rspEmergencyDial = radioRsp_voice->rspInfo.error;
|
||||
|
||||
// In DSDS or TSTS, we only check the result if the current slot is IN_SERVICE
|
||||
// or Emergency_Only.
|
||||
if (isDsDsEnabled() || isTsTsEnabled()) {
|
||||
// TODO(b/210712359): maybe create a local RadioNetwork instance
|
||||
/**
|
||||
serial = GetRandomSerialNumber();
|
||||
radio_v1_6->getVoiceRegistrationState_1_6(serial);
|
||||
EXPECT_EQ(std::cv_status::no_timeout, wait());
|
||||
if (isVoiceEmergencyOnly(radioRsp_v1_6->voiceRegResp.regState) ||
|
||||
isVoiceInService(radioRsp_v1_6->voiceRegResp.regState)) {
|
||||
EXPECT_EQ(RadioError::NONE, rspEmergencyDial);
|
||||
}
|
||||
**/
|
||||
} else {
|
||||
EXPECT_EQ(RadioError::NONE, rspEmergencyDial);
|
||||
}
|
||||
// Give some time for modem to establish the emergency call channel.
|
||||
sleep(MODEM_EMERGENCY_CALL_ESTABLISH_TIME);
|
||||
|
||||
// Disconnect all the potential established calls to prevent them affecting other tests.
|
||||
clearPotentialEstablishedCalls();
|
||||
}
|
||||
|
||||
/*
|
||||
* Test IRadioVoice.emergencyDial() with known emergency call routing and its response returned.
|
||||
*/
|
||||
TEST_P(RadioVoiceTest, emergencyDial_withEmergencyRouting) {
|
||||
if (!deviceSupportsFeature(FEATURE_VOICE_CALL)) {
|
||||
ALOGI("Skipping emergencyDial because voice call is not supported in device");
|
||||
return;
|
||||
} else if (!deviceSupportsFeature(FEATURE_TELEPHONY_GSM) &&
|
||||
!deviceSupportsFeature(FEATURE_TELEPHONY_CDMA)) {
|
||||
ALOGI("Skipping emergencyDial because gsm/cdma radio is not supported in device");
|
||||
return;
|
||||
} else {
|
||||
ALOGI("Running emergencyDial because voice call is supported in device");
|
||||
}
|
||||
|
||||
serial = GetRandomSerialNumber();
|
||||
|
||||
Dial dialInfo;
|
||||
dialInfo.address = std::string("911");
|
||||
EmergencyServiceCategory categories = EmergencyServiceCategory::UNSPECIFIED;
|
||||
std::vector<std::string> urns = {""};
|
||||
EmergencyCallRouting routing = EmergencyCallRouting::EMERGENCY;
|
||||
|
||||
ndk::ScopedAStatus res =
|
||||
radio_voice->emergencyDial(serial, dialInfo, categories, urns, routing, true, true);
|
||||
ASSERT_OK(res);
|
||||
EXPECT_EQ(std::cv_status::no_timeout, wait());
|
||||
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type);
|
||||
EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial);
|
||||
|
||||
ALOGI("emergencyDial_withEmergencyRouting, rspInfo.error = %s\n",
|
||||
toString(radioRsp_voice->rspInfo.error).c_str());
|
||||
RadioError rspEmergencyDial = radioRsp_voice->rspInfo.error;
|
||||
|
||||
// In DSDS or TSTS, we only check the result if the current slot is IN_SERVICE
|
||||
// or Emergency_Only.
|
||||
if (isDsDsEnabled() || isTsTsEnabled()) {
|
||||
// TODO(b/210712359): maybe create a local RadioNetwork instance
|
||||
/**
|
||||
serial = GetRandomSerialNumber();
|
||||
radio_v1_6->getVoiceRegistrationState_1_6(serial);
|
||||
EXPECT_EQ(std::cv_status::no_timeout, wait());
|
||||
if (isVoiceEmergencyOnly(radioRsp_v1_6->voiceRegResp.regState) ||
|
||||
isVoiceInService(radioRsp_v1_6->voiceRegResp.regState)) {
|
||||
EXPECT_EQ(RadioError::NONE, rspEmergencyDial);
|
||||
}
|
||||
**/
|
||||
} else {
|
||||
EXPECT_EQ(RadioError::NONE, rspEmergencyDial);
|
||||
}
|
||||
|
||||
// Give some time for modem to establish the emergency call channel.
|
||||
sleep(MODEM_EMERGENCY_CALL_ESTABLISH_TIME);
|
||||
|
||||
// Disconnect all the potential established calls to prevent them affecting other tests.
|
||||
clearPotentialEstablishedCalls();
|
||||
}
|
||||
|
||||
/*
|
||||
* Test IRadioVoice.getCurrentCalls() for the response returned.
|
||||
*/
|
||||
TEST_P(RadioVoiceTest, getCurrentCalls) {
|
||||
serial = GetRandomSerialNumber();
|
||||
radio_voice->getCurrentCalls(serial);
|
||||
EXPECT_EQ(std::cv_status::no_timeout, wait());
|
||||
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type);
|
||||
EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial);
|
||||
EXPECT_EQ(RadioError::NONE, radioRsp_voice->rspInfo.error);
|
||||
}
|
|
@ -1,192 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2021 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.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <aidl/android/hardware/radio/voice/BnRadioVoiceIndication.h>
|
||||
#include <aidl/android/hardware/radio/voice/BnRadioVoiceResponse.h>
|
||||
#include <aidl/android/hardware/radio/voice/IRadioVoice.h>
|
||||
|
||||
#include "radio_aidl_hal_utils.h"
|
||||
|
||||
using namespace aidl::android::hardware::radio::voice;
|
||||
|
||||
class RadioVoiceTest;
|
||||
|
||||
/* Callback class for radio voice response */
|
||||
class RadioVoiceResponse : public BnRadioVoiceResponse {
|
||||
protected:
|
||||
RadioResponseWaiter& parent_voice;
|
||||
|
||||
public:
|
||||
RadioVoiceResponse(RadioResponseWaiter& parent_voice);
|
||||
virtual ~RadioVoiceResponse() = default;
|
||||
|
||||
RadioResponseInfo rspInfo;
|
||||
std::vector<Call> currentCalls;
|
||||
|
||||
virtual ndk::ScopedAStatus acceptCallResponse(const RadioResponseInfo& info) override;
|
||||
|
||||
virtual ndk::ScopedAStatus acknowledgeRequest(int32_t serial) override;
|
||||
|
||||
virtual ndk::ScopedAStatus conferenceResponse(const RadioResponseInfo& info) override;
|
||||
|
||||
virtual ndk::ScopedAStatus dialResponse(const RadioResponseInfo& info) override;
|
||||
|
||||
virtual ndk::ScopedAStatus emergencyDialResponse(const RadioResponseInfo& info) override;
|
||||
|
||||
virtual ndk::ScopedAStatus exitEmergencyCallbackModeResponse(
|
||||
const RadioResponseInfo& info) override;
|
||||
|
||||
virtual ndk::ScopedAStatus explicitCallTransferResponse(const RadioResponseInfo& info) override;
|
||||
|
||||
virtual ndk::ScopedAStatus getCallForwardStatusResponse(
|
||||
const RadioResponseInfo& info,
|
||||
const std::vector<CallForwardInfo>& call_forwardInfos) override;
|
||||
|
||||
virtual ndk::ScopedAStatus getCallWaitingResponse(const RadioResponseInfo& info, bool enable,
|
||||
int32_t serviceClass) override;
|
||||
|
||||
virtual ndk::ScopedAStatus getClipResponse(const RadioResponseInfo& info,
|
||||
ClipStatus status) override;
|
||||
|
||||
virtual ndk::ScopedAStatus getClirResponse(const RadioResponseInfo& info, int32_t n,
|
||||
int32_t m) override;
|
||||
|
||||
virtual ndk::ScopedAStatus getCurrentCallsResponse(const RadioResponseInfo& info,
|
||||
const std::vector<Call>& calls) override;
|
||||
|
||||
virtual ndk::ScopedAStatus getLastCallFailCauseResponse(
|
||||
const RadioResponseInfo& info, const LastCallFailCauseInfo& failCauseInfo) override;
|
||||
|
||||
virtual ndk::ScopedAStatus getMuteResponse(const RadioResponseInfo& info, bool enable) override;
|
||||
|
||||
virtual ndk::ScopedAStatus getPreferredVoicePrivacyResponse(const RadioResponseInfo& info,
|
||||
bool enable) override;
|
||||
|
||||
virtual ndk::ScopedAStatus getTtyModeResponse(const RadioResponseInfo& info,
|
||||
TtyMode mode) override;
|
||||
|
||||
virtual ndk::ScopedAStatus handleStkCallSetupRequestFromSimResponse(
|
||||
const RadioResponseInfo& info) override;
|
||||
|
||||
virtual ndk::ScopedAStatus hangupConnectionResponse(const RadioResponseInfo& info) override;
|
||||
|
||||
virtual ndk::ScopedAStatus hangupForegroundResumeBackgroundResponse(
|
||||
const RadioResponseInfo& info) override;
|
||||
|
||||
virtual ndk::ScopedAStatus hangupWaitingOrBackgroundResponse(
|
||||
const RadioResponseInfo& info) override;
|
||||
|
||||
virtual ndk::ScopedAStatus isVoNrEnabledResponse(const RadioResponseInfo& info,
|
||||
bool enable) override;
|
||||
|
||||
virtual ndk::ScopedAStatus rejectCallResponse(const RadioResponseInfo& info) override;
|
||||
|
||||
virtual ndk::ScopedAStatus sendBurstDtmfResponse(const RadioResponseInfo& info) override;
|
||||
|
||||
virtual ndk::ScopedAStatus sendCdmaFeatureCodeResponse(const RadioResponseInfo& info) override;
|
||||
|
||||
virtual ndk::ScopedAStatus sendDtmfResponse(const RadioResponseInfo& info) override;
|
||||
|
||||
virtual ndk::ScopedAStatus separateConnectionResponse(const RadioResponseInfo& info) override;
|
||||
|
||||
virtual ndk::ScopedAStatus setCallForwardResponse(const RadioResponseInfo& info) override;
|
||||
|
||||
virtual ndk::ScopedAStatus setCallWaitingResponse(const RadioResponseInfo& info) override;
|
||||
|
||||
virtual ndk::ScopedAStatus setClirResponse(const RadioResponseInfo& info) override;
|
||||
|
||||
virtual ndk::ScopedAStatus setMuteResponse(const RadioResponseInfo& info) override;
|
||||
|
||||
virtual ndk::ScopedAStatus setPreferredVoicePrivacyResponse(
|
||||
const RadioResponseInfo& info) override;
|
||||
|
||||
virtual ndk::ScopedAStatus setTtyModeResponse(const RadioResponseInfo& info) override;
|
||||
|
||||
virtual ndk::ScopedAStatus setVoNrEnabledResponse(const RadioResponseInfo& info) override;
|
||||
|
||||
virtual ndk::ScopedAStatus startDtmfResponse(const RadioResponseInfo& info) override;
|
||||
|
||||
virtual ndk::ScopedAStatus stopDtmfResponse(const RadioResponseInfo& info) override;
|
||||
|
||||
virtual ndk::ScopedAStatus switchWaitingOrHoldingAndActiveResponse(
|
||||
const RadioResponseInfo& info) override;
|
||||
};
|
||||
|
||||
/* Callback class for radio voice indication */
|
||||
class RadioVoiceIndication : public BnRadioVoiceIndication {
|
||||
protected:
|
||||
RadioVoiceTest& parent_voice;
|
||||
|
||||
public:
|
||||
RadioVoiceIndication(RadioVoiceTest& parent_voice);
|
||||
virtual ~RadioVoiceIndication() = default;
|
||||
|
||||
virtual ndk::ScopedAStatus callRing(RadioIndicationType type, bool isGsm,
|
||||
const CdmaSignalInfoRecord& record) override;
|
||||
|
||||
virtual ndk::ScopedAStatus callStateChanged(RadioIndicationType type) override;
|
||||
|
||||
virtual ndk::ScopedAStatus cdmaCallWaiting(RadioIndicationType type,
|
||||
const CdmaCallWaiting& callWaitingRecord) override;
|
||||
|
||||
virtual ndk::ScopedAStatus cdmaInfoRec(
|
||||
RadioIndicationType type, const std::vector<CdmaInformationRecord>& records) override;
|
||||
|
||||
virtual ndk::ScopedAStatus cdmaOtaProvisionStatus(RadioIndicationType type,
|
||||
CdmaOtaProvisionStatus status) override;
|
||||
|
||||
virtual ndk::ScopedAStatus currentEmergencyNumberList(
|
||||
RadioIndicationType type,
|
||||
const std::vector<EmergencyNumber>& emergencyNumberList) override;
|
||||
|
||||
virtual ndk::ScopedAStatus enterEmergencyCallbackMode(RadioIndicationType type) override;
|
||||
|
||||
virtual ndk::ScopedAStatus exitEmergencyCallbackMode(RadioIndicationType type) override;
|
||||
|
||||
virtual ndk::ScopedAStatus indicateRingbackTone(RadioIndicationType type, bool start) override;
|
||||
|
||||
virtual ndk::ScopedAStatus onSupplementaryServiceIndication(
|
||||
RadioIndicationType type, const StkCcUnsolSsResult& ss) override;
|
||||
|
||||
virtual ndk::ScopedAStatus resendIncallMute(RadioIndicationType type) override;
|
||||
|
||||
virtual ndk::ScopedAStatus srvccStateNotify(RadioIndicationType type,
|
||||
SrvccState state) override;
|
||||
|
||||
virtual ndk::ScopedAStatus stkCallControlAlphaNotify(RadioIndicationType type,
|
||||
const std::string& alpha) override;
|
||||
|
||||
virtual ndk::ScopedAStatus stkCallSetup(RadioIndicationType type, int64_t timeout) override;
|
||||
};
|
||||
|
||||
// The main test class for Radio AIDL Voice.
|
||||
class RadioVoiceTest : public ::testing::TestWithParam<std::string>, public RadioResponseWaiter {
|
||||
protected:
|
||||
/* Clear Potential Established Calls */
|
||||
virtual ndk::ScopedAStatus clearPotentialEstablishedCalls();
|
||||
|
||||
public:
|
||||
virtual void SetUp() override;
|
||||
|
||||
/* radio voice service handle */
|
||||
std::shared_ptr<IRadioVoice> radio_voice;
|
||||
/* radio voice response handle */
|
||||
std::shared_ptr<RadioVoiceResponse> radioRsp_voice;
|
||||
/* radio voice indication handle */
|
||||
std::shared_ptr<RadioVoiceIndication> radioInd_voice;
|
||||
};
|
Loading…
Reference in a new issue