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 "radio_sim_utils.h" |
| 18 | |
Sarah Chin | c83bce4 | 2021-12-29 00:35:12 -0800 | [diff] [blame] | 19 | RadioSimResponse::RadioSimResponse(RadioServiceTest& parent) : parent_sim(parent) {} |
Sarah Chin | fc5603b | 2021-12-21 11:34:00 -0800 | [diff] [blame] | 20 | |
| 21 | ndk::ScopedAStatus RadioSimResponse::acknowledgeRequest(int32_t /*serial*/) { |
| 22 | return ndk::ScopedAStatus::ok(); |
| 23 | } |
| 24 | |
| 25 | ndk::ScopedAStatus RadioSimResponse::areUiccApplicationsEnabledResponse( |
Sarah Chin | 912bdf3 | 2022-01-28 01:02:16 -0800 | [diff] [blame] | 26 | const RadioResponseInfo& info, bool enabled) { |
| 27 | rspInfo = info; |
| 28 | areUiccApplicationsEnabled = enabled; |
| 29 | parent_sim.notify(info.serial); |
Sarah Chin | fc5603b | 2021-12-21 11:34:00 -0800 | [diff] [blame] | 30 | return ndk::ScopedAStatus::ok(); |
| 31 | } |
| 32 | |
Sarah Chin | 912bdf3 | 2022-01-28 01:02:16 -0800 | [diff] [blame] | 33 | ndk::ScopedAStatus RadioSimResponse::changeIccPin2ForAppResponse(const RadioResponseInfo& info, |
Sarah Chin | fc5603b | 2021-12-21 11:34:00 -0800 | [diff] [blame] | 34 | int32_t /*remainingRetries*/) { |
Sarah Chin | 912bdf3 | 2022-01-28 01:02:16 -0800 | [diff] [blame] | 35 | rspInfo = info; |
| 36 | parent_sim.notify(info.serial); |
Sarah Chin | fc5603b | 2021-12-21 11:34:00 -0800 | [diff] [blame] | 37 | return ndk::ScopedAStatus::ok(); |
| 38 | } |
| 39 | |
Sarah Chin | 912bdf3 | 2022-01-28 01:02:16 -0800 | [diff] [blame] | 40 | ndk::ScopedAStatus RadioSimResponse::changeIccPinForAppResponse(const RadioResponseInfo& info, |
Sarah Chin | fc5603b | 2021-12-21 11:34:00 -0800 | [diff] [blame] | 41 | int32_t /*remainingRetries*/) { |
Sarah Chin | 912bdf3 | 2022-01-28 01:02:16 -0800 | [diff] [blame] | 42 | rspInfo = info; |
| 43 | parent_sim.notify(info.serial); |
Sarah Chin | fc5603b | 2021-12-21 11:34:00 -0800 | [diff] [blame] | 44 | return ndk::ScopedAStatus::ok(); |
| 45 | } |
| 46 | |
Sarah Chin | 912bdf3 | 2022-01-28 01:02:16 -0800 | [diff] [blame] | 47 | ndk::ScopedAStatus RadioSimResponse::enableUiccApplicationsResponse(const RadioResponseInfo& info) { |
| 48 | rspInfo = info; |
| 49 | parent_sim.notify(info.serial); |
Sarah Chin | fc5603b | 2021-12-21 11:34:00 -0800 | [diff] [blame] | 50 | return ndk::ScopedAStatus::ok(); |
| 51 | } |
| 52 | |
| 53 | ndk::ScopedAStatus RadioSimResponse::getAllowedCarriersResponse( |
Sarah Chin | 912bdf3 | 2022-01-28 01:02:16 -0800 | [diff] [blame] | 54 | const RadioResponseInfo& info, const CarrierRestrictions& carriers, |
| 55 | SimLockMultiSimPolicy multiSimPolicy) { |
| 56 | rspInfo = info; |
| 57 | carrierRestrictionsResp = carriers; |
| 58 | multiSimPolicyResp = multiSimPolicy; |
| 59 | parent_sim.notify(info.serial); |
Sarah Chin | fc5603b | 2021-12-21 11:34:00 -0800 | [diff] [blame] | 60 | return ndk::ScopedAStatus::ok(); |
| 61 | } |
| 62 | |
| 63 | ndk::ScopedAStatus RadioSimResponse::getCdmaSubscriptionResponse( |
Sarah Chin | 912bdf3 | 2022-01-28 01:02:16 -0800 | [diff] [blame] | 64 | const RadioResponseInfo& info, const std::string& /*mdn*/, const std::string& /*hSid*/, |
Sarah Chin | fc5603b | 2021-12-21 11:34:00 -0800 | [diff] [blame] | 65 | const std::string& /*hNid*/, const std::string& /*min*/, const std::string& /*prl*/) { |
Sarah Chin | 912bdf3 | 2022-01-28 01:02:16 -0800 | [diff] [blame] | 66 | rspInfo = info; |
| 67 | parent_sim.notify(info.serial); |
Sarah Chin | fc5603b | 2021-12-21 11:34:00 -0800 | [diff] [blame] | 68 | return ndk::ScopedAStatus::ok(); |
| 69 | } |
| 70 | |
| 71 | ndk::ScopedAStatus RadioSimResponse::getCdmaSubscriptionSourceResponse( |
Sarah Chin | 912bdf3 | 2022-01-28 01:02:16 -0800 | [diff] [blame] | 72 | const RadioResponseInfo& info, CdmaSubscriptionSource /*source*/) { |
| 73 | rspInfo = info; |
| 74 | parent_sim.notify(info.serial); |
Sarah Chin | fc5603b | 2021-12-21 11:34:00 -0800 | [diff] [blame] | 75 | return ndk::ScopedAStatus::ok(); |
| 76 | } |
| 77 | |
Sarah Chin | 912bdf3 | 2022-01-28 01:02:16 -0800 | [diff] [blame] | 78 | ndk::ScopedAStatus RadioSimResponse::getFacilityLockForAppResponse(const RadioResponseInfo& info, |
| 79 | int32_t /*response*/) { |
| 80 | rspInfo = info; |
| 81 | parent_sim.notify(info.serial); |
Sarah Chin | fc5603b | 2021-12-21 11:34:00 -0800 | [diff] [blame] | 82 | return ndk::ScopedAStatus::ok(); |
| 83 | } |
| 84 | |
| 85 | ndk::ScopedAStatus RadioSimResponse::getIccCardStatusResponse(const RadioResponseInfo& info, |
| 86 | const CardStatus& card_status) { |
| 87 | rspInfo = info; |
| 88 | cardStatus = card_status; |
| 89 | parent_sim.notify(info.serial); |
| 90 | return ndk::ScopedAStatus::ok(); |
| 91 | } |
| 92 | |
Sarah Chin | 912bdf3 | 2022-01-28 01:02:16 -0800 | [diff] [blame] | 93 | ndk::ScopedAStatus RadioSimResponse::getImsiForAppResponse(const RadioResponseInfo& info, |
| 94 | const std::string& imsi_str) { |
| 95 | rspInfo = info; |
| 96 | imsi = imsi_str; |
| 97 | parent_sim.notify(info.serial); |
Sarah Chin | fc5603b | 2021-12-21 11:34:00 -0800 | [diff] [blame] | 98 | return ndk::ScopedAStatus::ok(); |
| 99 | } |
| 100 | |
| 101 | ndk::ScopedAStatus RadioSimResponse::getSimPhonebookCapacityResponse( |
| 102 | const RadioResponseInfo& info, const PhonebookCapacity& pbCapacity) { |
| 103 | rspInfo = info; |
| 104 | capacity = pbCapacity; |
| 105 | parent_sim.notify(info.serial); |
| 106 | return ndk::ScopedAStatus::ok(); |
| 107 | } |
| 108 | |
| 109 | ndk::ScopedAStatus RadioSimResponse::getSimPhonebookRecordsResponse(const RadioResponseInfo& info) { |
| 110 | rspInfo = info; |
| 111 | parent_sim.notify(info.serial); |
| 112 | return ndk::ScopedAStatus::ok(); |
| 113 | } |
| 114 | |
Sarah Chin | 912bdf3 | 2022-01-28 01:02:16 -0800 | [diff] [blame] | 115 | ndk::ScopedAStatus RadioSimResponse::iccCloseLogicalChannelResponse(const RadioResponseInfo& info) { |
| 116 | rspInfo = info; |
| 117 | parent_sim.notify(info.serial); |
Sarah Chin | fc5603b | 2021-12-21 11:34:00 -0800 | [diff] [blame] | 118 | return ndk::ScopedAStatus::ok(); |
| 119 | } |
| 120 | |
Muralidhar Reddy | c13d0d6 | 2023-01-18 18:45:14 +0000 | [diff] [blame] | 121 | ndk::ScopedAStatus RadioSimResponse::iccCloseLogicalChannelWithSessionInfoResponse( |
| 122 | const RadioResponseInfo& info) { |
| 123 | rspInfo = info; |
| 124 | parent_sim.notify(info.serial); |
| 125 | return ndk::ScopedAStatus::ok(); |
| 126 | } |
| 127 | |
Sarah Chin | 912bdf3 | 2022-01-28 01:02:16 -0800 | [diff] [blame] | 128 | ndk::ScopedAStatus RadioSimResponse::iccIoForAppResponse(const RadioResponseInfo& info, |
Sarah Chin | fc5603b | 2021-12-21 11:34:00 -0800 | [diff] [blame] | 129 | const IccIoResult& /*iccIo*/) { |
Sarah Chin | 912bdf3 | 2022-01-28 01:02:16 -0800 | [diff] [blame] | 130 | rspInfo = info; |
| 131 | parent_sim.notify(info.serial); |
Sarah Chin | fc5603b | 2021-12-21 11:34:00 -0800 | [diff] [blame] | 132 | return ndk::ScopedAStatus::ok(); |
| 133 | } |
| 134 | |
| 135 | ndk::ScopedAStatus RadioSimResponse::iccOpenLogicalChannelResponse( |
Sarah Chin | 912bdf3 | 2022-01-28 01:02:16 -0800 | [diff] [blame] | 136 | const RadioResponseInfo& info, int32_t /*channelId*/, |
Sarah Chin | fc5603b | 2021-12-21 11:34:00 -0800 | [diff] [blame] | 137 | const std::vector<uint8_t>& /*selectResponse*/) { |
Sarah Chin | 912bdf3 | 2022-01-28 01:02:16 -0800 | [diff] [blame] | 138 | rspInfo = info; |
| 139 | parent_sim.notify(info.serial); |
Sarah Chin | fc5603b | 2021-12-21 11:34:00 -0800 | [diff] [blame] | 140 | return ndk::ScopedAStatus::ok(); |
| 141 | } |
| 142 | |
| 143 | ndk::ScopedAStatus RadioSimResponse::iccTransmitApduBasicChannelResponse( |
Sarah Chin | 912bdf3 | 2022-01-28 01:02:16 -0800 | [diff] [blame] | 144 | const RadioResponseInfo& info, const IccIoResult& /*result*/) { |
| 145 | rspInfo = info; |
| 146 | parent_sim.notify(info.serial); |
Sarah Chin | fc5603b | 2021-12-21 11:34:00 -0800 | [diff] [blame] | 147 | return ndk::ScopedAStatus::ok(); |
| 148 | } |
| 149 | |
| 150 | ndk::ScopedAStatus RadioSimResponse::iccTransmitApduLogicalChannelResponse( |
Sarah Chin | 912bdf3 | 2022-01-28 01:02:16 -0800 | [diff] [blame] | 151 | const RadioResponseInfo& info, const IccIoResult& /*result*/) { |
| 152 | rspInfo = info; |
| 153 | parent_sim.notify(info.serial); |
Sarah Chin | fc5603b | 2021-12-21 11:34:00 -0800 | [diff] [blame] | 154 | return ndk::ScopedAStatus::ok(); |
| 155 | } |
| 156 | |
| 157 | ndk::ScopedAStatus RadioSimResponse::reportStkServiceIsRunningResponse( |
Sarah Chin | 912bdf3 | 2022-01-28 01:02:16 -0800 | [diff] [blame] | 158 | const RadioResponseInfo& info) { |
| 159 | rspInfo = info; |
| 160 | parent_sim.notify(info.serial); |
Sarah Chin | fc5603b | 2021-12-21 11:34:00 -0800 | [diff] [blame] | 161 | return ndk::ScopedAStatus::ok(); |
| 162 | } |
| 163 | |
| 164 | ndk::ScopedAStatus RadioSimResponse::requestIccSimAuthenticationResponse( |
Sarah Chin | 912bdf3 | 2022-01-28 01:02:16 -0800 | [diff] [blame] | 165 | const RadioResponseInfo& info, const IccIoResult& /*result*/) { |
| 166 | rspInfo = info; |
| 167 | parent_sim.notify(info.serial); |
Sarah Chin | fc5603b | 2021-12-21 11:34:00 -0800 | [diff] [blame] | 168 | return ndk::ScopedAStatus::ok(); |
| 169 | } |
| 170 | |
Sarah Chin | 912bdf3 | 2022-01-28 01:02:16 -0800 | [diff] [blame] | 171 | ndk::ScopedAStatus RadioSimResponse::sendEnvelopeResponse(const RadioResponseInfo& info, |
Sarah Chin | fc5603b | 2021-12-21 11:34:00 -0800 | [diff] [blame] | 172 | const std::string& /*commandResponse*/) { |
Sarah Chin | 912bdf3 | 2022-01-28 01:02:16 -0800 | [diff] [blame] | 173 | rspInfo = info; |
| 174 | parent_sim.notify(info.serial); |
Sarah Chin | fc5603b | 2021-12-21 11:34:00 -0800 | [diff] [blame] | 175 | return ndk::ScopedAStatus::ok(); |
| 176 | } |
| 177 | |
Sarah Chin | 912bdf3 | 2022-01-28 01:02:16 -0800 | [diff] [blame] | 178 | ndk::ScopedAStatus RadioSimResponse::sendEnvelopeWithStatusResponse(const RadioResponseInfo& info, |
| 179 | const IccIoResult& /*iccIo*/) { |
| 180 | rspInfo = info; |
| 181 | parent_sim.notify(info.serial); |
Sarah Chin | fc5603b | 2021-12-21 11:34:00 -0800 | [diff] [blame] | 182 | return ndk::ScopedAStatus::ok(); |
| 183 | } |
| 184 | |
| 185 | ndk::ScopedAStatus RadioSimResponse::sendTerminalResponseToSimResponse( |
Sarah Chin | 912bdf3 | 2022-01-28 01:02:16 -0800 | [diff] [blame] | 186 | const RadioResponseInfo& info) { |
| 187 | rspInfo = info; |
| 188 | parent_sim.notify(info.serial); |
Sarah Chin | fc5603b | 2021-12-21 11:34:00 -0800 | [diff] [blame] | 189 | return ndk::ScopedAStatus::ok(); |
| 190 | } |
| 191 | |
Sarah Chin | 912bdf3 | 2022-01-28 01:02:16 -0800 | [diff] [blame] | 192 | ndk::ScopedAStatus RadioSimResponse::setAllowedCarriersResponse(const RadioResponseInfo& info) { |
| 193 | rspInfo = info; |
| 194 | parent_sim.notify(info.serial); |
Sarah Chin | fc5603b | 2021-12-21 11:34:00 -0800 | [diff] [blame] | 195 | return ndk::ScopedAStatus::ok(); |
| 196 | } |
| 197 | |
| 198 | ndk::ScopedAStatus RadioSimResponse::setCarrierInfoForImsiEncryptionResponse( |
| 199 | const RadioResponseInfo& info) { |
| 200 | rspInfo = info; |
| 201 | parent_sim.notify(info.serial); |
| 202 | return ndk::ScopedAStatus::ok(); |
| 203 | } |
| 204 | |
| 205 | ndk::ScopedAStatus RadioSimResponse::setCdmaSubscriptionSourceResponse( |
Sarah Chin | 912bdf3 | 2022-01-28 01:02:16 -0800 | [diff] [blame] | 206 | const RadioResponseInfo& info) { |
| 207 | rspInfo = info; |
| 208 | parent_sim.notify(info.serial); |
Sarah Chin | fc5603b | 2021-12-21 11:34:00 -0800 | [diff] [blame] | 209 | return ndk::ScopedAStatus::ok(); |
| 210 | } |
| 211 | |
Sarah Chin | 912bdf3 | 2022-01-28 01:02:16 -0800 | [diff] [blame] | 212 | ndk::ScopedAStatus RadioSimResponse::setFacilityLockForAppResponse(const RadioResponseInfo& info, |
| 213 | int32_t /*retry*/) { |
| 214 | rspInfo = info; |
| 215 | parent_sim.notify(info.serial); |
Sarah Chin | fc5603b | 2021-12-21 11:34:00 -0800 | [diff] [blame] | 216 | return ndk::ScopedAStatus::ok(); |
| 217 | } |
| 218 | |
| 219 | ndk::ScopedAStatus RadioSimResponse::setSimCardPowerResponse(const RadioResponseInfo& info) { |
| 220 | rspInfo = info; |
| 221 | parent_sim.notify(info.serial); |
| 222 | return ndk::ScopedAStatus::ok(); |
| 223 | } |
| 224 | |
Sarah Chin | 912bdf3 | 2022-01-28 01:02:16 -0800 | [diff] [blame] | 225 | ndk::ScopedAStatus RadioSimResponse::setUiccSubscriptionResponse(const RadioResponseInfo& info) { |
| 226 | rspInfo = info; |
| 227 | parent_sim.notify(info.serial); |
Sarah Chin | fc5603b | 2021-12-21 11:34:00 -0800 | [diff] [blame] | 228 | return ndk::ScopedAStatus::ok(); |
| 229 | } |
| 230 | |
Sarah Chin | 912bdf3 | 2022-01-28 01:02:16 -0800 | [diff] [blame] | 231 | ndk::ScopedAStatus RadioSimResponse::supplyIccPin2ForAppResponse(const RadioResponseInfo& info, |
Sarah Chin | fc5603b | 2021-12-21 11:34:00 -0800 | [diff] [blame] | 232 | int32_t /*remainingRetries*/) { |
Sarah Chin | 912bdf3 | 2022-01-28 01:02:16 -0800 | [diff] [blame] | 233 | rspInfo = info; |
| 234 | parent_sim.notify(info.serial); |
Sarah Chin | fc5603b | 2021-12-21 11:34:00 -0800 | [diff] [blame] | 235 | return ndk::ScopedAStatus::ok(); |
| 236 | } |
| 237 | |
Sarah Chin | 912bdf3 | 2022-01-28 01:02:16 -0800 | [diff] [blame] | 238 | ndk::ScopedAStatus RadioSimResponse::supplyIccPinForAppResponse(const RadioResponseInfo& info, |
Sarah Chin | fc5603b | 2021-12-21 11:34:00 -0800 | [diff] [blame] | 239 | int32_t /*remainingRetries*/) { |
Sarah Chin | 912bdf3 | 2022-01-28 01:02:16 -0800 | [diff] [blame] | 240 | rspInfo = info; |
| 241 | parent_sim.notify(info.serial); |
Sarah Chin | fc5603b | 2021-12-21 11:34:00 -0800 | [diff] [blame] | 242 | return ndk::ScopedAStatus::ok(); |
| 243 | } |
| 244 | |
Sarah Chin | 912bdf3 | 2022-01-28 01:02:16 -0800 | [diff] [blame] | 245 | ndk::ScopedAStatus RadioSimResponse::supplyIccPuk2ForAppResponse(const RadioResponseInfo& info, |
Sarah Chin | fc5603b | 2021-12-21 11:34:00 -0800 | [diff] [blame] | 246 | int32_t /*remainingRetries*/) { |
Sarah Chin | 912bdf3 | 2022-01-28 01:02:16 -0800 | [diff] [blame] | 247 | rspInfo = info; |
| 248 | parent_sim.notify(info.serial); |
Sarah Chin | fc5603b | 2021-12-21 11:34:00 -0800 | [diff] [blame] | 249 | return ndk::ScopedAStatus::ok(); |
| 250 | } |
| 251 | |
Sarah Chin | 912bdf3 | 2022-01-28 01:02:16 -0800 | [diff] [blame] | 252 | ndk::ScopedAStatus RadioSimResponse::supplyIccPukForAppResponse(const RadioResponseInfo& info, |
Sarah Chin | fc5603b | 2021-12-21 11:34:00 -0800 | [diff] [blame] | 253 | int32_t /*remainingRetries*/) { |
Sarah Chin | 912bdf3 | 2022-01-28 01:02:16 -0800 | [diff] [blame] | 254 | rspInfo = info; |
| 255 | parent_sim.notify(info.serial); |
Sarah Chin | fc5603b | 2021-12-21 11:34:00 -0800 | [diff] [blame] | 256 | return ndk::ScopedAStatus::ok(); |
| 257 | } |
| 258 | |
| 259 | ndk::ScopedAStatus RadioSimResponse::supplySimDepersonalizationResponse( |
Sarah Chin | 912bdf3 | 2022-01-28 01:02:16 -0800 | [diff] [blame] | 260 | const RadioResponseInfo& info, PersoSubstate /*persoType*/, int32_t /*remainingRetries*/) { |
| 261 | rspInfo = info; |
| 262 | parent_sim.notify(info.serial); |
Sarah Chin | fc5603b | 2021-12-21 11:34:00 -0800 | [diff] [blame] | 263 | return ndk::ScopedAStatus::ok(); |
| 264 | } |
| 265 | |
| 266 | ndk::ScopedAStatus RadioSimResponse::updateSimPhonebookRecordsResponse( |
| 267 | const RadioResponseInfo& info, int32_t recordIndex) { |
| 268 | rspInfo = info; |
| 269 | updatedRecordIndex = recordIndex; |
| 270 | parent_sim.notify(info.serial); |
| 271 | return ndk::ScopedAStatus::ok(); |
| 272 | } |