blob: 391c9cb12d083510eb6c98be8e1f16cfc4682516 [file] [log] [blame]
Sarah Chind2a41192021-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 Chin91997ac2021-12-29 00:35:12 -080019RadioSimResponse::RadioSimResponse(RadioServiceTest& parent) : parent_sim(parent) {}
Sarah Chind2a41192021-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 Chin52de0ad2022-01-28 01:02:16 -080026 const RadioResponseInfo& info, bool enabled) {
27 rspInfo = info;
28 areUiccApplicationsEnabled = enabled;
29 parent_sim.notify(info.serial);
Sarah Chind2a41192021-12-21 11:34:00 -080030 return ndk::ScopedAStatus::ok();
31}
32
Sarah Chin52de0ad2022-01-28 01:02:16 -080033ndk::ScopedAStatus RadioSimResponse::changeIccPin2ForAppResponse(const RadioResponseInfo& info,
Sarah Chind2a41192021-12-21 11:34:00 -080034 int32_t /*remainingRetries*/) {
Sarah Chin52de0ad2022-01-28 01:02:16 -080035 rspInfo = info;
36 parent_sim.notify(info.serial);
Sarah Chind2a41192021-12-21 11:34:00 -080037 return ndk::ScopedAStatus::ok();
38}
39
Sarah Chin52de0ad2022-01-28 01:02:16 -080040ndk::ScopedAStatus RadioSimResponse::changeIccPinForAppResponse(const RadioResponseInfo& info,
Sarah Chind2a41192021-12-21 11:34:00 -080041 int32_t /*remainingRetries*/) {
Sarah Chin52de0ad2022-01-28 01:02:16 -080042 rspInfo = info;
43 parent_sim.notify(info.serial);
Sarah Chind2a41192021-12-21 11:34:00 -080044 return ndk::ScopedAStatus::ok();
45}
46
Sarah Chin52de0ad2022-01-28 01:02:16 -080047ndk::ScopedAStatus RadioSimResponse::enableUiccApplicationsResponse(const RadioResponseInfo& info) {
48 rspInfo = info;
49 parent_sim.notify(info.serial);
Sarah Chind2a41192021-12-21 11:34:00 -080050 return ndk::ScopedAStatus::ok();
51}
52
53ndk::ScopedAStatus RadioSimResponse::getAllowedCarriersResponse(
Sarah Chin52de0ad2022-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 Chind2a41192021-12-21 11:34:00 -080060 return ndk::ScopedAStatus::ok();
61}
62
63ndk::ScopedAStatus RadioSimResponse::getCdmaSubscriptionResponse(
Sarah Chin52de0ad2022-01-28 01:02:16 -080064 const RadioResponseInfo& info, const std::string& /*mdn*/, const std::string& /*hSid*/,
Sarah Chind2a41192021-12-21 11:34:00 -080065 const std::string& /*hNid*/, const std::string& /*min*/, const std::string& /*prl*/) {
Sarah Chin52de0ad2022-01-28 01:02:16 -080066 rspInfo = info;
67 parent_sim.notify(info.serial);
Sarah Chind2a41192021-12-21 11:34:00 -080068 return ndk::ScopedAStatus::ok();
69}
70
71ndk::ScopedAStatus RadioSimResponse::getCdmaSubscriptionSourceResponse(
Sarah Chin52de0ad2022-01-28 01:02:16 -080072 const RadioResponseInfo& info, CdmaSubscriptionSource /*source*/) {
73 rspInfo = info;
74 parent_sim.notify(info.serial);
Sarah Chind2a41192021-12-21 11:34:00 -080075 return ndk::ScopedAStatus::ok();
76}
77
Sarah Chin52de0ad2022-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 Chind2a41192021-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 Chin52de0ad2022-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 Chind2a41192021-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 Chin52de0ad2022-01-28 01:02:16 -0800115ndk::ScopedAStatus RadioSimResponse::iccCloseLogicalChannelResponse(const RadioResponseInfo& info) {
116 rspInfo = info;
117 parent_sim.notify(info.serial);
Sarah Chind2a41192021-12-21 11:34:00 -0800118 return ndk::ScopedAStatus::ok();
119}
120
Sarah Chin52de0ad2022-01-28 01:02:16 -0800121ndk::ScopedAStatus RadioSimResponse::iccIoForAppResponse(const RadioResponseInfo& info,
Sarah Chind2a41192021-12-21 11:34:00 -0800122 const IccIoResult& /*iccIo*/) {
Sarah Chin52de0ad2022-01-28 01:02:16 -0800123 rspInfo = info;
124 parent_sim.notify(info.serial);
Sarah Chind2a41192021-12-21 11:34:00 -0800125 return ndk::ScopedAStatus::ok();
126}
127
128ndk::ScopedAStatus RadioSimResponse::iccOpenLogicalChannelResponse(
Sarah Chin52de0ad2022-01-28 01:02:16 -0800129 const RadioResponseInfo& info, int32_t /*channelId*/,
Sarah Chind2a41192021-12-21 11:34:00 -0800130 const std::vector<uint8_t>& /*selectResponse*/) {
Sarah Chin52de0ad2022-01-28 01:02:16 -0800131 rspInfo = info;
132 parent_sim.notify(info.serial);
Sarah Chind2a41192021-12-21 11:34:00 -0800133 return ndk::ScopedAStatus::ok();
134}
135
136ndk::ScopedAStatus RadioSimResponse::iccTransmitApduBasicChannelResponse(
Sarah Chin52de0ad2022-01-28 01:02:16 -0800137 const RadioResponseInfo& info, const IccIoResult& /*result*/) {
138 rspInfo = info;
139 parent_sim.notify(info.serial);
Sarah Chind2a41192021-12-21 11:34:00 -0800140 return ndk::ScopedAStatus::ok();
141}
142
143ndk::ScopedAStatus RadioSimResponse::iccTransmitApduLogicalChannelResponse(
Sarah Chin52de0ad2022-01-28 01:02:16 -0800144 const RadioResponseInfo& info, const IccIoResult& /*result*/) {
145 rspInfo = info;
146 parent_sim.notify(info.serial);
Sarah Chind2a41192021-12-21 11:34:00 -0800147 return ndk::ScopedAStatus::ok();
148}
149
150ndk::ScopedAStatus RadioSimResponse::reportStkServiceIsRunningResponse(
Sarah Chin52de0ad2022-01-28 01:02:16 -0800151 const RadioResponseInfo& info) {
152 rspInfo = info;
153 parent_sim.notify(info.serial);
Sarah Chind2a41192021-12-21 11:34:00 -0800154 return ndk::ScopedAStatus::ok();
155}
156
157ndk::ScopedAStatus RadioSimResponse::requestIccSimAuthenticationResponse(
Sarah Chin52de0ad2022-01-28 01:02:16 -0800158 const RadioResponseInfo& info, const IccIoResult& /*result*/) {
159 rspInfo = info;
160 parent_sim.notify(info.serial);
Sarah Chind2a41192021-12-21 11:34:00 -0800161 return ndk::ScopedAStatus::ok();
162}
163
Sarah Chin52de0ad2022-01-28 01:02:16 -0800164ndk::ScopedAStatus RadioSimResponse::sendEnvelopeResponse(const RadioResponseInfo& info,
Sarah Chind2a41192021-12-21 11:34:00 -0800165 const std::string& /*commandResponse*/) {
Sarah Chin52de0ad2022-01-28 01:02:16 -0800166 rspInfo = info;
167 parent_sim.notify(info.serial);
Sarah Chind2a41192021-12-21 11:34:00 -0800168 return ndk::ScopedAStatus::ok();
169}
170
Sarah Chin52de0ad2022-01-28 01:02:16 -0800171ndk::ScopedAStatus RadioSimResponse::sendEnvelopeWithStatusResponse(const RadioResponseInfo& info,
172 const IccIoResult& /*iccIo*/) {
173 rspInfo = info;
174 parent_sim.notify(info.serial);
Sarah Chind2a41192021-12-21 11:34:00 -0800175 return ndk::ScopedAStatus::ok();
176}
177
178ndk::ScopedAStatus RadioSimResponse::sendTerminalResponseToSimResponse(
Sarah Chin52de0ad2022-01-28 01:02:16 -0800179 const RadioResponseInfo& info) {
180 rspInfo = info;
181 parent_sim.notify(info.serial);
Sarah Chind2a41192021-12-21 11:34:00 -0800182 return ndk::ScopedAStatus::ok();
183}
184
Sarah Chin52de0ad2022-01-28 01:02:16 -0800185ndk::ScopedAStatus RadioSimResponse::setAllowedCarriersResponse(const RadioResponseInfo& info) {
186 rspInfo = info;
187 parent_sim.notify(info.serial);
Sarah Chind2a41192021-12-21 11:34:00 -0800188 return ndk::ScopedAStatus::ok();
189}
190
191ndk::ScopedAStatus RadioSimResponse::setCarrierInfoForImsiEncryptionResponse(
192 const RadioResponseInfo& info) {
193 rspInfo = info;
194 parent_sim.notify(info.serial);
195 return ndk::ScopedAStatus::ok();
196}
197
198ndk::ScopedAStatus RadioSimResponse::setCdmaSubscriptionSourceResponse(
Sarah Chin52de0ad2022-01-28 01:02:16 -0800199 const RadioResponseInfo& info) {
200 rspInfo = info;
201 parent_sim.notify(info.serial);
Sarah Chind2a41192021-12-21 11:34:00 -0800202 return ndk::ScopedAStatus::ok();
203}
204
Sarah Chin52de0ad2022-01-28 01:02:16 -0800205ndk::ScopedAStatus RadioSimResponse::setFacilityLockForAppResponse(const RadioResponseInfo& info,
206 int32_t /*retry*/) {
207 rspInfo = info;
208 parent_sim.notify(info.serial);
Sarah Chind2a41192021-12-21 11:34:00 -0800209 return ndk::ScopedAStatus::ok();
210}
211
212ndk::ScopedAStatus RadioSimResponse::setSimCardPowerResponse(const RadioResponseInfo& info) {
213 rspInfo = info;
214 parent_sim.notify(info.serial);
215 return ndk::ScopedAStatus::ok();
216}
217
Sarah Chin52de0ad2022-01-28 01:02:16 -0800218ndk::ScopedAStatus RadioSimResponse::setUiccSubscriptionResponse(const RadioResponseInfo& info) {
219 rspInfo = info;
220 parent_sim.notify(info.serial);
Sarah Chind2a41192021-12-21 11:34:00 -0800221 return ndk::ScopedAStatus::ok();
222}
223
Sarah Chin52de0ad2022-01-28 01:02:16 -0800224ndk::ScopedAStatus RadioSimResponse::supplyIccPin2ForAppResponse(const RadioResponseInfo& info,
Sarah Chind2a41192021-12-21 11:34:00 -0800225 int32_t /*remainingRetries*/) {
Sarah Chin52de0ad2022-01-28 01:02:16 -0800226 rspInfo = info;
227 parent_sim.notify(info.serial);
Sarah Chind2a41192021-12-21 11:34:00 -0800228 return ndk::ScopedAStatus::ok();
229}
230
Sarah Chin52de0ad2022-01-28 01:02:16 -0800231ndk::ScopedAStatus RadioSimResponse::supplyIccPinForAppResponse(const RadioResponseInfo& info,
Sarah Chind2a41192021-12-21 11:34:00 -0800232 int32_t /*remainingRetries*/) {
Sarah Chin52de0ad2022-01-28 01:02:16 -0800233 rspInfo = info;
234 parent_sim.notify(info.serial);
Sarah Chind2a41192021-12-21 11:34:00 -0800235 return ndk::ScopedAStatus::ok();
236}
237
Sarah Chin52de0ad2022-01-28 01:02:16 -0800238ndk::ScopedAStatus RadioSimResponse::supplyIccPuk2ForAppResponse(const RadioResponseInfo& info,
Sarah Chind2a41192021-12-21 11:34:00 -0800239 int32_t /*remainingRetries*/) {
Sarah Chin52de0ad2022-01-28 01:02:16 -0800240 rspInfo = info;
241 parent_sim.notify(info.serial);
Sarah Chind2a41192021-12-21 11:34:00 -0800242 return ndk::ScopedAStatus::ok();
243}
244
Sarah Chin52de0ad2022-01-28 01:02:16 -0800245ndk::ScopedAStatus RadioSimResponse::supplyIccPukForAppResponse(const RadioResponseInfo& info,
Sarah Chind2a41192021-12-21 11:34:00 -0800246 int32_t /*remainingRetries*/) {
Sarah Chin52de0ad2022-01-28 01:02:16 -0800247 rspInfo = info;
248 parent_sim.notify(info.serial);
Sarah Chind2a41192021-12-21 11:34:00 -0800249 return ndk::ScopedAStatus::ok();
250}
251
252ndk::ScopedAStatus RadioSimResponse::supplySimDepersonalizationResponse(
Sarah Chin52de0ad2022-01-28 01:02:16 -0800253 const RadioResponseInfo& info, PersoSubstate /*persoType*/, int32_t /*remainingRetries*/) {
254 rspInfo = info;
255 parent_sim.notify(info.serial);
Sarah Chind2a41192021-12-21 11:34:00 -0800256 return ndk::ScopedAStatus::ok();
257}
258
259ndk::ScopedAStatus RadioSimResponse::updateSimPhonebookRecordsResponse(
260 const RadioResponseInfo& info, int32_t recordIndex) {
261 rspInfo = info;
262 updatedRecordIndex = recordIndex;
263 parent_sim.notify(info.serial);
264 return ndk::ScopedAStatus::ok();
265}