Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7bceb8da authored by Shuo Qian's avatar Shuo Qian Committed by Automerger Merge Worker
Browse files

Merge "Check emergency dialing result in DSDS or TSTS only if slot is in...

Merge "Check emergency dialing result in DSDS or TSTS only if slot is in service or emergency only." into rvc-qpr-dev am: e48f7597 am: eefc9506

Original change: https://googleplex-android-review.googlesource.com/c/platform/hardware/interfaces/+/12411657

Change-Id: I98923d5773a6312266327e629886e6e3b4a6ccb7
parents f22b7580 eefc9506
Loading
Loading
Loading
Loading
+21 −0
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@

#include <vts_test_util.h>
#include <iostream>
#include "VtsCoreUtil.h"

int GetRandomSerialNumber() {
    return rand();
@@ -79,3 +80,23 @@ bool deviceSupportsFeature(const char* 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;
}
 No newline at end of file
+21 −0
Original line number Diff line number Diff line
@@ -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);
 No newline at end of file
+44 −3
Original line number Diff line number Diff line
@@ -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);
+1 −0
Original line number Diff line number Diff line
@@ -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;
+2 −1
Original line number Diff line number Diff line
@@ -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();
}