Sarah Chin | fc5603b | 2021-12-21 11:34:00 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2021 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | #include <aidl/android/hardware/radio/config/IRadioConfig.h> |
Sarah Chin | fc5603b | 2021-12-21 11:34:00 -0800 | [diff] [blame] | 18 | #include <android/binder_manager.h> |
| 19 | |
| 20 | #include "radio_modem_utils.h" |
| 21 | |
| 22 | #define ASSERT_OK(ret) ASSERT_TRUE(ret.isOk()) |
| 23 | |
| 24 | void RadioModemTest::SetUp() { |
Sarah Chin | a1efe7a | 2023-05-02 21:11:41 -0700 | [diff] [blame] | 25 | RadioServiceTest::SetUp(); |
Sarah Chin | fc5603b | 2021-12-21 11:34:00 -0800 | [diff] [blame] | 26 | std::string serviceName = GetParam(); |
| 27 | |
| 28 | if (!isServiceValidForDeviceConfiguration(serviceName)) { |
| 29 | ALOGI("Skipped the test due to device configuration."); |
| 30 | GTEST_SKIP(); |
| 31 | } |
| 32 | |
| 33 | radio_modem = IRadioModem::fromBinder( |
| 34 | ndk::SpAIBinder(AServiceManager_waitForService(GetParam().c_str()))); |
| 35 | ASSERT_NE(nullptr, radio_modem.get()); |
| 36 | |
| 37 | radioRsp_modem = ndk::SharedRefBase::make<RadioModemResponse>(*this); |
| 38 | ASSERT_NE(nullptr, radioRsp_modem.get()); |
| 39 | |
Sarah Chin | fc5603b | 2021-12-21 11:34:00 -0800 | [diff] [blame] | 40 | radioInd_modem = ndk::SharedRefBase::make<RadioModemIndication>(*this); |
| 41 | ASSERT_NE(nullptr, radioInd_modem.get()); |
| 42 | |
| 43 | radio_modem->setResponseFunctions(radioRsp_modem, radioInd_modem); |
| 44 | |
Sarah Chin | c83bce4 | 2021-12-29 00:35:12 -0800 | [diff] [blame] | 45 | // Assert IRadioSim exists and SIM is present before testing |
| 46 | radio_sim = sim::IRadioSim::fromBinder(ndk::SpAIBinder( |
| 47 | AServiceManager_waitForService("android.hardware.radio.sim.IRadioSim/slot1"))); |
| 48 | ASSERT_NE(nullptr, radio_sim.get()); |
| 49 | updateSimCardStatus(); |
| 50 | EXPECT_EQ(CardStatus::STATE_PRESENT, cardStatus.cardState); |
| 51 | |
Sarah Chin | fc5603b | 2021-12-21 11:34:00 -0800 | [diff] [blame] | 52 | // Assert IRadioConfig exists before testing |
Sarah Chin | c83bce4 | 2021-12-29 00:35:12 -0800 | [diff] [blame] | 53 | radio_config = config::IRadioConfig::fromBinder(ndk::SpAIBinder( |
| 54 | AServiceManager_waitForService("android.hardware.radio.config.IRadioConfig/default"))); |
| 55 | ASSERT_NE(nullptr, radio_config.get()); |
Sarah Chin | fc5603b | 2021-12-21 11:34:00 -0800 | [diff] [blame] | 56 | } |
| 57 | |
| 58 | /* |
| 59 | * Test IRadioModem.setRadioPower() for the response returned. |
| 60 | */ |
| 61 | TEST_P(RadioModemTest, setRadioPower_emergencyCall_cancelled) { |
| 62 | // Set radio power to off. |
| 63 | serial = GetRandomSerialNumber(); |
| 64 | radio_modem->setRadioPower(serial, false, false, false); |
| 65 | EXPECT_EQ(std::cv_status::no_timeout, wait()); |
| 66 | EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_modem->rspInfo.type); |
| 67 | EXPECT_EQ(serial, radioRsp_modem->rspInfo.serial); |
| 68 | EXPECT_EQ(RadioError::NONE, radioRsp_modem->rspInfo.error); |
| 69 | |
| 70 | // Set radio power to on with forEmergencyCall being true. This should put modem to only scan |
| 71 | // emergency call bands. |
| 72 | serial = GetRandomSerialNumber(); |
| 73 | radio_modem->setRadioPower(serial, true, true, true); |
| 74 | EXPECT_EQ(std::cv_status::no_timeout, wait()); |
| 75 | EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_modem->rspInfo.type); |
| 76 | EXPECT_EQ(serial, radioRsp_modem->rspInfo.serial); |
| 77 | EXPECT_EQ(RadioError::NONE, radioRsp_modem->rspInfo.error); |
| 78 | |
| 79 | // Set radio power to on with forEmergencyCall being false. This should put modem in regular |
| 80 | // operation modem. |
| 81 | serial = GetRandomSerialNumber(); |
| 82 | radio_modem->setRadioPower(serial, true, false, false); |
| 83 | EXPECT_EQ(std::cv_status::no_timeout, wait()); |
| 84 | EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_modem->rspInfo.type); |
| 85 | EXPECT_EQ(serial, radioRsp_modem->rspInfo.serial); |
| 86 | EXPECT_EQ(RadioError::NONE, radioRsp_modem->rspInfo.error); |
| 87 | } |
Sarah Chin | 912bdf3 | 2022-01-28 01:02:16 -0800 | [diff] [blame] | 88 | |
| 89 | /* |
| 90 | * Test IRadioModem.enableModem() for the response returned. |
| 91 | */ |
| 92 | TEST_P(RadioModemTest, enableModem) { |
| 93 | serial = GetRandomSerialNumber(); |
| 94 | |
| 95 | if (isSsSsEnabled()) { |
| 96 | ALOGI("enableModem, no need to test in single SIM mode"); |
| 97 | return; |
| 98 | } |
| 99 | |
| 100 | bool responseToggle = radioRsp_modem->enableModemResponseToggle; |
| 101 | ndk::ScopedAStatus res = radio_modem->enableModem(serial, true); |
| 102 | ASSERT_OK(res); |
| 103 | EXPECT_EQ(std::cv_status::no_timeout, wait()); |
| 104 | EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_modem->rspInfo.type); |
| 105 | EXPECT_EQ(serial, radioRsp_modem->rspInfo.serial); |
| 106 | ALOGI("getModemStackStatus, rspInfo.error = %s\n", |
| 107 | toString(radioRsp_modem->rspInfo.error).c_str()); |
| 108 | ASSERT_TRUE(CheckAnyOfErrors(radioRsp_modem->rspInfo.error, |
| 109 | {RadioError::NONE, RadioError::RADIO_NOT_AVAILABLE, |
| 110 | RadioError::MODEM_ERR, RadioError::INVALID_STATE})); |
| 111 | |
| 112 | // checking if getModemStackStatus returns true, as modem was enabled above |
| 113 | if (RadioError::NONE == radioRsp_modem->rspInfo.error) { |
| 114 | // wait until modem enabling is finished |
| 115 | while (responseToggle == radioRsp_modem->enableModemResponseToggle) { |
| 116 | sleep(1); |
| 117 | } |
| 118 | ndk::ScopedAStatus resEnabled = radio_modem->getModemStackStatus(serial); |
| 119 | ASSERT_OK(resEnabled); |
| 120 | EXPECT_EQ(std::cv_status::no_timeout, wait()); |
| 121 | EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_modem->rspInfo.type); |
| 122 | EXPECT_EQ(serial, radioRsp_modem->rspInfo.serial); |
| 123 | ALOGI("getModemStackStatus, rspInfo.error = %s\n", |
| 124 | toString(radioRsp_modem->rspInfo.error).c_str()); |
| 125 | ASSERT_TRUE(CheckAnyOfErrors(radioRsp_modem->rspInfo.error, |
| 126 | {RadioError::NONE, RadioError::RADIO_NOT_AVAILABLE, |
| 127 | RadioError::MODEM_ERR, RadioError::INVALID_STATE})); |
| 128 | // verify that enableModem did set isEnabled correctly |
| 129 | EXPECT_EQ(true, radioRsp_modem->isModemEnabled); |
| 130 | } |
| 131 | } |
| 132 | |
| 133 | /* |
| 134 | * Test IRadioModem.getModemStackStatus() for the response returned. |
| 135 | */ |
| 136 | TEST_P(RadioModemTest, getModemStackStatus) { |
| 137 | serial = GetRandomSerialNumber(); |
| 138 | |
| 139 | ndk::ScopedAStatus res = radio_modem->getModemStackStatus(serial); |
| 140 | ASSERT_OK(res); |
| 141 | EXPECT_EQ(std::cv_status::no_timeout, wait()); |
| 142 | EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_modem->rspInfo.type); |
| 143 | EXPECT_EQ(serial, radioRsp_modem->rspInfo.serial); |
| 144 | ALOGI("getModemStackStatus, rspInfo.error = %s\n", |
| 145 | toString(radioRsp_modem->rspInfo.error).c_str()); |
| 146 | ASSERT_TRUE(CheckAnyOfErrors( |
| 147 | radioRsp_modem->rspInfo.error, |
| 148 | {RadioError::NONE, RadioError::RADIO_NOT_AVAILABLE, RadioError::MODEM_ERR})); |
| 149 | } |
| 150 | |
| 151 | /* |
| 152 | * Test IRadioModem.getBasebandVersion() for the response returned. |
| 153 | */ |
| 154 | TEST_P(RadioModemTest, getBasebandVersion) { |
Sarah Chin | 912bdf3 | 2022-01-28 01:02:16 -0800 | [diff] [blame] | 155 | serial = GetRandomSerialNumber(); |
| 156 | |
| 157 | radio_modem->getBasebandVersion(serial); |
| 158 | EXPECT_EQ(std::cv_status::no_timeout, wait()); |
| 159 | EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_modem->rspInfo.type); |
| 160 | EXPECT_EQ(serial, radioRsp_modem->rspInfo.serial); |
| 161 | |
| 162 | if (cardStatus.cardState == CardStatus::STATE_ABSENT) { |
| 163 | EXPECT_EQ(RadioError::NONE, radioRsp_modem->rspInfo.error); |
| 164 | } |
Sarah Chin | 912bdf3 | 2022-01-28 01:02:16 -0800 | [diff] [blame] | 165 | } |
| 166 | |
| 167 | /* |
| 168 | * Test IRadioModem.getDeviceIdentity() for the response returned. |
| 169 | */ |
| 170 | TEST_P(RadioModemTest, getDeviceIdentity) { |
Sarah Chin | 912bdf3 | 2022-01-28 01:02:16 -0800 | [diff] [blame] | 171 | serial = GetRandomSerialNumber(); |
| 172 | |
| 173 | radio_modem->getDeviceIdentity(serial); |
| 174 | EXPECT_EQ(std::cv_status::no_timeout, wait()); |
| 175 | EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_modem->rspInfo.type); |
| 176 | EXPECT_EQ(serial, radioRsp_modem->rspInfo.serial); |
| 177 | |
| 178 | if (cardStatus.cardState == CardStatus::STATE_ABSENT) { |
| 179 | ASSERT_TRUE(CheckAnyOfErrors(radioRsp_modem->rspInfo.error, |
| 180 | {RadioError::NONE, RadioError::EMPTY_RECORD})); |
| 181 | } |
Sarah Chin | 912bdf3 | 2022-01-28 01:02:16 -0800 | [diff] [blame] | 182 | } |
| 183 | |
| 184 | /* |
arunvoddu | d9bbd44 | 2022-11-15 08:39:26 +0000 | [diff] [blame] | 185 | * Test IRadioModem.getImei() for the response returned. |
| 186 | */ |
| 187 | TEST_P(RadioModemTest, getImei) { |
Muralidhar Reddy | eb1c617 | 2023-04-12 12:55:19 +0000 | [diff] [blame] | 188 | int32_t aidl_version; |
| 189 | ndk::ScopedAStatus aidl_status = radio_modem->getInterfaceVersion(&aidl_version); |
| 190 | ASSERT_OK(aidl_status); |
| 191 | if (aidl_version < 2) { |
| 192 | ALOGI("Skipped the test since getImei is not supported on version < 2"); |
| 193 | GTEST_SKIP(); |
| 194 | } |
arunvoddu | d9bbd44 | 2022-11-15 08:39:26 +0000 | [diff] [blame] | 195 | serial = GetRandomSerialNumber(); |
| 196 | |
| 197 | radio_modem->getImei(serial); |
| 198 | EXPECT_EQ(std::cv_status::no_timeout, wait()); |
| 199 | EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_modem->rspInfo.type); |
| 200 | EXPECT_EQ(serial, radioRsp_modem->rspInfo.serial); |
| 201 | |
| 202 | if (cardStatus.cardState == CardStatus::STATE_ABSENT) { |
| 203 | ASSERT_TRUE(CheckAnyOfErrors(radioRsp_modem->rspInfo.error, |
| 204 | {RadioError::NONE, RadioError::EMPTY_RECORD})); |
| 205 | } |
arunvoddu | d9bbd44 | 2022-11-15 08:39:26 +0000 | [diff] [blame] | 206 | } |
| 207 | |
| 208 | /* |
Sarah Chin | 912bdf3 | 2022-01-28 01:02:16 -0800 | [diff] [blame] | 209 | * Test IRadioModem.nvReadItem() for the response returned. |
| 210 | */ |
| 211 | TEST_P(RadioModemTest, nvReadItem) { |
Sarah Chin | 912bdf3 | 2022-01-28 01:02:16 -0800 | [diff] [blame] | 212 | serial = GetRandomSerialNumber(); |
| 213 | |
| 214 | radio_modem->nvReadItem(serial, NvItem::LTE_BAND_ENABLE_25); |
| 215 | EXPECT_EQ(std::cv_status::no_timeout, wait()); |
| 216 | EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_modem->rspInfo.type); |
| 217 | EXPECT_EQ(serial, radioRsp_modem->rspInfo.serial); |
| 218 | |
| 219 | if (cardStatus.cardState == CardStatus::STATE_ABSENT) { |
| 220 | ASSERT_TRUE(CheckAnyOfErrors(radioRsp_modem->rspInfo.error, {RadioError::NONE}, |
| 221 | CHECK_GENERAL_ERROR)); |
| 222 | } |
Sarah Chin | 912bdf3 | 2022-01-28 01:02:16 -0800 | [diff] [blame] | 223 | } |
| 224 | |
| 225 | /* |
| 226 | * Test IRadioModem.nvWriteItem() for the response returned. |
| 227 | */ |
| 228 | TEST_P(RadioModemTest, nvWriteItem) { |
Sarah Chin | 912bdf3 | 2022-01-28 01:02:16 -0800 | [diff] [blame] | 229 | serial = GetRandomSerialNumber(); |
| 230 | NvWriteItem item; |
| 231 | memset(&item, 0, sizeof(item)); |
| 232 | item.value = std::string(); |
| 233 | |
| 234 | radio_modem->nvWriteItem(serial, item); |
| 235 | EXPECT_EQ(std::cv_status::no_timeout, wait()); |
| 236 | EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_modem->rspInfo.type); |
| 237 | EXPECT_EQ(serial, radioRsp_modem->rspInfo.serial); |
| 238 | |
| 239 | if (cardStatus.cardState == CardStatus::STATE_ABSENT) { |
| 240 | ASSERT_TRUE(CheckAnyOfErrors(radioRsp_modem->rspInfo.error, {RadioError::NONE}, |
| 241 | CHECK_GENERAL_ERROR)); |
| 242 | } |
Sarah Chin | 912bdf3 | 2022-01-28 01:02:16 -0800 | [diff] [blame] | 243 | } |
| 244 | |
| 245 | /* |
| 246 | * Test IRadioModem.nvWriteCdmaPrl() for the response returned. |
| 247 | */ |
| 248 | TEST_P(RadioModemTest, nvWriteCdmaPrl) { |
Sarah Chin | 912bdf3 | 2022-01-28 01:02:16 -0800 | [diff] [blame] | 249 | serial = GetRandomSerialNumber(); |
| 250 | std::vector<uint8_t> prl = {1, 2, 3, 4, 5}; |
| 251 | |
| 252 | radio_modem->nvWriteCdmaPrl(serial, std::vector<uint8_t>(prl)); |
| 253 | EXPECT_EQ(std::cv_status::no_timeout, wait()); |
| 254 | EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_modem->rspInfo.type); |
| 255 | EXPECT_EQ(serial, radioRsp_modem->rspInfo.serial); |
| 256 | |
| 257 | if (cardStatus.cardState == CardStatus::STATE_ABSENT) { |
| 258 | ASSERT_TRUE(CheckAnyOfErrors(radioRsp_modem->rspInfo.error, {RadioError::NONE}, |
| 259 | CHECK_GENERAL_ERROR)); |
| 260 | } |
Sarah Chin | 912bdf3 | 2022-01-28 01:02:16 -0800 | [diff] [blame] | 261 | } |
| 262 | |
| 263 | /* |
| 264 | * Test IRadioModem.nvResetConfig() for the response returned. |
| 265 | */ |
| 266 | TEST_P(RadioModemTest, nvResetConfig) { |
Sarah Chin | 912bdf3 | 2022-01-28 01:02:16 -0800 | [diff] [blame] | 267 | serial = GetRandomSerialNumber(); |
| 268 | |
| 269 | radio_modem->nvResetConfig(serial, ResetNvType::FACTORY_RESET); |
| 270 | EXPECT_EQ(std::cv_status::no_timeout, wait()); |
| 271 | EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_modem->rspInfo.type); |
| 272 | EXPECT_EQ(serial, radioRsp_modem->rspInfo.serial); |
| 273 | |
| 274 | if (cardStatus.cardState == CardStatus::STATE_ABSENT) { |
| 275 | ASSERT_TRUE(CheckAnyOfErrors(radioRsp_modem->rspInfo.error, |
| 276 | {RadioError::NONE, RadioError::REQUEST_NOT_SUPPORTED})); |
| 277 | } |
Sarah Chin | 757a758 | 2023-04-20 16:10:37 -0700 | [diff] [blame] | 278 | // wait until modem reset finishes |
| 279 | sleep(10); |
Sarah Chin | 912bdf3 | 2022-01-28 01:02:16 -0800 | [diff] [blame] | 280 | } |
| 281 | |
| 282 | /* |
| 283 | * Test IRadioModem.getHardwareConfig() for the response returned. |
| 284 | */ |
| 285 | TEST_P(RadioModemTest, getHardwareConfig) { |
Sarah Chin | 912bdf3 | 2022-01-28 01:02:16 -0800 | [diff] [blame] | 286 | serial = GetRandomSerialNumber(); |
| 287 | |
| 288 | radio_modem->getHardwareConfig(serial); |
| 289 | EXPECT_EQ(std::cv_status::no_timeout, wait()); |
| 290 | EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_modem->rspInfo.type); |
| 291 | EXPECT_EQ(serial, radioRsp_modem->rspInfo.serial); |
| 292 | |
| 293 | if (cardStatus.cardState == CardStatus::STATE_ABSENT) { |
| 294 | ASSERT_TRUE(CheckAnyOfErrors(radioRsp_modem->rspInfo.error, {RadioError::NONE}, |
| 295 | CHECK_GENERAL_ERROR)); |
| 296 | } |
Sarah Chin | 912bdf3 | 2022-01-28 01:02:16 -0800 | [diff] [blame] | 297 | } |
| 298 | |
| 299 | /* |
| 300 | * The following test is disabled due to b/64734869 |
| 301 | * |
| 302 | * Test IRadioModem.requestShutdown() for the response returned. |
| 303 | */ |
| 304 | TEST_P(RadioModemTest, DISABLED_requestShutdown) { |
| 305 | serial = GetRandomSerialNumber(); |
| 306 | |
| 307 | radio_modem->requestShutdown(serial); |
| 308 | EXPECT_EQ(std::cv_status::no_timeout, wait()); |
| 309 | EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_modem->rspInfo.type); |
| 310 | EXPECT_EQ(serial, radioRsp_modem->rspInfo.serial); |
| 311 | |
| 312 | if (cardStatus.cardState == CardStatus::STATE_ABSENT) { |
| 313 | ASSERT_TRUE(CheckAnyOfErrors(radioRsp_modem->rspInfo.error, {RadioError::NONE}, |
| 314 | CHECK_GENERAL_ERROR)); |
| 315 | } |
| 316 | } |
| 317 | |
| 318 | /* |
| 319 | * Test IRadioModem.getRadioCapability() for the response returned. |
| 320 | */ |
| 321 | TEST_P(RadioModemTest, getRadioCapability) { |
Sarah Chin | 912bdf3 | 2022-01-28 01:02:16 -0800 | [diff] [blame] | 322 | serial = GetRandomSerialNumber(); |
| 323 | |
| 324 | radio_modem->getRadioCapability(serial); |
| 325 | EXPECT_EQ(std::cv_status::no_timeout, wait()); |
| 326 | EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_modem->rspInfo.type); |
| 327 | EXPECT_EQ(serial, radioRsp_modem->rspInfo.serial); |
| 328 | |
| 329 | if (cardStatus.cardState == CardStatus::STATE_ABSENT) { |
| 330 | EXPECT_EQ(RadioError::NONE, radioRsp_modem->rspInfo.error); |
| 331 | } |
Sarah Chin | 912bdf3 | 2022-01-28 01:02:16 -0800 | [diff] [blame] | 332 | } |
| 333 | |
| 334 | /* |
| 335 | * Test IRadioModem.setRadioCapability() for the response returned. |
| 336 | */ |
| 337 | TEST_P(RadioModemTest, setRadioCapability) { |
Sarah Chin | 912bdf3 | 2022-01-28 01:02:16 -0800 | [diff] [blame] | 338 | serial = GetRandomSerialNumber(); |
| 339 | RadioCapability rc; |
| 340 | memset(&rc, 0, sizeof(rc)); |
| 341 | rc.logicalModemUuid = std::string(); |
| 342 | |
| 343 | radio_modem->setRadioCapability(serial, rc); |
| 344 | EXPECT_EQ(std::cv_status::no_timeout, wait()); |
| 345 | EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_modem->rspInfo.type); |
| 346 | EXPECT_EQ(serial, radioRsp_modem->rspInfo.serial); |
| 347 | |
| 348 | if (cardStatus.cardState == CardStatus::STATE_ABSENT) { |
| 349 | ASSERT_TRUE(CheckAnyOfErrors(radioRsp_modem->rspInfo.error, |
| 350 | {RadioError::INVALID_ARGUMENTS, RadioError::INVALID_STATE}, |
| 351 | CHECK_GENERAL_ERROR)); |
| 352 | } |
Sarah Chin | 912bdf3 | 2022-01-28 01:02:16 -0800 | [diff] [blame] | 353 | } |
| 354 | |
| 355 | /* |
| 356 | * Test IRadioModem.getModemActivityInfo() for the response returned. |
| 357 | */ |
| 358 | TEST_P(RadioModemTest, getModemActivityInfo) { |
Sarah Chin | 912bdf3 | 2022-01-28 01:02:16 -0800 | [diff] [blame] | 359 | serial = GetRandomSerialNumber(); |
| 360 | |
| 361 | radio_modem->getModemActivityInfo(serial); |
| 362 | EXPECT_EQ(std::cv_status::no_timeout, wait()); |
| 363 | EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_modem->rspInfo.type); |
| 364 | EXPECT_EQ(serial, radioRsp_modem->rspInfo.serial); |
| 365 | |
| 366 | if (cardStatus.cardState == CardStatus::STATE_ABSENT) { |
| 367 | ASSERT_TRUE(CheckAnyOfErrors(radioRsp_modem->rspInfo.error, |
| 368 | {RadioError::NONE, RadioError::REQUEST_NOT_SUPPORTED})); |
| 369 | } |
Sarah Chin | 912bdf3 | 2022-01-28 01:02:16 -0800 | [diff] [blame] | 370 | } |
| 371 | |
| 372 | /* |
| 373 | * Test IRadioModem.sendDeviceState() for the response returned. |
| 374 | */ |
| 375 | TEST_P(RadioModemTest, sendDeviceState) { |
Sarah Chin | 912bdf3 | 2022-01-28 01:02:16 -0800 | [diff] [blame] | 376 | serial = GetRandomSerialNumber(); |
| 377 | |
| 378 | radio_modem->sendDeviceState(serial, DeviceStateType::POWER_SAVE_MODE, true); |
| 379 | EXPECT_EQ(std::cv_status::no_timeout, wait()); |
| 380 | EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_modem->rspInfo.type); |
| 381 | EXPECT_EQ(serial, radioRsp_modem->rspInfo.serial); |
| 382 | |
| 383 | std::cout << static_cast<int>(radioRsp_modem->rspInfo.error) << std::endl; |
| 384 | |
| 385 | if (cardStatus.cardState == CardStatus::STATE_ABSENT) { |
| 386 | ASSERT_TRUE(CheckAnyOfErrors(radioRsp_modem->rspInfo.error, |
| 387 | {RadioError::NONE, RadioError::REQUEST_NOT_SUPPORTED})); |
| 388 | } |
Sarah Chin | 912bdf3 | 2022-01-28 01:02:16 -0800 | [diff] [blame] | 389 | } |