Merge changes Ic82ffd2f,I29632003

* changes:
  Finish IRadio 1.6/IRadioConfig 1.3 AIDL VTS
  Convert hidl_bitfield and bitfield to int
This commit is contained in:
Sarah Chin 2022-01-06 21:52:35 +00:00 committed by Gerrit Code Review
commit fd593414cd
54 changed files with 507 additions and 205 deletions

View file

@ -46,8 +46,8 @@ parcelable DataProfileInfo {
int maxConns;
int waitTime;
boolean enabled;
android.hardware.radio.data.ApnTypes supportedApnTypesBitmap;
android.hardware.radio.RadioAccessFamily bearerBitmap;
int supportedApnTypesBitmap;
int bearerBitmap;
int mtuV4;
int mtuV6;
boolean preferred;

View file

@ -36,7 +36,7 @@ package android.hardware.radio.modem;
parcelable RadioCapability {
int session;
int phase;
android.hardware.radio.RadioAccessFamily raf;
int raf;
String logicalModemUuid;
int status;
const int PHASE_CONFIGURED = 0;

View file

@ -50,12 +50,12 @@ interface IRadioNetwork {
oneway void getVoiceRegistrationState(in int serial);
oneway void isNrDualConnectivityEnabled(in int serial);
oneway void responseAcknowledgement();
oneway void setAllowedNetworkTypesBitmap(in int serial, in android.hardware.radio.RadioAccessFamily networkTypeBitmap);
oneway void setAllowedNetworkTypesBitmap(in int serial, in int networkTypeBitmap);
oneway void setBandMode(in int serial, in android.hardware.radio.network.RadioBandMode mode);
oneway void setBarringPassword(in int serial, in String facility, in String oldPassword, in String newPassword);
oneway void setCdmaRoamingPreference(in int serial, in android.hardware.radio.network.CdmaRoamingType type);
oneway void setCellInfoListRate(in int serial, in int rate);
oneway void setIndicationFilter(in int serial, in android.hardware.radio.network.IndicationFilter indicationFilter);
oneway void setIndicationFilter(in int serial, in int indicationFilter);
oneway void setLinkCapacityReportingCriteria(in int serial, in int hysteresisMs, in int hysteresisDlKbps, in int hysteresisUlKbps, in int[] thresholdsDownlinkKbps, in int[] thresholdsUplinkKbps, in android.hardware.radio.AccessNetwork accessNetwork);
oneway void setLocationUpdates(in int serial, in boolean enable);
oneway void setNetworkSelectionModeAutomatic(in int serial);

View file

@ -44,7 +44,7 @@ interface IRadioNetworkIndication {
oneway void networkScanResult(in android.hardware.radio.RadioIndicationType type, in android.hardware.radio.network.NetworkScanResult result);
oneway void networkStateChanged(in android.hardware.radio.RadioIndicationType type);
oneway void nitzTimeReceived(in android.hardware.radio.RadioIndicationType type, in String nitzTime, in long receivedTimeMs, in long ageMs);
oneway void registrationFailed(in android.hardware.radio.RadioIndicationType type, in android.hardware.radio.network.CellIdentity cellIdentity, in String chosenPlmn, in android.hardware.radio.network.Domain domain, in int causeCode, in int additionalCauseCode);
oneway void registrationFailed(in android.hardware.radio.RadioIndicationType type, in android.hardware.radio.network.CellIdentity cellIdentity, in String chosenPlmn, in int domain, in int causeCode, in int additionalCauseCode);
oneway void restrictedStateChanged(in android.hardware.radio.RadioIndicationType type, in android.hardware.radio.network.PhoneRestrictedState state);
oneway void suppSvcNotify(in android.hardware.radio.RadioIndicationType type, in android.hardware.radio.network.SuppSvcNotification suppSvc);
oneway void voiceRadioTechChanged(in android.hardware.radio.RadioIndicationType type, in android.hardware.radio.RadioTechnology rat);

View file

@ -35,7 +35,7 @@ package android.hardware.radio.network;
@VintfStability
interface IRadioNetworkResponse {
oneway void acknowledgeRequest(in int serial);
oneway void getAllowedNetworkTypesBitmapResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.RadioAccessFamily networkTypeBitmap);
oneway void getAllowedNetworkTypesBitmapResponse(in android.hardware.radio.RadioResponseInfo info, in int networkTypeBitmap);
oneway void getAvailableBandModesResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.network.RadioBandMode[] bandModes);
oneway void getAvailableNetworksResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.network.OperatorInfo[] networkInfos);
oneway void getBarringInfoResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.network.CellIdentity cellIdentity, in android.hardware.radio.network.BarringInfo[] barringInfos);

View file

@ -37,7 +37,7 @@ parcelable EmergencyNumber {
String number;
String mcc;
String mnc;
android.hardware.radio.voice.EmergencyServiceCategory categories;
int categories;
String[] urns;
int sources;
const int SOURCE_NETWORK_SIGNALING = 1;

View file

@ -37,7 +37,7 @@ interface IRadioVoice {
oneway void acceptCall(in int serial);
oneway void conference(in int serial);
oneway void dial(in int serial, in android.hardware.radio.voice.Dial dialInfo);
oneway void emergencyDial(in int serial, in android.hardware.radio.voice.Dial dialInfo, in android.hardware.radio.voice.EmergencyServiceCategory categories, in String[] urns, in android.hardware.radio.voice.EmergencyCallRouting routing, in boolean hasKnownUserIntentEmergency, in boolean isTesting);
oneway void emergencyDial(in int serial, in android.hardware.radio.voice.Dial dialInfo, in int categories, in String[] urns, in android.hardware.radio.voice.EmergencyCallRouting routing, in boolean hasKnownUserIntentEmergency, in boolean isTesting);
oneway void exitEmergencyCallbackMode(in int serial);
oneway void explicitCallTransfer(in int serial);
oneway void getCallForwardStatus(in int serial, in android.hardware.radio.voice.CallForwardInfo callInfo);

View file

@ -93,11 +93,11 @@ parcelable DataProfileInfo {
/**
* Supported APN types bitmap. See ApnTypes for the value of each bit.
*/
ApnTypes supportedApnTypesBitmap;
int supportedApnTypesBitmap;
/**
* The bearer bitmap. See RadioAccessFamily for the value of each bit.
*/
RadioAccessFamily bearerBitmap;
int bearerBitmap;
/**
* Maximum transmission unit (MTU) size in bytes for IPv4.
*/

View file

@ -71,7 +71,7 @@ parcelable RadioCapability {
/**
* 32-bit bitmap of RadioAccessFamily.
*/
RadioAccessFamily raf;
int raf;
/**
* A UUID typically "com.xxxx.lmX" where X is the logical modem.
* RadioConst:MAX_UUID_LENGTH is the max length.

View file

@ -195,7 +195,7 @@ oneway interface IRadioNetwork {
*
* Response function is IRadioNetworkResponse.setAllowedNetworkTypesBitmapResponse()
*/
void setAllowedNetworkTypesBitmap(in int serial, in RadioAccessFamily networkTypeBitmap);
void setAllowedNetworkTypesBitmap(in int serial, in int networkTypeBitmap);
/**
* Assign a specified band for RF configuration.
@ -253,7 +253,7 @@ oneway interface IRadioNetwork {
*
* Response function is IRadioNetworkResponse.setIndicationFilterResponse()
*/
void setIndicationFilter(in int serial, in IndicationFilter indicationFilter);
void setIndicationFilter(in int serial, in int indicationFilter);
/**
* Sets the link capacity reporting criteria. The resulting reporting criteria are the AND of

View file

@ -136,8 +136,8 @@ oneway interface IRadioNetworkIndication {
* include the time spend in sleep / low power states. If it can not be guaranteed,
* there must not be any caching done at the modem and should fill in 0 for ageMs
*/
void nitzTimeReceived(in RadioIndicationType type, in String nitzTime,
in long receivedTimeMs, in long ageMs);
void nitzTimeReceived(
in RadioIndicationType type, in String nitzTime, in long receivedTimeMs, in long ageMs);
/**
* Report that Registration or a Location/Routing/Tracking Area update has failed.
@ -165,7 +165,7 @@ oneway interface IRadioNetworkIndication {
* MAX_INT if this value is unused.
*/
void registrationFailed(in RadioIndicationType type, in CellIdentity cellIdentity,
in String chosenPlmn, in Domain domain, in int causeCode, in int additionalCauseCode);
in String chosenPlmn, in int domain, in int causeCode, in int additionalCauseCode);
/**
* Indicates a restricted state change (eg, for Domain Specific Access Control).

View file

@ -62,8 +62,7 @@ oneway interface IRadioNetworkResponse {
* RadioError:REQUEST_NOT_SUPPORTED
* RadioError:NO_RESOURCES
*/
void getAllowedNetworkTypesBitmapResponse(
in RadioResponseInfo info, in RadioAccessFamily networkTypeBitmap);
void getAllowedNetworkTypesBitmapResponse(in RadioResponseInfo info, in int networkTypeBitmap);
/**
* @param info Response info struct containing response type, serial no. and error

View file

@ -78,7 +78,7 @@ parcelable EmergencyNumber {
* The bitfield of EmergencyServiceCategory(s). See EmergencyServiceCategory for the value of
* each bit.
*/
EmergencyServiceCategory categories;
int categories;
/**
* The list of emergency Uniform Resource Names (URN).
*/

View file

@ -117,9 +117,9 @@ oneway interface IRadioVoice {
*
* Response function is IRadioVoiceResponse.emergencyDialResponse()
*/
void emergencyDial(in int serial, in Dial dialInfo, in EmergencyServiceCategory categories,
in String[] urns, in EmergencyCallRouting routing,
in boolean hasKnownUserIntentEmergency, in boolean isTesting);
void emergencyDial(in int serial, in Dial dialInfo, in int categories, in String[] urns,
in EmergencyCallRouting routing, in boolean hasKnownUserIntentEmergency,
in boolean isTesting);
/**
* Request the radio's system selection module to exit emergency callback mode. Radio must not

View file

@ -41,9 +41,8 @@ class RadioNetwork : public RadioCompatBase,
::ndk::ScopedAStatus getVoiceRegistrationState(int32_t serial) override;
::ndk::ScopedAStatus isNrDualConnectivityEnabled(int32_t serial) override;
::ndk::ScopedAStatus responseAcknowledgement() override;
::ndk::ScopedAStatus setAllowedNetworkTypesBitmap(
int32_t serial,
::aidl::android::hardware::radio::RadioAccessFamily networkTypeBitmap) override;
::ndk::ScopedAStatus setAllowedNetworkTypesBitmap(int32_t serial,
int32_t networkTypeBitmap) override;
::ndk::ScopedAStatus setBandMode(
int32_t serial, ::aidl::android::hardware::radio::network::RadioBandMode mode) override;
::ndk::ScopedAStatus setBarringPassword(int32_t serial, const std::string& facility,
@ -53,9 +52,7 @@ class RadioNetwork : public RadioCompatBase,
int32_t serial,
::aidl::android::hardware::radio::network::CdmaRoamingType type) override;
::ndk::ScopedAStatus setCellInfoListRate(int32_t serial, int32_t rate) override;
::ndk::ScopedAStatus setIndicationFilter(
int32_t serial,
::aidl::android::hardware::radio::network::IndicationFilter indicationFilter) override;
::ndk::ScopedAStatus setIndicationFilter(int32_t serial, int32_t indicationFilter) override;
::ndk::ScopedAStatus setLinkCapacityReportingCriteria(
int32_t serial, int32_t hysteresisMs, int32_t hysteresisDlKbps,
int32_t hysteresisUlKbps, const std::vector<int32_t>& thresholdsDownlinkKbps,

View file

@ -31,8 +31,7 @@ class RadioVoice : public RadioCompatBase,
int32_t serial, const ::aidl::android::hardware::radio::voice::Dial& dialInfo) override;
::ndk::ScopedAStatus emergencyDial(
int32_t serial, const ::aidl::android::hardware::radio::voice::Dial& dialInfo,
::aidl::android::hardware::radio::voice::EmergencyServiceCategory categories,
const std::vector<std::string>& urns,
int32_t categories, const std::vector<std::string>& urns,
::aidl::android::hardware::radio::voice::EmergencyCallRouting routing,
bool hasKnownUserIntentEmergency, bool isTesting) override;
::ndk::ScopedAStatus exitEmergencyCallbackMode(int32_t serial) override;

View file

@ -25,7 +25,6 @@
namespace android::hardware::radio::compat {
using ::aidl::android::hardware::radio::AccessNetwork;
using ::aidl::android::hardware::radio::RadioAccessFamily;
using ::aidl::android::hardware::radio::RadioTechnology;
namespace aidl = ::aidl::android::hardware::radio::modem;
@ -40,7 +39,7 @@ aidl::RadioCapability toAidl(const V1_0::RadioCapability& capa) {
return {
.session = capa.session,
.phase = static_cast<int32_t>(capa.phase),
.raf = RadioAccessFamily(capa.raf),
.raf = static_cast<int32_t>(capa.raf),
.logicalModemUuid = capa.logicalModemUuid,
.status = static_cast<int32_t>(capa.status),
};

View file

@ -208,8 +208,8 @@ Return<void> RadioIndication::registrationFailed( //
const hidl_string& chosenPlmn, hidl_bitfield<V1_5::Domain> domain, int32_t causeCode,
int32_t additionalCauseCode) {
LOG_CALL << type;
networkCb()->registrationFailed(toAidl(type), toAidl(cellIdentity), chosenPlmn,
aidl::Domain(domain), causeCode, additionalCauseCode);
networkCb()->registrationFailed(toAidl(type), toAidl(cellIdentity), chosenPlmn, domain,
causeCode, additionalCauseCode);
return {};
}

View file

@ -28,7 +28,6 @@
namespace android::hardware::radio::compat {
using ::aidl::android::hardware::radio::AccessNetwork;
using ::aidl::android::hardware::radio::RadioAccessFamily;
using ::ndk::ScopedAStatus;
namespace aidl = ::aidl::android::hardware::radio::network;
constexpr auto ok = &ScopedAStatus::ok;
@ -161,7 +160,7 @@ ScopedAStatus RadioNetwork::responseAcknowledgement() {
return ok();
}
ScopedAStatus RadioNetwork::setAllowedNetworkTypesBitmap(int32_t serial, RadioAccessFamily ntype) {
ScopedAStatus RadioNetwork::setAllowedNetworkTypesBitmap(int32_t serial, int32_t ntype) {
LOG_CALL << serial;
const auto raf = toHidlBitfield<V1_4::RadioAccessFamily>(ntype);
if (mHal1_6) {
@ -197,7 +196,7 @@ ScopedAStatus RadioNetwork::setCellInfoListRate(int32_t serial, int32_t rate) {
return ok();
}
ScopedAStatus RadioNetwork::setIndicationFilter(int32_t serial, aidl::IndicationFilter indFilter) {
ScopedAStatus RadioNetwork::setIndicationFilter(int32_t serial, int32_t indFilter) {
LOG_CALL << serial;
mHal1_5->setIndicationFilter_1_5(serial, toHidlBitfield<V1_5::IndicationFilter>(indFilter));
return ok();

View file

@ -27,7 +27,6 @@
namespace android::hardware::radio::compat {
using ::aidl::android::hardware::radio::RadioAccessFamily;
using ::aidl::android::hardware::radio::RadioTechnology;
using ::aidl::android::hardware::radio::RadioTechnologyFamily;
namespace aidl = ::aidl::android::hardware::radio::network;
@ -44,16 +43,14 @@ Return<void> RadioResponse::getAllowedNetworkTypesBitmapResponse(
const V1_6::RadioResponseInfo& info,
hidl_bitfield<V1_4::RadioAccessFamily> networkTypeBitmap) {
LOG_CALL << info.serial;
networkCb()->getAllowedNetworkTypesBitmapResponse(toAidl(info),
RadioAccessFamily(networkTypeBitmap));
networkCb()->getAllowedNetworkTypesBitmapResponse(toAidl(info), networkTypeBitmap);
return {};
}
Return<void> RadioResponse::getPreferredNetworkTypeResponse(const V1_0::RadioResponseInfo& info,
V1_0::PreferredNetworkType nwType) {
LOG_CALL << info.serial;
networkCb()->getAllowedNetworkTypesBitmapResponse( //
toAidl(info), RadioAccessFamily(getRafFromNetworkType(nwType)));
networkCb()->getAllowedNetworkTypesBitmapResponse(toAidl(info), getRafFromNetworkType(nwType));
return {};
}

View file

@ -53,7 +53,7 @@ ScopedAStatus RadioVoice::dial(int32_t serial, const aidl::Dial& dialInfo) {
}
ScopedAStatus RadioVoice::emergencyDial( //
int32_t serial, const aidl::Dial& info, aidl::EmergencyServiceCategory categories,
int32_t serial, const aidl::Dial& info, int32_t categories,
const std::vector<std::string>& urns, aidl::EmergencyCallRouting routing,
bool knownUserIntentEmerg, bool isTesting) {
LOG_CALL << serial;

View file

@ -147,7 +147,7 @@ aidl::EmergencyNumber toAidl(const V1_4::EmergencyNumber& num) {
.number = num.number,
.mcc = num.mcc,
.mnc = num.mnc,
.categories = aidl::EmergencyServiceCategory(num.categories),
.categories = num.categories,
.urns = toAidl(num.urns),
.sources = num.sources,
};

View file

@ -29,6 +29,9 @@ cc_test {
],
srcs: [
"radio_aidl_hal_utils.cpp",
"radio_config_indication.cpp",
"radio_config_response.cpp",
"radio_config_test.cpp",
"radio_data_indication.cpp",
"radio_data_response.cpp",
"radio_data_test.cpp",

View file

@ -16,6 +16,7 @@
#include <android/binder_process.h>
#include "radio_config_utils.h"
#include "radio_data_utils.h"
#include "radio_messaging_utils.h"
#include "radio_modem_utils.h"
@ -23,6 +24,12 @@
#include "radio_sim_utils.h"
#include "radio_voice_utils.h"
GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(RadioConfigTest);
INSTANTIATE_TEST_SUITE_P(
PerInstance, RadioConfigTest,
testing::ValuesIn(android::getAidlHalInstanceNames(IRadioConfig::descriptor)),
android::PrintInstanceNameToString);
GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(RadioDataTest);
INSTANTIATE_TEST_SUITE_P(
PerInstance, RadioDataTest,

View file

@ -18,12 +18,14 @@
#include "radio_aidl_hal_utils.h"
#include <iostream>
#include "VtsCoreUtil.h"
using namespace aidl::android::hardware::radio::network;
#include "radio_config_utils.h"
#include "radio_sim_utils.h"
#define WAIT_TIMEOUT_PERIOD 75
aidl::android::hardware::radio::sim::CardStatus cardStatus = {};
sim::CardStatus cardStatus = {};
int serial = 0;
int count_ = 0;
int GetRandomSerialNumber() {
return rand();
@ -103,23 +105,33 @@ bool isVoiceEmergencyOnly(RegState state) {
RegState::UNKNOWN_EM == state;
}
bool stringEndsWith(std::string const& string, std::string const& end) {
if (string.size() >= end.size()) {
return (0 == string.compare(string.size() - end.size() - 1, end.size(), end));
} else {
return false;
}
}
bool isServiceValidForDeviceConfiguration(std::string& serviceName) {
if (isSsSsEnabled()) {
// Device is configured as SSSS.
if (serviceName != RADIO_SERVICE_SLOT1_NAME) {
if (stringEndsWith(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) {
if (!stringEndsWith(serviceName, RADIO_SERVICE_SLOT1_NAME) &&
!stringEndsWith(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) {
if (!stringEndsWith(serviceName, RADIO_SERVICE_SLOT1_NAME) &&
!stringEndsWith(serviceName, RADIO_SERVICE_SLOT2_NAME) &&
!stringEndsWith(serviceName, RADIO_SERVICE_SLOT3_NAME)) {
ALOGI("%s instance is not valid for TSTS device.", serviceName.c_str());
return false;
}
@ -130,7 +142,7 @@ bool isServiceValidForDeviceConfiguration(std::string& serviceName) {
/*
* Notify that the response message is received.
*/
void RadioResponseWaiter::notify(int receivedSerial) {
void RadioServiceTest::notify(int receivedSerial) {
std::unique_lock<std::mutex> lock(mtx_);
if (serial == receivedSerial) {
count_++;
@ -141,7 +153,7 @@ void RadioResponseWaiter::notify(int receivedSerial) {
/*
* Wait till the response message is notified or till WAIT_TIMEOUT_PERIOD.
*/
std::cv_status RadioResponseWaiter::wait() {
std::cv_status RadioServiceTest::wait() {
std::unique_lock<std::mutex> lock(mtx_);
std::cv_status status = std::cv_status::no_timeout;
auto now = std::chrono::system_clock::now();
@ -158,19 +170,37 @@ std::cv_status RadioResponseWaiter::wait() {
/**
* 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;
* 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);
bool RadioServiceTest::getRadioHalCapabilities() {
// Get HalDeviceCapabilities from RadioConfig
std::shared_ptr<RadioConfigResponse> radioConfigRsp =
ndk::SharedRefBase::make<RadioConfigResponse>(*this);
std::shared_ptr<RadioConfigIndication> radioConfigInd =
ndk::SharedRefBase::make<RadioConfigIndication>(*this);
radio_config->setResponseFunctions(radioConfigRsp, radioConfigInd);
serial = GetRandomSerialNumber();
radio_config->getHalDeviceCapabilities(serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
return radioConfigRsp->modemReducedFeatureSet1;
**/
return true;
}
}
/**
* Some VTS tests require the SIM card status to be present before running.
* Update the SIM card status, which can be accessed via the extern cardStatus.
*/
void RadioServiceTest::updateSimCardStatus() {
// Update CardStatus from RadioSim
std::shared_ptr<RadioSimResponse> radioSimRsp =
ndk::SharedRefBase::make<RadioSimResponse>(*this);
std::shared_ptr<RadioSimIndication> radioSimInd =
ndk::SharedRefBase::make<RadioSimIndication>(*this);
radio_sim->setResponseFunctions(radioSimRsp, radioSimInd);
serial = GetRandomSerialNumber();
radio_sim->getIccCardStatus(serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioSimRsp->rspInfo.type);
EXPECT_EQ(serial, radioSimRsp->rspInfo.serial);
EXPECT_EQ(RadioError::NONE, radioSimRsp->rspInfo.error);
}

View file

@ -19,15 +19,20 @@
#include <aidl/Gtest.h>
#include <aidl/Vintf.h>
#include <aidl/android/hardware/radio/RadioError.h>
#include <aidl/android/hardware/radio/config/IRadioConfig.h>
#include <aidl/android/hardware/radio/network/RegState.h>
#include <aidl/android/hardware/radio/sim/CardStatus.h>
#include <aidl/android/hardware/radio/sim/IRadioSim.h>
#include <utils/Log.h>
#include <vector>
using namespace aidl::android::hardware::radio;
using aidl::android::hardware::radio::network::RegState;
using aidl::android::hardware::radio::sim::CardStatus;
extern CardStatus cardStatus;
extern int serial;
extern int count_;
/*
* MACRO used to skip test case when radio response return error REQUEST_NOT_SUPPORTED
@ -102,12 +107,12 @@ bool isTsTsEnabled();
/*
* Check if voice status is in emergency only.
*/
bool isVoiceEmergencyOnly(aidl::android::hardware::radio::network::RegState state);
bool isVoiceEmergencyOnly(RegState state);
/*
* Check if voice status is in service.
*/
bool isVoiceInService(aidl::android::hardware::radio::network::RegState state);
bool isVoiceInService(RegState state);
/*
* Check if service is valid for device configuration
@ -115,26 +120,25 @@ bool isVoiceInService(aidl::android::hardware::radio::network::RegState state);
bool isServiceValidForDeviceConfiguration(std::string& serviceName);
/**
* Used when waiting for an asynchronous response from the HAL.
* RadioServiceTest base class
*/
class RadioResponseWaiter {
class RadioServiceTest {
protected:
std::mutex mtx_;
std::condition_variable cv_;
int count_;
std::shared_ptr<config::IRadioConfig> radio_config;
std::shared_ptr<sim::IRadioSim> radio_sim;
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 */
/* Get the radio HAL capabilities */
bool getRadioHalCapabilities();
/* Update SIM card status */
void updateSimCardStatus();
};

View file

@ -0,0 +1,24 @@
/*
* 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_config_utils.h"
RadioConfigIndication::RadioConfigIndication(RadioServiceTest& parent) : parent_config(parent) {}
ndk::ScopedAStatus RadioConfigIndication::simSlotsStatusChanged(
RadioIndicationType /*type*/, const std::vector<SimSlotStatus>& /*slotStatus*/) {
return ndk::ScopedAStatus::ok();
}

View file

@ -0,0 +1,59 @@
/*
* 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_config_utils.h"
RadioConfigResponse::RadioConfigResponse(RadioServiceTest& parent) : parent_config(parent) {}
ndk::ScopedAStatus RadioConfigResponse::getSimSlotsStatusResponse(
const RadioResponseInfo& /* info */, const std::vector<SimSlotStatus>& /* slotStatus */) {
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioConfigResponse::setSimSlotsMappingResponse(
const RadioResponseInfo& /* info */) {
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioConfigResponse::getPhoneCapabilityResponse(
const RadioResponseInfo& info, const PhoneCapability& phoneCapability) {
rspInfo = info;
phoneCap = phoneCapability;
parent_config.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioConfigResponse::setPreferredDataModemResponse(
const RadioResponseInfo& /* info */) {
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioConfigResponse::getNumOfLiveModemsResponse(
const RadioResponseInfo& /* info */, const int8_t /* numOfLiveModems */) {
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioConfigResponse::setNumOfLiveModemsResponse(
const RadioResponseInfo& /* info */) {
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioConfigResponse::getHalDeviceCapabilitiesResponse(
const RadioResponseInfo& info, bool modemReducedFeatures) {
modemReducedFeatureSet1 = modemReducedFeatures;
parent_config.notify(info.serial);
return ndk::ScopedAStatus::ok();
}

View file

@ -0,0 +1,56 @@
/*
* 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-base/logging.h>
#include <android/binder_manager.h>
#include "radio_config_utils.h"
#define ASSERT_OK(ret) ASSERT_TRUE(ret.isOk())
void RadioConfigTest::SetUp() {
std::string serviceName = GetParam();
if (!isServiceValidForDeviceConfiguration(serviceName)) {
ALOGI("Skipped the test due to device configuration.");
GTEST_SKIP();
}
radio_config = IRadioConfig::fromBinder(
ndk::SpAIBinder(AServiceManager_waitForService(GetParam().c_str())));
ASSERT_NE(nullptr, radio_config.get());
radioRsp_config = ndk::SharedRefBase::make<RadioConfigResponse>(*this);
ASSERT_NE(nullptr, radioRsp_config.get());
count_ = 0;
radioInd_config = ndk::SharedRefBase::make<RadioConfigIndication>(*this);
ASSERT_NE(nullptr, radioInd_config.get());
radio_config->setResponseFunctions(radioRsp_config, radioInd_config);
}
/*
* Test IRadioConfig.getHalDeviceCapabilities() for the response returned.
*/
TEST_P(RadioConfigTest, getHalDeviceCapabilities) {
serial = GetRandomSerialNumber();
ndk::ScopedAStatus res = radio_config->getHalDeviceCapabilities(serial);
ASSERT_OK(res);
ALOGI("getHalDeviceCapabilities, rspInfo.error = %s\n",
toString(radioRsp_config->rspInfo.error).c_str());
}

View file

@ -0,0 +1,86 @@
/*
* 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/config/BnRadioConfigIndication.h>
#include <aidl/android/hardware/radio/config/BnRadioConfigResponse.h>
#include <aidl/android/hardware/radio/config/IRadioConfig.h>
#include "radio_aidl_hal_utils.h"
using namespace aidl::android::hardware::radio::config;
class RadioConfigTest;
/* Callback class for radio config response */
class RadioConfigResponse : public BnRadioConfigResponse {
protected:
RadioServiceTest& parent_config;
public:
RadioConfigResponse(RadioServiceTest& parent_config);
virtual ~RadioConfigResponse() = default;
RadioResponseInfo rspInfo;
PhoneCapability phoneCap;
bool modemReducedFeatureSet1;
virtual ndk::ScopedAStatus getSimSlotsStatusResponse(
const RadioResponseInfo& info, const std::vector<SimSlotStatus>& slotStatus) override;
virtual ndk::ScopedAStatus setSimSlotsMappingResponse(const RadioResponseInfo& info) override;
virtual ndk::ScopedAStatus getPhoneCapabilityResponse(
const RadioResponseInfo& info, const PhoneCapability& phoneCapability) override;
virtual ndk::ScopedAStatus setPreferredDataModemResponse(
const RadioResponseInfo& info) override;
virtual ndk::ScopedAStatus getNumOfLiveModemsResponse(const RadioResponseInfo& info,
const int8_t numOfLiveModems) override;
virtual ndk::ScopedAStatus setNumOfLiveModemsResponse(const RadioResponseInfo& info) override;
virtual ndk::ScopedAStatus getHalDeviceCapabilitiesResponse(
const RadioResponseInfo& info, bool modemReducedFeatureSet1) override;
};
/* Callback class for radio config indication */
class RadioConfigIndication : public BnRadioConfigIndication {
protected:
RadioServiceTest& parent_config;
public:
RadioConfigIndication(RadioServiceTest& parent_config);
virtual ~RadioConfigIndication() = default;
virtual ndk::ScopedAStatus simSlotsStatusChanged(
RadioIndicationType type, const std::vector<SimSlotStatus>& slotStatus) override;
};
// The main test class for Radio AIDL Config.
class RadioConfigTest : public ::testing::TestWithParam<std::string>, public RadioServiceTest {
public:
virtual void SetUp() override;
ndk::ScopedAStatus updateSimCardStatus();
/* radio config service handle in RadioServiceTest */
/* radio config response handle */
std::shared_ptr<RadioConfigResponse> radioRsp_config;
/* radio config indication handle */
std::shared_ptr<RadioConfigIndication> radioInd_config;
};

View file

@ -16,7 +16,7 @@
#include "radio_data_utils.h"
RadioDataIndication::RadioDataIndication(RadioDataTest& parent) : parent_data(parent) {}
RadioDataIndication::RadioDataIndication(RadioServiceTest& parent) : parent_data(parent) {}
ndk::ScopedAStatus RadioDataIndication::dataCallListChanged(
RadioIndicationType /*type*/, const std::vector<SetupDataCallResult>& /*dcList*/) {

View file

@ -16,7 +16,7 @@
#include "radio_data_utils.h"
RadioDataResponse::RadioDataResponse(RadioResponseWaiter& parent) : parent_data(parent) {}
RadioDataResponse::RadioDataResponse(RadioServiceTest& parent) : parent_data(parent) {}
ndk::ScopedAStatus RadioDataResponse::acknowledgeRequest(int32_t /*serial*/) {
return ndk::ScopedAStatus::ok();

View file

@ -14,10 +14,11 @@
* limitations under the License.
*/
#include <aidl/android/hardware/radio/RadioAccessFamily.h>
#include <aidl/android/hardware/radio/config/IRadioConfig.h>
#include <aidl/android/hardware/radio/data/ApnTypes.h>
#include <android-base/logging.h>
#include <android/binder_manager.h>
#include <algorithm>
#include "radio_data_utils.h"
@ -45,12 +46,17 @@ void RadioDataTest::SetUp() {
radio_data->setResponseFunctions(radioRsp_data, radioInd_data);
// Assert IRadioSim exists and SIM is present before testing
radio_sim = sim::IRadioSim::fromBinder(ndk::SpAIBinder(
AServiceManager_waitForService("android.hardware.radio.sim.IRadioSim/slot1")));
ASSERT_NE(nullptr, radio_sim.get());
updateSimCardStatus();
EXPECT_EQ(CardStatus::STATE_PRESENT, cardStatus.cardState);
// 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());
radio_config = config::IRadioConfig::fromBinder(ndk::SpAIBinder(
AServiceManager_waitForService("android.hardware.radio.config.IRadioConfig/default")));
ASSERT_NE(nullptr, radio_config.get());
}
ndk::ScopedAStatus RadioDataTest::getDataCallList() {
@ -82,10 +88,18 @@ TEST_P(RadioDataTest, setupDataCall) {
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.supportedApnTypesBitmap =
static_cast<int32_t>(ApnTypes::IMS) | static_cast<int32_t>(ApnTypes::IA);
dataProfileInfo.bearerBitmap = static_cast<int32_t>(RadioAccessFamily::GPRS) |
static_cast<int32_t>(RadioAccessFamily::EDGE) |
static_cast<int32_t>(RadioAccessFamily::UMTS) |
static_cast<int32_t>(RadioAccessFamily::HSDPA) |
static_cast<int32_t>(RadioAccessFamily::HSUPA) |
static_cast<int32_t>(RadioAccessFamily::HSPA) |
static_cast<int32_t>(RadioAccessFamily::EHRPD) |
static_cast<int32_t>(RadioAccessFamily::LTE) |
static_cast<int32_t>(RadioAccessFamily::HSPAP) |
static_cast<int32_t>(RadioAccessFamily::IWLAN);
dataProfileInfo.mtuV4 = 0;
dataProfileInfo.mtuV6 = 0;
dataProfileInfo.preferred = true;
@ -130,11 +144,8 @@ TEST_P(RadioDataTest, setupDataCall_osAppId) {
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;
std::vector<unsigned char> osAppIdVec(osAppIdString.begin(), osAppIdString.end());
osAppId.osAppId = osAppIdVec;
trafficDescriptor.osAppId = osAppId;
DataProfileInfo dataProfileInfo;
@ -151,10 +162,18 @@ TEST_P(RadioDataTest, setupDataCall_osAppId) {
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.supportedApnTypesBitmap =
static_cast<int32_t>(ApnTypes::IMS) | static_cast<int32_t>(ApnTypes::IA);
dataProfileInfo.bearerBitmap = static_cast<int32_t>(RadioAccessFamily::GPRS) |
static_cast<int32_t>(RadioAccessFamily::EDGE) |
static_cast<int32_t>(RadioAccessFamily::UMTS) |
static_cast<int32_t>(RadioAccessFamily::HSDPA) |
static_cast<int32_t>(RadioAccessFamily::HSUPA) |
static_cast<int32_t>(RadioAccessFamily::HSPA) |
static_cast<int32_t>(RadioAccessFamily::EHRPD) |
static_cast<int32_t>(RadioAccessFamily::LTE) |
static_cast<int32_t>(RadioAccessFamily::HSPAP) |
static_cast<int32_t>(RadioAccessFamily::IWLAN);
dataProfileInfo.mtuV4 = 0;
dataProfileInfo.mtuV6 = 0;
dataProfileInfo.preferred = true;

View file

@ -23,17 +23,16 @@
#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;
RadioServiceTest& parent_data;
public:
RadioDataResponse(RadioResponseWaiter& parent_data);
RadioDataResponse(RadioServiceTest& parent_data);
virtual ~RadioDataResponse() = default;
RadioResponseInfo rspInfo;
@ -80,10 +79,10 @@ class RadioDataResponse : public BnRadioDataResponse {
/* Callback class for radio data indication */
class RadioDataIndication : public BnRadioDataIndication {
protected:
RadioDataTest& parent_data;
RadioServiceTest& parent_data;
public:
RadioDataIndication(RadioDataTest& parent_data);
RadioDataIndication(RadioServiceTest& parent_data);
virtual ~RadioDataIndication() = default;
virtual ndk::ScopedAStatus dataCallListChanged(
@ -99,7 +98,7 @@ class RadioDataIndication : public BnRadioDataIndication {
};
// The main test class for Radio AIDL Data.
class RadioDataTest : public ::testing::TestWithParam<std::string>, public RadioResponseWaiter {
class RadioDataTest : public ::testing::TestWithParam<std::string>, public RadioServiceTest {
protected:
/* Get current data call list */
ndk::ScopedAStatus getDataCallList();

View file

@ -16,7 +16,7 @@
#include "radio_messaging_utils.h"
RadioMessagingIndication::RadioMessagingIndication(RadioMessagingTest& parent)
RadioMessagingIndication::RadioMessagingIndication(RadioServiceTest& parent)
: parent_messaging(parent) {}
ndk::ScopedAStatus RadioMessagingIndication::cdmaNewSms(RadioIndicationType /*type*/,

View file

@ -16,7 +16,7 @@
#include "radio_messaging_utils.h"
RadioMessagingResponse::RadioMessagingResponse(RadioResponseWaiter& parent)
RadioMessagingResponse::RadioMessagingResponse(RadioServiceTest& parent)
: parent_messaging(parent) {}
ndk::ScopedAStatus RadioMessagingResponse::acknowledgeIncomingGsmSmsWithPduResponse(

View file

@ -44,12 +44,17 @@ void RadioMessagingTest::SetUp() {
radio_messaging->setResponseFunctions(radioRsp_messaging, radioInd_messaging);
// Assert IRadioSim exists and SIM is present before testing
radio_sim = sim::IRadioSim::fromBinder(ndk::SpAIBinder(
AServiceManager_waitForService("android.hardware.radio.sim.IRadioSim/slot1")));
ASSERT_NE(nullptr, radio_sim.get());
updateSimCardStatus();
EXPECT_EQ(CardStatus::STATE_PRESENT, cardStatus.cardState);
// 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());
radio_config = config::IRadioConfig::fromBinder(ndk::SpAIBinder(
AServiceManager_waitForService("android.hardware.radio.config.IRadioConfig/default")));
ASSERT_NE(nullptr, radio_config.get());
}
/*

View file

@ -29,10 +29,10 @@ class RadioMessagingTest;
/* Callback class for radio messaging response */
class RadioMessagingResponse : public BnRadioMessagingResponse {
protected:
RadioResponseWaiter& parent_messaging;
RadioServiceTest& parent_messaging;
public:
RadioMessagingResponse(RadioResponseWaiter& parent_messaging);
RadioMessagingResponse(RadioServiceTest& parent_messaging);
virtual ~RadioMessagingResponse() = default;
RadioResponseInfo rspInfo;
@ -110,10 +110,10 @@ class RadioMessagingResponse : public BnRadioMessagingResponse {
/* Callback class for radio messaging indication */
class RadioMessagingIndication : public BnRadioMessagingIndication {
protected:
RadioMessagingTest& parent_messaging;
RadioServiceTest& parent_messaging;
public:
RadioMessagingIndication(RadioMessagingTest& parent_messaging);
RadioMessagingIndication(RadioServiceTest& parent_messaging);
virtual ~RadioMessagingIndication() = default;
virtual ndk::ScopedAStatus cdmaNewSms(RadioIndicationType type,
@ -139,8 +139,7 @@ class RadioMessagingIndication : public BnRadioMessagingIndication {
};
// The main test class for Radio AIDL Messaging.
class RadioMessagingTest : public ::testing::TestWithParam<std::string>,
public RadioResponseWaiter {
class RadioMessagingTest : public ::testing::TestWithParam<std::string>, public RadioServiceTest {
public:
virtual void SetUp() override;

View file

@ -16,7 +16,7 @@
#include "radio_modem_utils.h"
RadioModemIndication::RadioModemIndication(RadioModemTest& parent) : parent_modem(parent) {}
RadioModemIndication::RadioModemIndication(RadioServiceTest& parent) : parent_modem(parent) {}
ndk::ScopedAStatus RadioModemIndication::hardwareConfigChanged(
RadioIndicationType /*type*/, const std::vector<HardwareConfig>& /*configs*/) {

View file

@ -16,7 +16,7 @@
#include "radio_modem_utils.h"
RadioModemResponse::RadioModemResponse(RadioResponseWaiter& parent) : parent_modem(parent) {}
RadioModemResponse::RadioModemResponse(RadioServiceTest& parent) : parent_modem(parent) {}
ndk::ScopedAStatus RadioModemResponse::acknowledgeRequest(int32_t /*serial*/) {
return ndk::ScopedAStatus::ok();

View file

@ -44,12 +44,17 @@ void RadioModemTest::SetUp() {
radio_modem->setResponseFunctions(radioRsp_modem, radioInd_modem);
// Assert IRadioSim exists and SIM is present before testing
radio_sim = sim::IRadioSim::fromBinder(ndk::SpAIBinder(
AServiceManager_waitForService("android.hardware.radio.sim.IRadioSim/slot1")));
ASSERT_NE(nullptr, radio_sim.get());
updateSimCardStatus();
EXPECT_EQ(CardStatus::STATE_PRESENT, cardStatus.cardState);
// 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());
radio_config = config::IRadioConfig::fromBinder(ndk::SpAIBinder(
AServiceManager_waitForService("android.hardware.radio.config.IRadioConfig/default")));
ASSERT_NE(nullptr, radio_config.get());
}
/*

View file

@ -22,7 +22,6 @@
#include "radio_aidl_hal_utils.h"
using namespace aidl::android::hardware::radio::config;
using namespace aidl::android::hardware::radio::modem;
class RadioModemTest;
@ -30,10 +29,10 @@ class RadioModemTest;
/* Callback class for radio modem response */
class RadioModemResponse : public BnRadioModemResponse {
protected:
RadioResponseWaiter& parent_modem;
RadioServiceTest& parent_modem;
public:
RadioModemResponse(RadioResponseWaiter& parent_modem);
RadioModemResponse(RadioServiceTest& parent_modem);
virtual ~RadioModemResponse() = default;
RadioResponseInfo rspInfo;
@ -87,10 +86,10 @@ class RadioModemResponse : public BnRadioModemResponse {
/* Callback class for radio modem indication */
class RadioModemIndication : public BnRadioModemIndication {
protected:
RadioModemTest& parent_modem;
RadioServiceTest& parent_modem;
public:
RadioModemIndication(RadioModemTest& parent_modem);
RadioModemIndication(RadioServiceTest& parent_modem);
virtual ~RadioModemIndication() = default;
virtual ndk::ScopedAStatus hardwareConfigChanged(
@ -109,7 +108,7 @@ class RadioModemIndication : public BnRadioModemIndication {
};
// The main test class for Radio AIDL Modem.
class RadioModemTest : public ::testing::TestWithParam<std::string>, public RadioResponseWaiter {
class RadioModemTest : public ::testing::TestWithParam<std::string>, public RadioServiceTest {
public:
virtual void SetUp() override;

View file

@ -16,7 +16,7 @@
#include "radio_network_utils.h"
RadioNetworkIndication::RadioNetworkIndication(RadioNetworkTest& parent) : parent_network(parent) {}
RadioNetworkIndication::RadioNetworkIndication(RadioServiceTest& parent) : parent_network(parent) {}
ndk::ScopedAStatus RadioNetworkIndication::barringInfoChanged(
RadioIndicationType /*type*/, const CellIdentity& /*cellIdentity*/,
@ -72,7 +72,7 @@ ndk::ScopedAStatus RadioNetworkIndication::nitzTimeReceived(RadioIndicationType
ndk::ScopedAStatus RadioNetworkIndication::registrationFailed(RadioIndicationType /*type*/,
const CellIdentity& /*cellIdentity*/,
const std::string& /*chosenPlmn*/,
Domain /*domain*/,
int32_t /*domain*/,
int32_t /*causeCode*/,
int32_t /*additionalCauseCode*/) {
return ndk::ScopedAStatus::ok();

View file

@ -16,14 +16,14 @@
#include "radio_network_utils.h"
RadioNetworkResponse::RadioNetworkResponse(RadioResponseWaiter& parent) : parent_network(parent) {}
RadioNetworkResponse::RadioNetworkResponse(RadioServiceTest& 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) {
const RadioResponseInfo& info, const int32_t networkTypeBitmap) {
rspInfo = info;
networkTypeBitmapResponse = networkTypeBitmap;
parent_network.notify(info.serial);
@ -109,7 +109,7 @@ ndk::ScopedAStatus RadioNetworkResponse::getVoiceRadioTechnologyResponse(
ndk::ScopedAStatus RadioNetworkResponse::getVoiceRegistrationStateResponse(
const RadioResponseInfo& info, const RegStateResult& regResponse) {
rspInfo = info;
regStateResp.regState = regResponse.regState;
voiceRegResp.regState = regResponse.regState;
parent_network.notify(info.serial);
return ndk::ScopedAStatus::ok();
}

View file

@ -14,6 +14,7 @@
* limitations under the License.
*/
#include <aidl/android/hardware/radio/RadioAccessFamily.h>
#include <aidl/android/hardware/radio/config/IRadioConfig.h>
#include <android-base/logging.h>
#include <android/binder_manager.h>
@ -44,12 +45,17 @@ void RadioNetworkTest::SetUp() {
radio_network->setResponseFunctions(radioRsp_network, radioInd_network);
// Assert IRadioSim exists and SIM is present before testing
radio_sim = sim::IRadioSim::fromBinder(ndk::SpAIBinder(
AServiceManager_waitForService("android.hardware.radio.sim.IRadioSim/slot1")));
ASSERT_NE(nullptr, radio_sim.get());
updateSimCardStatus();
EXPECT_EQ(CardStatus::STATE_PRESENT, cardStatus.cardState);
// 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());
radio_config = config::IRadioConfig::fromBinder(ndk::SpAIBinder(
AServiceManager_waitForService("android.hardware.radio.config.IRadioConfig/default")));
ASSERT_NE(nullptr, radio_config.get());
}
/*
@ -57,7 +63,7 @@ void RadioNetworkTest::SetUp() {
*/
TEST_P(RadioNetworkTest, setAllowedNetworkTypesBitmap) {
serial = GetRandomSerialNumber();
RadioAccessFamily allowedNetworkTypesBitmap = RadioAccessFamily::LTE;
int32_t allowedNetworkTypesBitmap = static_cast<int32_t>(RadioAccessFamily::LTE);
radio_network->setAllowedNetworkTypesBitmap(serial, allowedNetworkTypesBitmap);
@ -77,7 +83,7 @@ TEST_P(RadioNetworkTest, setAllowedNetworkTypesBitmap) {
*/
TEST_P(RadioNetworkTest, getAllowedNetworkTypesBitmap) {
serial = GetRandomSerialNumber();
RadioAccessFamily allowedNetworkTypesBitmap = RadioAccessFamily::LTE;
int32_t allowedNetworkTypesBitmap = static_cast<int32_t>(RadioAccessFamily::LTE);
radio_network->setAllowedNetworkTypesBitmap(serial, allowedNetworkTypesBitmap);

View file

@ -29,25 +29,25 @@ class RadioNetworkTest;
/* Callback class for radio network response */
class RadioNetworkResponse : public BnRadioNetworkResponse {
protected:
RadioResponseWaiter& parent_network;
RadioServiceTest& parent_network;
public:
RadioNetworkResponse(RadioResponseWaiter& parent_network);
RadioNetworkResponse(RadioServiceTest& parent_network);
virtual ~RadioNetworkResponse() = default;
RadioResponseInfo rspInfo;
std::vector<RadioBandMode> radioBandModes;
std::vector<OperatorInfo> networkInfos;
bool isNrDualConnectivityEnabled;
RadioAccessFamily networkTypeBitmapResponse;
RegStateResult regStateResp;
int networkTypeBitmapResponse;
RegStateResult voiceRegResp;
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;
const RadioResponseInfo& info, const int32_t networkTypeBitmap) override;
virtual ndk::ScopedAStatus getAvailableBandModesResponse(
const RadioResponseInfo& info, const std::vector<RadioBandMode>& bandModes) override;
@ -149,10 +149,10 @@ class RadioNetworkResponse : public BnRadioNetworkResponse {
/* Callback class for radio network indication */
class RadioNetworkIndication : public BnRadioNetworkIndication {
protected:
RadioNetworkTest& parent_network;
RadioServiceTest& parent_network;
public:
RadioNetworkIndication(RadioNetworkTest& parent_network);
RadioNetworkIndication(RadioServiceTest& parent_network);
virtual ~RadioNetworkIndication() = default;
virtual ndk::ScopedAStatus barringInfoChanged(
@ -186,7 +186,7 @@ class RadioNetworkIndication : public BnRadioNetworkIndication {
virtual ndk::ScopedAStatus registrationFailed(RadioIndicationType type,
const CellIdentity& cellIdentity,
const std::string& chosenPlmn, Domain domain,
const std::string& chosenPlmn, int32_t domain,
int32_t causeCode,
int32_t additionalCauseCode) override;
@ -201,7 +201,7 @@ class RadioNetworkIndication : public BnRadioNetworkIndication {
};
// The main test class for Radio AIDL Network.
class RadioNetworkTest : public ::testing::TestWithParam<std::string>, public RadioResponseWaiter {
class RadioNetworkTest : public ::testing::TestWithParam<std::string>, public RadioServiceTest {
public:
virtual void SetUp() override;

View file

@ -16,7 +16,7 @@
#include "radio_sim_utils.h"
RadioSimIndication::RadioSimIndication(RadioSimTest& parent) : parent_sim(parent) {}
RadioSimIndication::RadioSimIndication(RadioServiceTest& parent) : parent_sim(parent) {}
ndk::ScopedAStatus RadioSimIndication::carrierInfoForImsiEncryption(RadioIndicationType /*info*/) {
return ndk::ScopedAStatus::ok();

View file

@ -16,7 +16,7 @@
#include "radio_sim_utils.h"
RadioSimResponse::RadioSimResponse(RadioResponseWaiter& parent) : parent_sim(parent) {}
RadioSimResponse::RadioSimResponse(RadioServiceTest& parent) : parent_sim(parent) {}
ndk::ScopedAStatus RadioSimResponse::acknowledgeRequest(int32_t /*serial*/) {
return ndk::ScopedAStatus::ok();

View file

@ -43,20 +43,23 @@ void RadioSimTest::SetUp() {
ASSERT_NE(nullptr, radioInd_sim.get());
radio_sim->setResponseFunctions(radioRsp_sim, radioInd_sim);
// Assert SIM is present before testing
updateSimCardStatus();
EXPECT_EQ(CardStatus::STATE_PRESENT, cardStatus.cardState);
// 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());
radio_config = config::IRadioConfig::fromBinder(ndk::SpAIBinder(
AServiceManager_waitForService("android.hardware.radio.config.IRadioConfig/default")));
ASSERT_NE(nullptr, radio_config.get());
}
ndk::ScopedAStatus RadioSimTest::updateSimCardStatus() {
void RadioSimTest::updateSimCardStatus() {
serial = GetRandomSerialNumber();
radio_sim->getIccCardStatus(serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
return ndk::ScopedAStatus::ok();
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_sim->rspInfo.type);
EXPECT_EQ(serial, radioRsp_sim->rspInfo.serial);
EXPECT_EQ(RadioError::NONE, radioRsp_sim->rspInfo.error);
}
/*

View file

@ -29,10 +29,10 @@ class RadioSimTest;
/* Callback class for radio SIM response */
class RadioSimResponse : public BnRadioSimResponse {
protected:
RadioResponseWaiter& parent_sim;
RadioServiceTest& parent_sim;
public:
RadioSimResponse(RadioResponseWaiter& parent_sim);
RadioSimResponse(RadioServiceTest& parent_sim);
virtual ~RadioSimResponse() = default;
RadioResponseInfo rspInfo;
@ -152,10 +152,10 @@ class RadioSimResponse : public BnRadioSimResponse {
/* Callback class for radio SIM indication */
class RadioSimIndication : public BnRadioSimIndication {
protected:
RadioSimTest& parent_sim;
RadioServiceTest& parent_sim;
public:
RadioSimIndication(RadioSimTest& parent_sim);
RadioSimIndication(RadioServiceTest& parent_sim);
virtual ~RadioSimIndication() = default;
virtual ndk::ScopedAStatus carrierInfoForImsiEncryption(RadioIndicationType info) override;
@ -190,16 +190,14 @@ class RadioSimIndication : public BnRadioSimIndication {
};
// 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();
class RadioSimTest : public ::testing::TestWithParam<std::string>, public RadioServiceTest {
public:
virtual void SetUp() override;
/* radio SIM service handle */
std::shared_ptr<IRadioSim> radio_sim;
/* Override updateSimCardStatus in RadioServiceTest to not call setResponseFunctions */
void updateSimCardStatus();
/* radio SIM service handle in RadioServiceTest */
/* radio SIM response handle */
std::shared_ptr<RadioSimResponse> radioRsp_sim;
/* radio SIM indication handle */

View file

@ -16,7 +16,7 @@
#include "radio_voice_utils.h"
RadioVoiceIndication::RadioVoiceIndication(RadioVoiceTest& parent) : parent_voice(parent) {}
RadioVoiceIndication::RadioVoiceIndication(RadioServiceTest& parent) : parent_voice(parent) {}
ndk::ScopedAStatus RadioVoiceIndication::callRing(RadioIndicationType /*type*/, bool /*isGsm*/,
const CdmaSignalInfoRecord& /*record*/) {

View file

@ -16,7 +16,7 @@
#include "radio_voice_utils.h"
RadioVoiceResponse::RadioVoiceResponse(RadioResponseWaiter& parent) : parent_voice(parent) {}
RadioVoiceResponse::RadioVoiceResponse(RadioServiceTest& parent) : parent_voice(parent) {}
ndk::ScopedAStatus RadioVoiceResponse::acceptCallResponse(const RadioResponseInfo& /*info*/) {
return ndk::ScopedAStatus::ok();

View file

@ -15,6 +15,7 @@
*/
#include <aidl/android/hardware/radio/config/IRadioConfig.h>
#include <aidl/android/hardware/radio/voice/EmergencyServiceCategory.h>
#include <android-base/logging.h>
#include <android/binder_manager.h>
@ -44,12 +45,26 @@ void RadioVoiceTest::SetUp() {
radio_voice->setResponseFunctions(radioRsp_voice, radioInd_voice);
// Assert IRadioSim exists and SIM is present before testing
radio_sim = sim::IRadioSim::fromBinder(ndk::SpAIBinder(
AServiceManager_waitForService("android.hardware.radio.sim.IRadioSim/slot1")));
ASSERT_NE(nullptr, radio_sim.get());
updateSimCardStatus();
EXPECT_EQ(CardStatus::STATE_PRESENT, cardStatus.cardState);
// 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());
radio_config = config::IRadioConfig::fromBinder(ndk::SpAIBinder(
AServiceManager_waitForService("android.hardware.radio.config.IRadioConfig/default")));
ASSERT_NE(nullptr, radio_config.get());
if (isDsDsEnabled() || isTsTsEnabled()) {
radio_network = IRadioNetwork::fromBinder(ndk::SpAIBinder(AServiceManager_waitForService(
"android.hardware.radio.network.IRadioNetwork/slot1")));
ASSERT_NE(nullptr, radio_network.get());
radioRsp_network = ndk::SharedRefBase::make<RadioNetworkResponse>(*this);
radioInd_network = ndk::SharedRefBase::make<RadioNetworkIndication>(*this);
radio_network->setResponseFunctions(radioRsp_network, radioInd_network);
}
}
ndk::ScopedAStatus RadioVoiceTest::clearPotentialEstablishedCalls() {
@ -95,7 +110,7 @@ TEST_P(RadioVoiceTest, emergencyDial) {
Dial dialInfo;
dialInfo.address = std::string("911");
EmergencyServiceCategory categories = EmergencyServiceCategory::UNSPECIFIED;
int32_t categories = static_cast<int32_t>(EmergencyServiceCategory::UNSPECIFIED);
std::vector<std::string> urns = {""};
EmergencyCallRouting routing = EmergencyCallRouting::UNKNOWN;
@ -112,16 +127,13 @@ TEST_P(RadioVoiceTest, emergencyDial) {
// 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);
radio_network->getVoiceRegistrationState(serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
if (isVoiceEmergencyOnly(radioRsp_v1_6->voiceRegResp.regState) ||
isVoiceInService(radioRsp_v1_6->voiceRegResp.regState)) {
if (isVoiceEmergencyOnly(radioRsp_network->voiceRegResp.regState) ||
isVoiceInService(radioRsp_network->voiceRegResp.regState)) {
EXPECT_EQ(RadioError::NONE, rspEmergencyDial);
}
**/
} else {
EXPECT_EQ(RadioError::NONE, rspEmergencyDial);
}
@ -152,7 +164,7 @@ TEST_P(RadioVoiceTest, emergencyDial_withServices) {
Dial dialInfo;
dialInfo.address = std::string("911");
EmergencyServiceCategory categories = EmergencyServiceCategory::AMBULANCE;
int32_t categories = static_cast<int32_t>(EmergencyServiceCategory::AMBULANCE);
std::vector<std::string> urns = {"urn:service:sos.ambulance"};
EmergencyCallRouting routing = EmergencyCallRouting::UNKNOWN;
@ -170,16 +182,13 @@ TEST_P(RadioVoiceTest, emergencyDial_withServices) {
// 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);
radio_network->getVoiceRegistrationState(serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
if (isVoiceEmergencyOnly(radioRsp_v1_6->voiceRegResp.regState) ||
isVoiceInService(radioRsp_v1_6->voiceRegResp.regState)) {
if (isVoiceEmergencyOnly(radioRsp_network->voiceRegResp.regState) ||
isVoiceInService(radioRsp_network->voiceRegResp.regState)) {
EXPECT_EQ(RadioError::NONE, rspEmergencyDial);
}
**/
} else {
EXPECT_EQ(RadioError::NONE, rspEmergencyDial);
}
@ -209,7 +218,7 @@ TEST_P(RadioVoiceTest, emergencyDial_withEmergencyRouting) {
Dial dialInfo;
dialInfo.address = std::string("911");
EmergencyServiceCategory categories = EmergencyServiceCategory::UNSPECIFIED;
int32_t categories = static_cast<int32_t>(EmergencyServiceCategory::UNSPECIFIED);
std::vector<std::string> urns = {""};
EmergencyCallRouting routing = EmergencyCallRouting::EMERGENCY;
@ -227,16 +236,13 @@ TEST_P(RadioVoiceTest, emergencyDial_withEmergencyRouting) {
// 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);
radio_network->getVoiceRegistrationState(serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
if (isVoiceEmergencyOnly(radioRsp_v1_6->voiceRegResp.regState) ||
isVoiceInService(radioRsp_v1_6->voiceRegResp.regState)) {
if (isVoiceEmergencyOnly(radioRsp_network->voiceRegResp.regState) ||
isVoiceInService(radioRsp_network->voiceRegResp.regState)) {
EXPECT_EQ(RadioError::NONE, rspEmergencyDial);
}
**/
} else {
EXPECT_EQ(RadioError::NONE, rspEmergencyDial);
}

View file

@ -21,6 +21,7 @@
#include <aidl/android/hardware/radio/voice/IRadioVoice.h>
#include "radio_aidl_hal_utils.h"
#include "radio_network_utils.h"
using namespace aidl::android::hardware::radio::voice;
@ -29,10 +30,10 @@ class RadioVoiceTest;
/* Callback class for radio voice response */
class RadioVoiceResponse : public BnRadioVoiceResponse {
protected:
RadioResponseWaiter& parent_voice;
RadioServiceTest& parent_voice;
public:
RadioVoiceResponse(RadioResponseWaiter& parent_voice);
RadioVoiceResponse(RadioServiceTest& parent_voice);
virtual ~RadioVoiceResponse() = default;
RadioResponseInfo rspInfo;
@ -130,10 +131,10 @@ class RadioVoiceResponse : public BnRadioVoiceResponse {
/* Callback class for radio voice indication */
class RadioVoiceIndication : public BnRadioVoiceIndication {
protected:
RadioVoiceTest& parent_voice;
RadioServiceTest& parent_voice;
public:
RadioVoiceIndication(RadioVoiceTest& parent_voice);
RadioVoiceIndication(RadioServiceTest& parent_voice);
virtual ~RadioVoiceIndication() = default;
virtual ndk::ScopedAStatus callRing(RadioIndicationType type, bool isGsm,
@ -175,10 +176,13 @@ class RadioVoiceIndication : public BnRadioVoiceIndication {
};
// The main test class for Radio AIDL Voice.
class RadioVoiceTest : public ::testing::TestWithParam<std::string>, public RadioResponseWaiter {
class RadioVoiceTest : public ::testing::TestWithParam<std::string>, public RadioServiceTest {
protected:
/* Clear Potential Established Calls */
virtual ndk::ScopedAStatus clearPotentialEstablishedCalls();
std::shared_ptr<network::IRadioNetwork> radio_network;
std::shared_ptr<RadioNetworkResponse> radioRsp_network;
std::shared_ptr<RadioNetworkIndication> radioInd_network;
public:
virtual void SetUp() override;