blob: 296c65cab8a6224fd91c027de4988d99f23c6983 [file] [log] [blame]
Sarah Chinfc5603b2021-12-21 11:34:00 -08001/*
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 Chinc83bce42021-12-29 00:35:12 -080019RadioSimResponse::RadioSimResponse(RadioServiceTest& parent) : parent_sim(parent) {}
Sarah Chinfc5603b2021-12-21 11:34:00 -080020
21ndk::ScopedAStatus RadioSimResponse::acknowledgeRequest(int32_t /*serial*/) {
22 return ndk::ScopedAStatus::ok();
23}
24
25ndk::ScopedAStatus RadioSimResponse::areUiccApplicationsEnabledResponse(
Sarah Chin912bdf32022-01-28 01:02:16 -080026 const RadioResponseInfo& info, bool enabled) {
27 rspInfo = info;
28 areUiccApplicationsEnabled = enabled;
29 parent_sim.notify(info.serial);
Sarah Chinfc5603b2021-12-21 11:34:00 -080030 return ndk::ScopedAStatus::ok();
31}
32
Sarah Chin912bdf32022-01-28 01:02:16 -080033ndk::ScopedAStatus RadioSimResponse::changeIccPin2ForAppResponse(const RadioResponseInfo& info,
Sarah Chinfc5603b2021-12-21 11:34:00 -080034 int32_t /*remainingRetries*/) {
Sarah Chin912bdf32022-01-28 01:02:16 -080035 rspInfo = info;
36 parent_sim.notify(info.serial);
Sarah Chinfc5603b2021-12-21 11:34:00 -080037 return ndk::ScopedAStatus::ok();
38}
39
Sarah Chin912bdf32022-01-28 01:02:16 -080040ndk::ScopedAStatus RadioSimResponse::changeIccPinForAppResponse(const RadioResponseInfo& info,
Sarah Chinfc5603b2021-12-21 11:34:00 -080041 int32_t /*remainingRetries*/) {
Sarah Chin912bdf32022-01-28 01:02:16 -080042 rspInfo = info;
43 parent_sim.notify(info.serial);
Sarah Chinfc5603b2021-12-21 11:34:00 -080044 return ndk::ScopedAStatus::ok();
45}
46
Sarah Chin912bdf32022-01-28 01:02:16 -080047ndk::ScopedAStatus RadioSimResponse::enableUiccApplicationsResponse(const RadioResponseInfo& info) {
48 rspInfo = info;
49 parent_sim.notify(info.serial);
Sarah Chinfc5603b2021-12-21 11:34:00 -080050 return ndk::ScopedAStatus::ok();
51}
52
53ndk::ScopedAStatus RadioSimResponse::getAllowedCarriersResponse(
Sarah Chin912bdf32022-01-28 01:02:16 -080054 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 Chinfc5603b2021-12-21 11:34:00 -080060 return ndk::ScopedAStatus::ok();
61}
62
63ndk::ScopedAStatus RadioSimResponse::getCdmaSubscriptionResponse(
Sarah Chin912bdf32022-01-28 01:02:16 -080064 const RadioResponseInfo& info, const std::string& /*mdn*/, const std::string& /*hSid*/,
Sarah Chinfc5603b2021-12-21 11:34:00 -080065 const std::string& /*hNid*/, const std::string& /*min*/, const std::string& /*prl*/) {
Sarah Chin912bdf32022-01-28 01:02:16 -080066 rspInfo = info;
67 parent_sim.notify(info.serial);
Sarah Chinfc5603b2021-12-21 11:34:00 -080068 return ndk::ScopedAStatus::ok();
69}
70
71ndk::ScopedAStatus RadioSimResponse::getCdmaSubscriptionSourceResponse(
Sarah Chin912bdf32022-01-28 01:02:16 -080072 const RadioResponseInfo& info, CdmaSubscriptionSource /*source*/) {
73 rspInfo = info;
74 parent_sim.notify(info.serial);
Sarah Chinfc5603b2021-12-21 11:34:00 -080075 return ndk::ScopedAStatus::ok();
76}
77
Sarah Chin912bdf32022-01-28 01:02:16 -080078ndk::ScopedAStatus RadioSimResponse::getFacilityLockForAppResponse(const RadioResponseInfo& info,
79 int32_t /*response*/) {
80 rspInfo = info;
81 parent_sim.notify(info.serial);
Sarah Chinfc5603b2021-12-21 11:34:00 -080082 return ndk::ScopedAStatus::ok();
83}
84
85ndk::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 Chin912bdf32022-01-28 01:02:16 -080093ndk::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 Chinfc5603b2021-12-21 11:34:00 -080098 return ndk::ScopedAStatus::ok();
99}
100
101ndk::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
109ndk::ScopedAStatus RadioSimResponse::getSimPhonebookRecordsResponse(const RadioResponseInfo& info) {
110 rspInfo = info;
111 parent_sim.notify(info.serial);
112 return ndk::ScopedAStatus::ok();
113}
114
Sarah Chin912bdf32022-01-28 01:02:16 -0800115ndk::ScopedAStatus RadioSimResponse::iccCloseLogicalChannelResponse(const RadioResponseInfo& info) {
116 rspInfo = info;
117 parent_sim.notify(info.serial);
Sarah Chinfc5603b2021-12-21 11:34:00 -0800118 return ndk::ScopedAStatus::ok();
119}
120
Muralidhar Reddyc13d0d62023-01-18 18:45:14 +0000121ndk::ScopedAStatus RadioSimResponse::iccCloseLogicalChannelWithSessionInfoResponse(
122 const RadioResponseInfo& info) {
123 rspInfo = info;
124 parent_sim.notify(info.serial);
125 return ndk::ScopedAStatus::ok();
126}
127
Sarah Chin912bdf32022-01-28 01:02:16 -0800128ndk::ScopedAStatus RadioSimResponse::iccIoForAppResponse(const RadioResponseInfo& info,
Sarah Chinfc5603b2021-12-21 11:34:00 -0800129 const IccIoResult& /*iccIo*/) {
Sarah Chin912bdf32022-01-28 01:02:16 -0800130 rspInfo = info;
131 parent_sim.notify(info.serial);
Sarah Chinfc5603b2021-12-21 11:34:00 -0800132 return ndk::ScopedAStatus::ok();
133}
134
135ndk::ScopedAStatus RadioSimResponse::iccOpenLogicalChannelResponse(
Sarah Chin912bdf32022-01-28 01:02:16 -0800136 const RadioResponseInfo& info, int32_t /*channelId*/,
Sarah Chinfc5603b2021-12-21 11:34:00 -0800137 const std::vector<uint8_t>& /*selectResponse*/) {
Sarah Chin912bdf32022-01-28 01:02:16 -0800138 rspInfo = info;
139 parent_sim.notify(info.serial);
Sarah Chinfc5603b2021-12-21 11:34:00 -0800140 return ndk::ScopedAStatus::ok();
141}
142
143ndk::ScopedAStatus RadioSimResponse::iccTransmitApduBasicChannelResponse(
Sarah Chin912bdf32022-01-28 01:02:16 -0800144 const RadioResponseInfo& info, const IccIoResult& /*result*/) {
145 rspInfo = info;
146 parent_sim.notify(info.serial);
Sarah Chinfc5603b2021-12-21 11:34:00 -0800147 return ndk::ScopedAStatus::ok();
148}
149
150ndk::ScopedAStatus RadioSimResponse::iccTransmitApduLogicalChannelResponse(
Sarah Chin912bdf32022-01-28 01:02:16 -0800151 const RadioResponseInfo& info, const IccIoResult& /*result*/) {
152 rspInfo = info;
153 parent_sim.notify(info.serial);
Sarah Chinfc5603b2021-12-21 11:34:00 -0800154 return ndk::ScopedAStatus::ok();
155}
156
157ndk::ScopedAStatus RadioSimResponse::reportStkServiceIsRunningResponse(
Sarah Chin912bdf32022-01-28 01:02:16 -0800158 const RadioResponseInfo& info) {
159 rspInfo = info;
160 parent_sim.notify(info.serial);
Sarah Chinfc5603b2021-12-21 11:34:00 -0800161 return ndk::ScopedAStatus::ok();
162}
163
164ndk::ScopedAStatus RadioSimResponse::requestIccSimAuthenticationResponse(
Sarah Chin912bdf32022-01-28 01:02:16 -0800165 const RadioResponseInfo& info, const IccIoResult& /*result*/) {
166 rspInfo = info;
167 parent_sim.notify(info.serial);
Sarah Chinfc5603b2021-12-21 11:34:00 -0800168 return ndk::ScopedAStatus::ok();
169}
170
Sarah Chin912bdf32022-01-28 01:02:16 -0800171ndk::ScopedAStatus RadioSimResponse::sendEnvelopeResponse(const RadioResponseInfo& info,
Sarah Chinfc5603b2021-12-21 11:34:00 -0800172 const std::string& /*commandResponse*/) {
Sarah Chin912bdf32022-01-28 01:02:16 -0800173 rspInfo = info;
174 parent_sim.notify(info.serial);
Sarah Chinfc5603b2021-12-21 11:34:00 -0800175 return ndk::ScopedAStatus::ok();
176}
177
Sarah Chin912bdf32022-01-28 01:02:16 -0800178ndk::ScopedAStatus RadioSimResponse::sendEnvelopeWithStatusResponse(const RadioResponseInfo& info,
179 const IccIoResult& /*iccIo*/) {
180 rspInfo = info;
181 parent_sim.notify(info.serial);
Sarah Chinfc5603b2021-12-21 11:34:00 -0800182 return ndk::ScopedAStatus::ok();
183}
184
185ndk::ScopedAStatus RadioSimResponse::sendTerminalResponseToSimResponse(
Sarah Chin912bdf32022-01-28 01:02:16 -0800186 const RadioResponseInfo& info) {
187 rspInfo = info;
188 parent_sim.notify(info.serial);
Sarah Chinfc5603b2021-12-21 11:34:00 -0800189 return ndk::ScopedAStatus::ok();
190}
191
Sarah Chin912bdf32022-01-28 01:02:16 -0800192ndk::ScopedAStatus RadioSimResponse::setAllowedCarriersResponse(const RadioResponseInfo& info) {
193 rspInfo = info;
194 parent_sim.notify(info.serial);
Sarah Chinfc5603b2021-12-21 11:34:00 -0800195 return ndk::ScopedAStatus::ok();
196}
197
198ndk::ScopedAStatus RadioSimResponse::setCarrierInfoForImsiEncryptionResponse(
199 const RadioResponseInfo& info) {
200 rspInfo = info;
201 parent_sim.notify(info.serial);
202 return ndk::ScopedAStatus::ok();
203}
204
205ndk::ScopedAStatus RadioSimResponse::setCdmaSubscriptionSourceResponse(
Sarah Chin912bdf32022-01-28 01:02:16 -0800206 const RadioResponseInfo& info) {
207 rspInfo = info;
208 parent_sim.notify(info.serial);
Sarah Chinfc5603b2021-12-21 11:34:00 -0800209 return ndk::ScopedAStatus::ok();
210}
211
Sarah Chin912bdf32022-01-28 01:02:16 -0800212ndk::ScopedAStatus RadioSimResponse::setFacilityLockForAppResponse(const RadioResponseInfo& info,
213 int32_t /*retry*/) {
214 rspInfo = info;
215 parent_sim.notify(info.serial);
Sarah Chinfc5603b2021-12-21 11:34:00 -0800216 return ndk::ScopedAStatus::ok();
217}
218
219ndk::ScopedAStatus RadioSimResponse::setSimCardPowerResponse(const RadioResponseInfo& info) {
220 rspInfo = info;
221 parent_sim.notify(info.serial);
222 return ndk::ScopedAStatus::ok();
223}
224
Sarah Chin912bdf32022-01-28 01:02:16 -0800225ndk::ScopedAStatus RadioSimResponse::setUiccSubscriptionResponse(const RadioResponseInfo& info) {
226 rspInfo = info;
227 parent_sim.notify(info.serial);
Sarah Chinfc5603b2021-12-21 11:34:00 -0800228 return ndk::ScopedAStatus::ok();
229}
230
Sarah Chin912bdf32022-01-28 01:02:16 -0800231ndk::ScopedAStatus RadioSimResponse::supplyIccPin2ForAppResponse(const RadioResponseInfo& info,
Sarah Chinfc5603b2021-12-21 11:34:00 -0800232 int32_t /*remainingRetries*/) {
Sarah Chin912bdf32022-01-28 01:02:16 -0800233 rspInfo = info;
234 parent_sim.notify(info.serial);
Sarah Chinfc5603b2021-12-21 11:34:00 -0800235 return ndk::ScopedAStatus::ok();
236}
237
Sarah Chin912bdf32022-01-28 01:02:16 -0800238ndk::ScopedAStatus RadioSimResponse::supplyIccPinForAppResponse(const RadioResponseInfo& info,
Sarah Chinfc5603b2021-12-21 11:34:00 -0800239 int32_t /*remainingRetries*/) {
Sarah Chin912bdf32022-01-28 01:02:16 -0800240 rspInfo = info;
241 parent_sim.notify(info.serial);
Sarah Chinfc5603b2021-12-21 11:34:00 -0800242 return ndk::ScopedAStatus::ok();
243}
244
Sarah Chin912bdf32022-01-28 01:02:16 -0800245ndk::ScopedAStatus RadioSimResponse::supplyIccPuk2ForAppResponse(const RadioResponseInfo& info,
Sarah Chinfc5603b2021-12-21 11:34:00 -0800246 int32_t /*remainingRetries*/) {
Sarah Chin912bdf32022-01-28 01:02:16 -0800247 rspInfo = info;
248 parent_sim.notify(info.serial);
Sarah Chinfc5603b2021-12-21 11:34:00 -0800249 return ndk::ScopedAStatus::ok();
250}
251
Sarah Chin912bdf32022-01-28 01:02:16 -0800252ndk::ScopedAStatus RadioSimResponse::supplyIccPukForAppResponse(const RadioResponseInfo& info,
Sarah Chinfc5603b2021-12-21 11:34:00 -0800253 int32_t /*remainingRetries*/) {
Sarah Chin912bdf32022-01-28 01:02:16 -0800254 rspInfo = info;
255 parent_sim.notify(info.serial);
Sarah Chinfc5603b2021-12-21 11:34:00 -0800256 return ndk::ScopedAStatus::ok();
257}
258
259ndk::ScopedAStatus RadioSimResponse::supplySimDepersonalizationResponse(
Sarah Chin912bdf32022-01-28 01:02:16 -0800260 const RadioResponseInfo& info, PersoSubstate /*persoType*/, int32_t /*remainingRetries*/) {
261 rspInfo = info;
262 parent_sim.notify(info.serial);
Sarah Chinfc5603b2021-12-21 11:34:00 -0800263 return ndk::ScopedAStatus::ok();
264}
265
266ndk::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}