mirror of
https://github.com/Evolution-X/hardware_interfaces
synced 2026-02-01 11:36:00 +00:00
Merge "Check emergency dialing result in DSDS or TSTS only if slot is in service or emergency only." into rvc-qpr-dev am: e48f759713 am: eefc950629
Original change: https://googleplex-android-review.googlesource.com/c/platform/hardware/interfaces/+/12411657 Change-Id: I98923d5773a6312266327e629886e6e3b4a6ccb7
This commit is contained in:
@@ -17,6 +17,7 @@
|
||||
|
||||
#include <vts_test_util.h>
|
||||
#include <iostream>
|
||||
#include "VtsCoreUtil.h"
|
||||
|
||||
int GetRandomSerialNumber() {
|
||||
return rand();
|
||||
@@ -78,4 +79,24 @@ bool deviceSupportsFeature(const char* feature) {
|
||||
__android_log_print(ANDROID_LOG_INFO, LOG_TAG, "Feature %s: %ssupported", feature,
|
||||
hasFeature ? "" : "not ");
|
||||
return hasFeature;
|
||||
}
|
||||
|
||||
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 ::android::hardware::radio::V1_0::RegState::REG_HOME == state ||
|
||||
::android::hardware::radio::V1_0::RegState::REG_ROAMING == state;
|
||||
}
|
||||
|
||||
bool isVoiceEmergencyOnly(RegState state) {
|
||||
return ::android::hardware::radio::V1_0::RegState::NOT_REG_MT_NOT_SEARCHING_OP_EM == state ||
|
||||
::android::hardware::radio::V1_0::RegState::NOT_REG_MT_SEARCHING_OP_EM == state ||
|
||||
::android::hardware::radio::V1_0::RegState::REG_DENIED_EM == state ||
|
||||
::android::hardware::radio::V1_0::RegState::UNKNOWN_EM == state;
|
||||
}
|
||||
@@ -21,6 +21,7 @@
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
using ::android::hardware::radio::V1_0::RadioError;
|
||||
using ::android::hardware::radio::V1_0::RegState;
|
||||
using ::android::hardware::radio::V1_0::SapResultCode;
|
||||
using namespace std;
|
||||
|
||||
@@ -55,3 +56,23 @@ int GetRandomSerialNumber();
|
||||
* Check if device supports feature.
|
||||
*/
|
||||
bool deviceSupportsFeature(const char* feature);
|
||||
|
||||
/*
|
||||
* Check if device is in DSDS.
|
||||
*/
|
||||
bool isDsDsEnabled();
|
||||
|
||||
/*
|
||||
* Check if device is in TSTS.
|
||||
*/
|
||||
bool isTsTsEnabled();
|
||||
|
||||
/*
|
||||
* Check if voice status is in emergency only.
|
||||
*/
|
||||
bool isVoiceEmergencyOnly(RegState state);
|
||||
|
||||
/*
|
||||
* Check if voice status is in service.
|
||||
*/
|
||||
bool isVoiceInService(RegState state);
|
||||
@@ -56,7 +56,21 @@ TEST_P(RadioHidlTest_v1_4, emergencyDial) {
|
||||
EXPECT_EQ(serial, radioRsp_v1_4->rspInfo.serial);
|
||||
|
||||
ALOGI("emergencyDial, rspInfo.error = %s\n", toString(radioRsp_v1_4->rspInfo.error).c_str());
|
||||
EXPECT_EQ(RadioError::NONE, radioRsp_v1_4->rspInfo.error);
|
||||
|
||||
::android::hardware::radio::V1_0::RadioError rspEmergencyDial = radioRsp_v1_4->rspInfo.error;
|
||||
// In DSDS or TSTS, we only check the result if the current slot is IN_SERVICE
|
||||
// or Emergency_Only.
|
||||
if (isDsDsEnabled() || isTsTsEnabled()) {
|
||||
serial = GetRandomSerialNumber();
|
||||
radio_v1_4->getVoiceRegistrationState(serial);
|
||||
EXPECT_EQ(std::cv_status::no_timeout, wait());
|
||||
if (isVoiceEmergencyOnly(radioRsp_v1_4->voiceRegResp.regState) ||
|
||||
isVoiceInService(radioRsp_v1_4->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);
|
||||
@@ -95,8 +109,21 @@ TEST_P(RadioHidlTest_v1_4, emergencyDial_withServices) {
|
||||
|
||||
ALOGI("emergencyDial_withServices, rspInfo.error = %s\n",
|
||||
toString(radioRsp_v1_4->rspInfo.error).c_str());
|
||||
EXPECT_EQ(RadioError::NONE, radioRsp_v1_4->rspInfo.error);
|
||||
::android::hardware::radio::V1_0::RadioError rspEmergencyDial = radioRsp_v1_4->rspInfo.error;
|
||||
|
||||
// In DSDS or TSTS, we only check the result if the current slot is IN_SERVICE
|
||||
// or Emergency_Only.
|
||||
if (isDsDsEnabled() || isTsTsEnabled()) {
|
||||
serial = GetRandomSerialNumber();
|
||||
radio_v1_4->getVoiceRegistrationState(serial);
|
||||
EXPECT_EQ(std::cv_status::no_timeout, wait());
|
||||
if (isVoiceEmergencyOnly(radioRsp_v1_4->voiceRegResp.regState) ||
|
||||
isVoiceInService(radioRsp_v1_4->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);
|
||||
|
||||
@@ -134,7 +161,21 @@ TEST_P(RadioHidlTest_v1_4, emergencyDial_withEmergencyRouting) {
|
||||
|
||||
ALOGI("emergencyDial_withEmergencyRouting, rspInfo.error = %s\n",
|
||||
toString(radioRsp_v1_4->rspInfo.error).c_str());
|
||||
EXPECT_EQ(RadioError::NONE, radioRsp_v1_4->rspInfo.error);
|
||||
::android::hardware::radio::V1_0::RadioError rspEmergencyDial = radioRsp_v1_4->rspInfo.error;
|
||||
|
||||
// In DSDS or TSTS, we only check the result if the current slot is IN_SERVICE
|
||||
// or Emergency_Only.
|
||||
if (isDsDsEnabled() || isTsTsEnabled()) {
|
||||
serial = GetRandomSerialNumber();
|
||||
radio_v1_4->getVoiceRegistrationState(serial);
|
||||
EXPECT_EQ(std::cv_status::no_timeout, wait());
|
||||
if (isVoiceEmergencyOnly(radioRsp_v1_4->voiceRegResp.regState) ||
|
||||
isVoiceInService(radioRsp_v1_4->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);
|
||||
|
||||
@@ -64,6 +64,7 @@ class RadioResponse_v1_4 : public ::android::hardware::radio::V1_4::IRadioRespon
|
||||
|
||||
// Call
|
||||
hidl_vec<::android::hardware::radio::V1_2::Call> currentCalls;
|
||||
::android::hardware::radio::V1_2::VoiceRegStateResult voiceRegResp;
|
||||
|
||||
// Modem
|
||||
bool isModemEnabled;
|
||||
|
||||
@@ -762,8 +762,9 @@ Return<void> RadioResponse_v1_4::getCellInfoListResponse_1_2(
|
||||
|
||||
Return<void> RadioResponse_v1_4::getVoiceRegistrationStateResponse_1_2(
|
||||
const RadioResponseInfo& info,
|
||||
const ::android::hardware::radio::V1_2::VoiceRegStateResult& /*voiceRegResponse*/) {
|
||||
const ::android::hardware::radio::V1_2::VoiceRegStateResult& voiceRegResponse) {
|
||||
rspInfo = info;
|
||||
voiceRegResp = voiceRegResponse;
|
||||
parent_v1_4.notify(info.serial);
|
||||
return Void();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user