Thomas Nguyen | 7ea5df6 | 2022-11-28 16:41:46 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2022 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> |
| 18 | #include <android-base/logging.h> |
| 19 | #include <android/binder_manager.h> |
| 20 | |
| 21 | #include "radio_satellite_utils.h" |
| 22 | |
| 23 | #define ASSERT_OK(ret) ASSERT_TRUE(((ret).isOk())) |
| 24 | |
| 25 | void RadioSatelliteTest::SetUp() { |
| 26 | std::string serviceName = GetParam(); |
| 27 | |
| 28 | if (!isServiceValidForDeviceConfiguration(serviceName)) { |
| 29 | ALOGI("Skipped the radio satellite tests due to device configuration."); |
| 30 | GTEST_SKIP(); |
| 31 | } |
| 32 | |
| 33 | satellite = IRadioSatellite::fromBinder( |
| 34 | ndk::SpAIBinder(AServiceManager_waitForService(GetParam().c_str()))); |
| 35 | ASSERT_NE(nullptr, satellite.get()); |
| 36 | |
| 37 | rsp_satellite = ndk::SharedRefBase::make<RadioSatelliteResponse>(*this); |
| 38 | ASSERT_NE(nullptr, rsp_satellite.get()); |
| 39 | |
| 40 | count_ = 0; |
| 41 | |
| 42 | ind_satellite = ndk::SharedRefBase::make<RadioSatelliteIndication>(*this); |
| 43 | ASSERT_NE(nullptr, ind_satellite.get()); |
| 44 | |
| 45 | satellite->setResponseFunctions(rsp_satellite, ind_satellite); |
| 46 | |
| 47 | // Assert IRadioConfig exists before testing |
| 48 | radio_config = config::IRadioConfig::fromBinder(ndk::SpAIBinder( |
| 49 | AServiceManager_waitForService("android.hardware.radio.config.IRadioConfig/default"))); |
| 50 | ASSERT_NE(nullptr, radio_config.get()); |
| 51 | } |
| 52 | |
| 53 | /* |
| 54 | * Test IRadioSatellite.getCapabilities() for the response returned. |
| 55 | */ |
| 56 | TEST_P(RadioSatelliteTest, getCapabilities) { |
| 57 | if (!deviceSupportsFeature(FEATURE_TELEPHONY_SATELLITE)) { |
| 58 | ALOGI("Skipping getCapabilities because satellite is not supported in device"); |
| 59 | return; |
| 60 | } else { |
| 61 | ALOGI("Running getCapabilities because satellite is supported in device"); |
| 62 | } |
| 63 | |
| 64 | serial = GetRandomSerialNumber(); |
| 65 | ndk::ScopedAStatus res = satellite->getCapabilities(serial); |
| 66 | ASSERT_OK(res); |
| 67 | EXPECT_EQ(std::cv_status::no_timeout, wait()); |
| 68 | EXPECT_EQ(RadioResponseType::SOLICITED, rsp_satellite->rspInfo.type); |
| 69 | EXPECT_EQ(serial, rsp_satellite->rspInfo.serial); |
| 70 | |
| 71 | ALOGI("getCapabilities, rspInfo.error = %s\n", toString(rsp_satellite->rspInfo.error).c_str()); |
| 72 | |
| 73 | ASSERT_TRUE(CheckAnyOfErrors( |
| 74 | rsp_satellite->rspInfo.error, |
| 75 | {RadioError::NONE, RadioError::INTERNAL_ERR, RadioError::INVALID_ARGUMENTS, |
| 76 | RadioError::INVALID_MODEM_STATE, RadioError::INVALID_SIM_STATE, |
| 77 | RadioError::INVALID_STATE, RadioError::MODEM_ERR, RadioError::NO_MEMORY, |
| 78 | RadioError::NO_RESOURCES, RadioError::RADIO_NOT_AVAILABLE, |
| 79 | RadioError::REQUEST_NOT_SUPPORTED, RadioError::REQUEST_RATE_LIMITED, |
| 80 | RadioError::SYSTEM_ERR})); |
| 81 | } |
| 82 | |
| 83 | /* |
| 84 | * Test IRadioSatellite.setPower() for the response returned. |
| 85 | */ |
| 86 | TEST_P(RadioSatelliteTest, setPower) { |
| 87 | if (!deviceSupportsFeature(FEATURE_TELEPHONY_SATELLITE)) { |
| 88 | ALOGI("Skipping setPower because satellite is not supported in device"); |
| 89 | return; |
| 90 | } else { |
| 91 | ALOGI("Running setPower because satellite is supported in device"); |
| 92 | } |
| 93 | |
| 94 | serial = GetRandomSerialNumber(); |
| 95 | ndk::ScopedAStatus res = satellite->setPower(serial, true); |
| 96 | ASSERT_OK(res); |
| 97 | EXPECT_EQ(std::cv_status::no_timeout, wait()); |
| 98 | EXPECT_EQ(RadioResponseType::SOLICITED, rsp_satellite->rspInfo.type); |
| 99 | EXPECT_EQ(serial, rsp_satellite->rspInfo.serial); |
| 100 | |
| 101 | ALOGI("setPower, rspInfo.error = %s\n", toString(rsp_satellite->rspInfo.error).c_str()); |
| 102 | |
| 103 | ASSERT_TRUE(CheckAnyOfErrors( |
| 104 | rsp_satellite->rspInfo.error, |
| 105 | {RadioError::NONE, RadioError::INTERNAL_ERR, RadioError::INVALID_ARGUMENTS, |
| 106 | RadioError::INVALID_MODEM_STATE, RadioError::INVALID_SIM_STATE, |
| 107 | RadioError::INVALID_STATE, RadioError::MODEM_ERR, RadioError::NO_MEMORY, |
| 108 | RadioError::NO_RESOURCES, RadioError::RADIO_NOT_AVAILABLE, |
| 109 | RadioError::REQUEST_NOT_SUPPORTED, RadioError::REQUEST_RATE_LIMITED, |
| 110 | RadioError::SYSTEM_ERR})); |
| 111 | } |
| 112 | |
| 113 | /* |
| 114 | * Test IRadioSatellite.getPowerSate() for the response returned. |
| 115 | */ |
| 116 | TEST_P(RadioSatelliteTest, getPowerSate) { |
| 117 | if (!deviceSupportsFeature(FEATURE_TELEPHONY_SATELLITE)) { |
| 118 | ALOGI("Skipping getPowerSate because satellite is not supported in device"); |
| 119 | return; |
| 120 | } else { |
| 121 | ALOGI("Running getPowerSate because satellite is supported in device"); |
| 122 | } |
| 123 | |
| 124 | serial = GetRandomSerialNumber(); |
| 125 | ndk::ScopedAStatus res = satellite->getPowerState(serial); |
| 126 | ASSERT_OK(res); |
| 127 | EXPECT_EQ(std::cv_status::no_timeout, wait()); |
| 128 | EXPECT_EQ(RadioResponseType::SOLICITED, rsp_satellite->rspInfo.type); |
| 129 | EXPECT_EQ(serial, rsp_satellite->rspInfo.serial); |
| 130 | |
| 131 | ALOGI("getPowerSate, rspInfo.error = %s\n", toString(rsp_satellite->rspInfo.error).c_str()); |
| 132 | |
| 133 | ASSERT_TRUE(CheckAnyOfErrors( |
| 134 | rsp_satellite->rspInfo.error, |
| 135 | {RadioError::NONE, RadioError::INTERNAL_ERR, RadioError::INVALID_ARGUMENTS, |
| 136 | RadioError::INVALID_MODEM_STATE, RadioError::INVALID_SIM_STATE, |
| 137 | RadioError::INVALID_STATE, RadioError::MODEM_ERR, RadioError::NO_MEMORY, |
| 138 | RadioError::NO_RESOURCES, RadioError::RADIO_NOT_AVAILABLE, |
| 139 | RadioError::REQUEST_NOT_SUPPORTED, RadioError::REQUEST_RATE_LIMITED, |
| 140 | RadioError::SYSTEM_ERR})); |
| 141 | } |
| 142 | |
| 143 | /* |
| 144 | * Test IRadioSatellite.provisionService() for the response returned. |
| 145 | */ |
| 146 | TEST_P(RadioSatelliteTest, provisionService) { |
| 147 | if (!deviceSupportsFeature(FEATURE_TELEPHONY_SATELLITE)) { |
| 148 | ALOGI("Skipping provisionService because satellite is not supported in device"); |
| 149 | return; |
| 150 | } else { |
| 151 | ALOGI("Running provisionService because satellite is supported in device"); |
| 152 | } |
| 153 | |
| 154 | serial = GetRandomSerialNumber(); |
| 155 | std::string imei = "imei"; |
| 156 | std::string msisdn = "msisdn"; |
| 157 | std::string imsi = "imsi"; |
| 158 | const std::vector<SatelliteFeature> features{ |
| 159 | SatelliteFeature::SOS_SMS, SatelliteFeature::EMERGENCY_SMS, SatelliteFeature::SMS}; |
| 160 | ndk::ScopedAStatus res = satellite->provisionService(serial, imei, msisdn, imsi, features); |
| 161 | ASSERT_OK(res); |
| 162 | EXPECT_EQ(std::cv_status::no_timeout, wait()); |
| 163 | EXPECT_EQ(RadioResponseType::SOLICITED, rsp_satellite->rspInfo.type); |
| 164 | EXPECT_EQ(serial, rsp_satellite->rspInfo.serial); |
| 165 | |
| 166 | ALOGI("provisionService, rspInfo.error = %s\n", toString(rsp_satellite->rspInfo.error).c_str()); |
| 167 | |
| 168 | ASSERT_TRUE(CheckAnyOfErrors(rsp_satellite->rspInfo.error, |
| 169 | {RadioError::NONE, |
| 170 | RadioError::ABORTED, |
| 171 | RadioError::ACCESS_BARRED, |
| 172 | RadioError::CANCELLED, |
| 173 | RadioError::FEATURE_NOT_SUPPORTED, |
| 174 | RadioError::INTERNAL_ERR, |
| 175 | RadioError::INVALID_ARGUMENTS, |
| 176 | RadioError::INVALID_MODEM_STATE, |
| 177 | RadioError::INVALID_SIM_STATE, |
| 178 | RadioError::INVALID_STATE, |
| 179 | RadioError::MODEM_ERR, |
| 180 | RadioError::MODEM_INCOMPATIBLE, |
| 181 | RadioError::NETWORK_ERR, |
| 182 | RadioError::NETWORK_NOT_READY, |
| 183 | RadioError::NETWORK_REJECT, |
| 184 | RadioError::NETWORK_TIMEOUT, |
| 185 | RadioError::NO_MEMORY, |
| 186 | RadioError::NO_NETWORK_FOUND, |
| 187 | RadioError::NO_RESOURCES, |
| 188 | RadioError::NO_SATELLITE_SIGNAL, |
| 189 | RadioError::NO_SUBSCRIPTION, |
| 190 | RadioError::OPERATION_NOT_ALLOWED, |
| 191 | RadioError::RADIO_NOT_AVAILABLE, |
| 192 | RadioError::RADIO_TECHNOLOGY_NOT_SUPPORTED, |
| 193 | RadioError::REQUEST_NOT_SUPPORTED, |
| 194 | RadioError::REQUEST_RATE_LIMITED, |
| 195 | RadioError::SIM_ABSENT, |
| 196 | RadioError::SIM_BUSY, |
| 197 | RadioError::SIM_ERR, |
| 198 | RadioError::SIM_FULL, |
| 199 | RadioError::SUBSCRIBER_NOT_AUTHORIZED, |
| 200 | RadioError::SYSTEM_ERR})); |
| 201 | } |
| 202 | |
| 203 | /* |
| 204 | * Test IRadioSatellite.addAllowedSatelliteContacts() for the response returned. |
| 205 | */ |
| 206 | TEST_P(RadioSatelliteTest, addAllowedSatelliteContacts) { |
| 207 | if (!deviceSupportsFeature(FEATURE_TELEPHONY_SATELLITE)) { |
| 208 | ALOGI("Skipping addAllowedSatelliteContacts because satellite is not supported in device"); |
| 209 | return; |
| 210 | } else { |
| 211 | ALOGI("Running addAllowedSatelliteContacts because satellite is supported in device"); |
| 212 | } |
| 213 | |
| 214 | serial = GetRandomSerialNumber(); |
| 215 | const std::vector<std::string> contacts = {"contact 1", "contact 2"}; |
| 216 | ndk::ScopedAStatus res = satellite->addAllowedSatelliteContacts(serial, contacts); |
| 217 | ASSERT_OK(res); |
| 218 | EXPECT_EQ(std::cv_status::no_timeout, wait()); |
| 219 | EXPECT_EQ(RadioResponseType::SOLICITED, rsp_satellite->rspInfo.type); |
| 220 | EXPECT_EQ(serial, rsp_satellite->rspInfo.serial); |
| 221 | |
| 222 | ALOGI("addAllowedSatelliteContacts, rspInfo.error = %s\n", |
| 223 | toString(rsp_satellite->rspInfo.error).c_str()); |
| 224 | |
| 225 | ASSERT_TRUE(CheckAnyOfErrors(rsp_satellite->rspInfo.error, |
| 226 | {RadioError::NONE, |
| 227 | RadioError::ABORTED, |
| 228 | RadioError::ACCESS_BARRED, |
| 229 | RadioError::CANCELLED, |
| 230 | RadioError::INTERNAL_ERR, |
| 231 | RadioError::INVALID_ARGUMENTS, |
| 232 | RadioError::INVALID_CONTACT, |
| 233 | RadioError::INVALID_MODEM_STATE, |
| 234 | RadioError::INVALID_SIM_STATE, |
| 235 | RadioError::INVALID_STATE, |
| 236 | RadioError::MODEM_ERR, |
| 237 | RadioError::NETWORK_ERR, |
| 238 | RadioError::NETWORK_NOT_READY, |
| 239 | RadioError::NETWORK_REJECT, |
| 240 | RadioError::NETWORK_TIMEOUT, |
| 241 | RadioError::NO_MEMORY, |
| 242 | RadioError::NO_NETWORK_FOUND, |
| 243 | RadioError::NO_RESOURCES, |
| 244 | RadioError::NO_SATELLITE_SIGNAL, |
| 245 | RadioError::NO_SUBSCRIPTION, |
| 246 | RadioError::NOT_SUFFICIENT_ACCOUNT_BALANCE, |
| 247 | RadioError::OPERATION_NOT_ALLOWED, |
| 248 | RadioError::RADIO_NOT_AVAILABLE, |
| 249 | RadioError::REQUEST_NOT_SUPPORTED, |
| 250 | RadioError::REQUEST_RATE_LIMITED, |
| 251 | RadioError::SIM_ABSENT, |
| 252 | RadioError::SIM_BUSY, |
| 253 | RadioError::SIM_ERR, |
| 254 | RadioError::SIM_FULL, |
| 255 | RadioError::SYSTEM_ERR, |
| 256 | RadioError::UNIDENTIFIED_SUBSCRIBER})); |
| 257 | } |
| 258 | |
| 259 | /* |
| 260 | * Test IRadioSatellite.removeAllowedSatelliteContacts() for the response returned. |
| 261 | */ |
| 262 | TEST_P(RadioSatelliteTest, removeAllowedSatelliteContacts) { |
| 263 | if (!deviceSupportsFeature(FEATURE_TELEPHONY_SATELLITE)) { |
| 264 | ALOGI("Skipping removeAllowedSatelliteContacts because satellite is not supported in " |
| 265 | "device"); |
| 266 | return; |
| 267 | } else { |
| 268 | ALOGI("Running removeAllowedSatelliteContacts because satellite is supported in device"); |
| 269 | } |
| 270 | |
| 271 | serial = GetRandomSerialNumber(); |
| 272 | const std::vector<std::string> contacts = {"contact 1", "contact 2"}; |
| 273 | ndk::ScopedAStatus res = satellite->removeAllowedSatelliteContacts(serial, contacts); |
| 274 | ASSERT_OK(res); |
| 275 | EXPECT_EQ(std::cv_status::no_timeout, wait()); |
| 276 | EXPECT_EQ(RadioResponseType::SOLICITED, rsp_satellite->rspInfo.type); |
| 277 | EXPECT_EQ(serial, rsp_satellite->rspInfo.serial); |
| 278 | |
| 279 | ALOGI("removeAllowedSatelliteContacts, rspInfo.error = %s\n", |
| 280 | toString(rsp_satellite->rspInfo.error).c_str()); |
| 281 | |
| 282 | ASSERT_TRUE(CheckAnyOfErrors(rsp_satellite->rspInfo.error, |
| 283 | {RadioError::NONE, |
| 284 | RadioError::ABORTED, |
| 285 | RadioError::ACCESS_BARRED, |
| 286 | RadioError::CANCELLED, |
| 287 | RadioError::INTERNAL_ERR, |
| 288 | RadioError::INVALID_ARGUMENTS, |
| 289 | RadioError::INVALID_CONTACT, |
| 290 | RadioError::INVALID_MODEM_STATE, |
| 291 | RadioError::INVALID_SIM_STATE, |
| 292 | RadioError::INVALID_STATE, |
| 293 | RadioError::MODEM_ERR, |
| 294 | RadioError::NETWORK_ERR, |
| 295 | RadioError::NETWORK_NOT_READY, |
| 296 | RadioError::NETWORK_REJECT, |
| 297 | RadioError::NETWORK_TIMEOUT, |
| 298 | RadioError::NO_MEMORY, |
| 299 | RadioError::NO_NETWORK_FOUND, |
| 300 | RadioError::NO_RESOURCES, |
| 301 | RadioError::NO_SATELLITE_SIGNAL, |
| 302 | RadioError::NO_SUBSCRIPTION, |
| 303 | RadioError::NOT_SUFFICIENT_ACCOUNT_BALANCE, |
| 304 | RadioError::OPERATION_NOT_ALLOWED, |
| 305 | RadioError::RADIO_NOT_AVAILABLE, |
| 306 | RadioError::REQUEST_NOT_SUPPORTED, |
| 307 | RadioError::REQUEST_RATE_LIMITED, |
| 308 | RadioError::SIM_ABSENT, |
| 309 | RadioError::SIM_BUSY, |
| 310 | RadioError::SIM_ERR, |
| 311 | RadioError::SIM_FULL, |
| 312 | RadioError::SYSTEM_ERR, |
| 313 | RadioError::UNIDENTIFIED_SUBSCRIBER})); |
| 314 | } |
| 315 | |
| 316 | /* |
| 317 | * Test IRadioSatellite.sendMessages() for the response returned. |
| 318 | */ |
| 319 | TEST_P(RadioSatelliteTest, sendMessages) { |
| 320 | if (!deviceSupportsFeature(FEATURE_TELEPHONY_SATELLITE)) { |
| 321 | ALOGI("Skipping sendMessages because satellite is not supported in device"); |
| 322 | return; |
| 323 | } else { |
| 324 | ALOGI("Running sendMessages because satellite is supported in device"); |
| 325 | } |
| 326 | |
| 327 | serial = GetRandomSerialNumber(); |
| 328 | const std::vector<std::string> messages = {"message 1", "message 2"}; |
| 329 | std::string destination = "0123456789"; |
| 330 | ndk::ScopedAStatus res = satellite->sendMessages(serial, messages, destination, 1.0, 2.0); |
| 331 | ASSERT_OK(res); |
| 332 | EXPECT_EQ(std::cv_status::no_timeout, wait()); |
| 333 | EXPECT_EQ(RadioResponseType::SOLICITED, rsp_satellite->rspInfo.type); |
| 334 | EXPECT_EQ(serial, rsp_satellite->rspInfo.serial); |
| 335 | |
| 336 | ALOGI("sendMessages, rspInfo.error = %s\n", toString(rsp_satellite->rspInfo.error).c_str()); |
| 337 | |
| 338 | ASSERT_TRUE(CheckAnyOfErrors(rsp_satellite->rspInfo.error, |
| 339 | {RadioError::NONE, |
| 340 | RadioError::ABORTED, |
| 341 | RadioError::ACCESS_BARRED, |
| 342 | RadioError::BLOCKED_DUE_TO_CALL, |
| 343 | RadioError::CANCELLED, |
| 344 | RadioError::ENCODING_ERR, |
| 345 | RadioError::ENCODING_NOT_SUPPORTED, |
| 346 | RadioError::INTERNAL_ERR, |
| 347 | RadioError::INVALID_ARGUMENTS, |
| 348 | RadioError::INVALID_MODEM_STATE, |
| 349 | RadioError::INVALID_SIM_STATE, |
| 350 | RadioError::INVALID_SMS_FORMAT, |
| 351 | RadioError::INVALID_STATE, |
| 352 | RadioError::MODEM_ERR, |
| 353 | RadioError::NETWORK_ERR, |
| 354 | RadioError::NETWORK_NOT_READY, |
| 355 | RadioError::NETWORK_REJECT, |
| 356 | RadioError::NETWORK_TIMEOUT, |
| 357 | RadioError::NO_MEMORY, |
| 358 | RadioError::NO_NETWORK_FOUND, |
| 359 | RadioError::NO_RESOURCES, |
| 360 | RadioError::NO_SMS_TO_ACK, |
| 361 | RadioError::NO_SATELLITE_SIGNAL, |
| 362 | RadioError::NO_SUBSCRIPTION, |
| 363 | RadioError::NOT_SUFFICIENT_ACCOUNT_BALANCE, |
| 364 | RadioError::OPERATION_NOT_ALLOWED, |
| 365 | RadioError::RADIO_NOT_AVAILABLE, |
| 366 | RadioError::REQUEST_NOT_SUPPORTED, |
| 367 | RadioError::REQUEST_RATE_LIMITED, |
| 368 | RadioError::SIM_ABSENT, |
| 369 | RadioError::SIM_BUSY, |
| 370 | RadioError::SIM_ERR, |
| 371 | RadioError::SIM_FULL, |
| 372 | RadioError::SIMULTANEOUS_SMS_AND_CALL_NOT_ALLOWED, |
| 373 | RadioError::SMS_SEND_FAIL_RETRY, |
| 374 | RadioError::SYSTEM_ERR, |
| 375 | RadioError::SWITCHED_FROM_SATELLITE_TO_TERRESTRIAL, |
| 376 | RadioError::UNIDENTIFIED_SUBSCRIBER})); |
| 377 | } |
| 378 | |
| 379 | /* |
| 380 | * Test IRadioSatellite.getPendingMessages() for the response returned. |
| 381 | */ |
| 382 | TEST_P(RadioSatelliteTest, getPendingMessages) { |
| 383 | if (!deviceSupportsFeature(FEATURE_TELEPHONY_SATELLITE)) { |
| 384 | ALOGI("Skipping getPendingMessages because satellite is not supported in device"); |
| 385 | return; |
| 386 | } else { |
| 387 | ALOGI("Running getPendingMessages because satellite is supported in device"); |
| 388 | } |
| 389 | |
| 390 | serial = GetRandomSerialNumber(); |
| 391 | ndk::ScopedAStatus res = satellite->getPendingMessages(serial); |
| 392 | ASSERT_OK(res); |
| 393 | EXPECT_EQ(std::cv_status::no_timeout, wait()); |
| 394 | EXPECT_EQ(RadioResponseType::SOLICITED, rsp_satellite->rspInfo.type); |
| 395 | EXPECT_EQ(serial, rsp_satellite->rspInfo.serial); |
| 396 | |
| 397 | ALOGI("getPendingMessages, rspInfo.error = %s\n", |
| 398 | toString(rsp_satellite->rspInfo.error).c_str()); |
| 399 | |
| 400 | ASSERT_TRUE(CheckAnyOfErrors(rsp_satellite->rspInfo.error, |
| 401 | {RadioError::NONE, |
| 402 | RadioError::ABORTED, |
| 403 | RadioError::ACCESS_BARRED, |
| 404 | RadioError::BLOCKED_DUE_TO_CALL, |
| 405 | RadioError::CANCELLED, |
| 406 | RadioError::ENCODING_ERR, |
| 407 | RadioError::ENCODING_NOT_SUPPORTED, |
| 408 | RadioError::INTERNAL_ERR, |
| 409 | RadioError::INVALID_ARGUMENTS, |
| 410 | RadioError::INVALID_MODEM_STATE, |
| 411 | RadioError::INVALID_SIM_STATE, |
| 412 | RadioError::INVALID_SMS_FORMAT, |
| 413 | RadioError::INVALID_STATE, |
| 414 | RadioError::MODEM_ERR, |
| 415 | RadioError::NETWORK_ERR, |
| 416 | RadioError::NETWORK_NOT_READY, |
| 417 | RadioError::NETWORK_REJECT, |
| 418 | RadioError::NETWORK_TIMEOUT, |
| 419 | RadioError::NO_MEMORY, |
| 420 | RadioError::NO_NETWORK_FOUND, |
| 421 | RadioError::NO_RESOURCES, |
| 422 | RadioError::NO_SMS_TO_ACK, |
| 423 | RadioError::NO_SATELLITE_SIGNAL, |
| 424 | RadioError::NO_SUBSCRIPTION, |
| 425 | RadioError::NOT_SUFFICIENT_ACCOUNT_BALANCE, |
| 426 | RadioError::OPERATION_NOT_ALLOWED, |
| 427 | RadioError::RADIO_NOT_AVAILABLE, |
| 428 | RadioError::REQUEST_NOT_SUPPORTED, |
| 429 | RadioError::REQUEST_RATE_LIMITED, |
| 430 | RadioError::SIM_ABSENT, |
| 431 | RadioError::SIM_BUSY, |
| 432 | RadioError::SIM_ERR, |
| 433 | RadioError::SIM_FULL, |
| 434 | RadioError::SIMULTANEOUS_SMS_AND_CALL_NOT_ALLOWED, |
| 435 | RadioError::SYSTEM_ERR, |
| 436 | RadioError::SWITCHED_FROM_SATELLITE_TO_TERRESTRIAL})); |
| 437 | } |
| 438 | |
| 439 | /* |
| 440 | * Test IRadioSatellite.getSatelliteMode() for the response returned. |
| 441 | */ |
| 442 | TEST_P(RadioSatelliteTest, getSatelliteMode) { |
| 443 | if (!deviceSupportsFeature(FEATURE_TELEPHONY_SATELLITE)) { |
| 444 | ALOGI("Skipping getSatelliteMode because satellite is not supported in device"); |
| 445 | return; |
| 446 | } else { |
| 447 | ALOGI("Running getSatelliteMode because satellite is supported in device"); |
| 448 | } |
| 449 | |
| 450 | serial = GetRandomSerialNumber(); |
| 451 | ndk::ScopedAStatus res = satellite->getSatelliteMode(serial); |
| 452 | ASSERT_OK(res); |
| 453 | EXPECT_EQ(std::cv_status::no_timeout, wait()); |
| 454 | EXPECT_EQ(RadioResponseType::SOLICITED, rsp_satellite->rspInfo.type); |
| 455 | EXPECT_EQ(serial, rsp_satellite->rspInfo.serial); |
| 456 | |
| 457 | ALOGI("getSatelliteMode, rspInfo.error = %s\n", toString(rsp_satellite->rspInfo.error).c_str()); |
| 458 | |
| 459 | ASSERT_TRUE(CheckAnyOfErrors( |
| 460 | rsp_satellite->rspInfo.error, |
| 461 | {RadioError::NONE, RadioError::INTERNAL_ERR, RadioError::INVALID_ARGUMENTS, |
| 462 | RadioError::INVALID_MODEM_STATE, RadioError::INVALID_SIM_STATE, |
| 463 | RadioError::INVALID_STATE, RadioError::MODEM_ERR, RadioError::NO_MEMORY, |
| 464 | RadioError::NO_RESOURCES, RadioError::RADIO_NOT_AVAILABLE, |
| 465 | RadioError::REQUEST_NOT_SUPPORTED, RadioError::REQUEST_RATE_LIMITED, |
| 466 | RadioError::SYSTEM_ERR})); |
| 467 | } |
| 468 | |
| 469 | /* |
| 470 | * Test IRadioSatellite.setIndicationFilter() for the response returned. |
| 471 | */ |
| 472 | TEST_P(RadioSatelliteTest, setIndicationFilter) { |
| 473 | if (!deviceSupportsFeature(FEATURE_TELEPHONY_SATELLITE)) { |
| 474 | ALOGI("Skipping setIndicationFilter because satellite is not supported in device"); |
| 475 | return; |
| 476 | } else { |
| 477 | ALOGI("Running setIndicationFilter because satellite is supported in device"); |
| 478 | } |
| 479 | |
| 480 | serial = GetRandomSerialNumber(); |
| 481 | ndk::ScopedAStatus res = satellite->setIndicationFilter(serial, 0); |
| 482 | ASSERT_OK(res); |
| 483 | EXPECT_EQ(std::cv_status::no_timeout, wait()); |
| 484 | EXPECT_EQ(RadioResponseType::SOLICITED, rsp_satellite->rspInfo.type); |
| 485 | EXPECT_EQ(serial, rsp_satellite->rspInfo.serial); |
| 486 | |
| 487 | ALOGI("setIndicationFilter, rspInfo.error = %s\n", |
| 488 | toString(rsp_satellite->rspInfo.error).c_str()); |
| 489 | |
| 490 | ASSERT_TRUE(CheckAnyOfErrors( |
| 491 | rsp_satellite->rspInfo.error, |
| 492 | {RadioError::NONE, RadioError::INTERNAL_ERR, RadioError::INVALID_ARGUMENTS, |
| 493 | RadioError::INVALID_MODEM_STATE, RadioError::INVALID_SIM_STATE, |
| 494 | RadioError::INVALID_STATE, RadioError::MODEM_ERR, RadioError::NO_MEMORY, |
| 495 | RadioError::NO_RESOURCES, RadioError::RADIO_NOT_AVAILABLE, |
| 496 | RadioError::REQUEST_NOT_SUPPORTED, RadioError::REQUEST_RATE_LIMITED, |
| 497 | RadioError::SYSTEM_ERR})); |
| 498 | } |
| 499 | |
| 500 | /* |
| 501 | * Test IRadioSatellite.startSendingSatellitePointingInfo() for the response returned. |
| 502 | */ |
| 503 | TEST_P(RadioSatelliteTest, startSendingSatellitePointingInfo) { |
| 504 | if (!deviceSupportsFeature(FEATURE_TELEPHONY_SATELLITE)) { |
| 505 | ALOGI("Skipping startSendingSatellitePointingInfo because satellite is not supported in " |
| 506 | "device"); |
| 507 | return; |
| 508 | } else { |
| 509 | ALOGI("Running startSendingSatellitePointingInfo because satellite is supported in device"); |
| 510 | } |
| 511 | |
| 512 | serial = GetRandomSerialNumber(); |
| 513 | ndk::ScopedAStatus res = satellite->startSendingSatellitePointingInfo(serial); |
| 514 | ASSERT_OK(res); |
| 515 | EXPECT_EQ(std::cv_status::no_timeout, wait()); |
| 516 | EXPECT_EQ(RadioResponseType::SOLICITED, rsp_satellite->rspInfo.type); |
| 517 | EXPECT_EQ(serial, rsp_satellite->rspInfo.serial); |
| 518 | |
| 519 | ALOGI("startSendingSatellitePointingInfo, rspInfo.error = %s\n", |
| 520 | toString(rsp_satellite->rspInfo.error).c_str()); |
| 521 | |
| 522 | ASSERT_TRUE(CheckAnyOfErrors( |
| 523 | rsp_satellite->rspInfo.error, |
| 524 | {RadioError::NONE, RadioError::INTERNAL_ERR, RadioError::INVALID_ARGUMENTS, |
| 525 | RadioError::INVALID_MODEM_STATE, RadioError::INVALID_SIM_STATE, |
| 526 | RadioError::INVALID_STATE, RadioError::MODEM_ERR, RadioError::NO_MEMORY, |
| 527 | RadioError::NO_RESOURCES, RadioError::RADIO_NOT_AVAILABLE, |
| 528 | RadioError::REQUEST_NOT_SUPPORTED, RadioError::REQUEST_RATE_LIMITED, |
| 529 | RadioError::SYSTEM_ERR})); |
| 530 | } |
| 531 | |
| 532 | /* |
| 533 | * Test IRadioSatellite.stopSatelliteLocationUpdate() for the response returned. |
| 534 | */ |
| 535 | TEST_P(RadioSatelliteTest, stopSatelliteLocationUpdate) { |
| 536 | if (!deviceSupportsFeature(FEATURE_TELEPHONY_SATELLITE)) { |
| 537 | ALOGI("Skipping stopSendingSatellitePointingInfo because satellite is not supported in " |
| 538 | "device"); |
| 539 | return; |
| 540 | } else { |
| 541 | ALOGI("Running stopSendingSatellitePointingInfo because satellite is supported in device"); |
| 542 | } |
| 543 | |
| 544 | serial = GetRandomSerialNumber(); |
| 545 | ndk::ScopedAStatus res = satellite->stopSendingSatellitePointingInfo(serial); |
| 546 | ASSERT_OK(res); |
| 547 | EXPECT_EQ(std::cv_status::no_timeout, wait()); |
| 548 | EXPECT_EQ(RadioResponseType::SOLICITED, rsp_satellite->rspInfo.type); |
| 549 | EXPECT_EQ(serial, rsp_satellite->rspInfo.serial); |
| 550 | |
| 551 | ALOGI("stopSendingSatellitePointingInfo, rspInfo.error = %s\n", |
| 552 | toString(rsp_satellite->rspInfo.error).c_str()); |
| 553 | |
| 554 | ASSERT_TRUE(CheckAnyOfErrors( |
| 555 | rsp_satellite->rspInfo.error, |
| 556 | {RadioError::NONE, RadioError::INTERNAL_ERR, RadioError::INVALID_ARGUMENTS, |
| 557 | RadioError::INVALID_MODEM_STATE, RadioError::INVALID_SIM_STATE, |
| 558 | RadioError::INVALID_STATE, RadioError::MODEM_ERR, RadioError::NO_MEMORY, |
| 559 | RadioError::NO_RESOURCES, RadioError::RADIO_NOT_AVAILABLE, |
| 560 | RadioError::REQUEST_NOT_SUPPORTED, RadioError::REQUEST_RATE_LIMITED, |
| 561 | RadioError::SYSTEM_ERR})); |
| 562 | } |
| 563 | |
| 564 | /* |
| 565 | * Test IRadioSatellite.getMaxCharactersPerTextMessage() for the response returned. |
| 566 | */ |
| 567 | TEST_P(RadioSatelliteTest, getMaxCharactersPerTextMessage) { |
| 568 | if (!deviceSupportsFeature(FEATURE_TELEPHONY_SATELLITE)) { |
| 569 | ALOGI("Skipping getMaxCharactersPerTextMessage because satellite is not supported in " |
| 570 | "device"); |
| 571 | return; |
| 572 | } else { |
| 573 | ALOGI("Running getMaxCharactersPerTextMessage because satellite is supported in device"); |
| 574 | } |
| 575 | |
| 576 | serial = GetRandomSerialNumber(); |
| 577 | ndk::ScopedAStatus res = satellite->getMaxCharactersPerTextMessage(serial); |
| 578 | ASSERT_OK(res); |
| 579 | EXPECT_EQ(std::cv_status::no_timeout, wait()); |
| 580 | EXPECT_EQ(RadioResponseType::SOLICITED, rsp_satellite->rspInfo.type); |
| 581 | EXPECT_EQ(serial, rsp_satellite->rspInfo.serial); |
| 582 | |
| 583 | ALOGI("getMaxCharactersPerTextMessage, rspInfo.error = %s\n", |
| 584 | toString(rsp_satellite->rspInfo.error).c_str()); |
| 585 | |
| 586 | ASSERT_TRUE(CheckAnyOfErrors( |
| 587 | rsp_satellite->rspInfo.error, |
| 588 | {RadioError::NONE, RadioError::INTERNAL_ERR, RadioError::INVALID_ARGUMENTS, |
| 589 | RadioError::INVALID_MODEM_STATE, RadioError::INVALID_SIM_STATE, |
| 590 | RadioError::INVALID_STATE, RadioError::MODEM_ERR, RadioError::NO_MEMORY, |
| 591 | RadioError::NO_RESOURCES, RadioError::RADIO_NOT_AVAILABLE, |
| 592 | RadioError::REQUEST_NOT_SUPPORTED, RadioError::REQUEST_RATE_LIMITED, |
| 593 | RadioError::SYSTEM_ERR})); |
| 594 | } |
| 595 | |
| 596 | /* |
| 597 | * Test IRadioSatellite.getTimeForNextSatelliteVisibility() for the response returned. |
| 598 | */ |
| 599 | TEST_P(RadioSatelliteTest, getTimeForNextSatelliteVisibility) { |
| 600 | if (!deviceSupportsFeature(FEATURE_TELEPHONY_SATELLITE)) { |
| 601 | ALOGI("Skipping getTimeForNextSatelliteVisibility because satellite is not supported in " |
| 602 | "device"); |
| 603 | return; |
| 604 | } else { |
| 605 | ALOGI("Running getTimeForNextSatelliteVisibility because satellite is supported in device"); |
| 606 | } |
| 607 | |
| 608 | serial = GetRandomSerialNumber(); |
| 609 | ndk::ScopedAStatus res = satellite->getTimeForNextSatelliteVisibility(serial); |
| 610 | ASSERT_OK(res); |
| 611 | EXPECT_EQ(std::cv_status::no_timeout, wait()); |
| 612 | EXPECT_EQ(RadioResponseType::SOLICITED, rsp_satellite->rspInfo.type); |
| 613 | EXPECT_EQ(serial, rsp_satellite->rspInfo.serial); |
| 614 | |
| 615 | ALOGI("getTimeForNextSatelliteVisibility, rspInfo.error = %s\n", |
| 616 | toString(rsp_satellite->rspInfo.error).c_str()); |
| 617 | |
| 618 | ASSERT_TRUE(CheckAnyOfErrors( |
| 619 | rsp_satellite->rspInfo.error, |
| 620 | {RadioError::NONE, RadioError::INTERNAL_ERR, RadioError::INVALID_ARGUMENTS, |
| 621 | RadioError::INVALID_MODEM_STATE, RadioError::INVALID_SIM_STATE, |
| 622 | RadioError::INVALID_STATE, RadioError::MODEM_ERR, RadioError::NO_MEMORY, |
| 623 | RadioError::NO_RESOURCES, RadioError::RADIO_NOT_AVAILABLE, |
| 624 | RadioError::REQUEST_NOT_SUPPORTED, RadioError::REQUEST_RATE_LIMITED, |
| 625 | RadioError::SYSTEM_ERR})); |
| 626 | } |