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_network_utils.h"
18
RadioNetworkResponse(RadioServiceTest & parent)19 RadioNetworkResponse::RadioNetworkResponse(RadioServiceTest& parent) : parent_network(parent) {}
20
acknowledgeRequest(int32_t)21 ndk::ScopedAStatus RadioNetworkResponse::acknowledgeRequest(int32_t /*serial*/) {
22 return ndk::ScopedAStatus::ok();
23 }
24
getAllowedNetworkTypesBitmapResponse(const RadioResponseInfo & info,const int32_t networkTypeBitmap)25 ndk::ScopedAStatus RadioNetworkResponse::getAllowedNetworkTypesBitmapResponse(
26 const RadioResponseInfo& info, const int32_t networkTypeBitmap) {
27 rspInfo = info;
28 networkTypeBitmapResponse = networkTypeBitmap;
29 parent_network.notify(info.serial);
30 return ndk::ScopedAStatus::ok();
31 }
32
getAvailableBandModesResponse(const RadioResponseInfo & info,const std::vector<RadioBandMode> & bandModes)33 ndk::ScopedAStatus RadioNetworkResponse::getAvailableBandModesResponse(
34 const RadioResponseInfo& info, const std::vector<RadioBandMode>& bandModes) {
35 rspInfo = info;
36 radioBandModes = bandModes;
37 parent_network.notify(info.serial);
38 return ndk::ScopedAStatus::ok();
39 }
40
getAvailableNetworksResponse(const RadioResponseInfo & info,const std::vector<OperatorInfo> & operatorInfos)41 ndk::ScopedAStatus RadioNetworkResponse::getAvailableNetworksResponse(
42 const RadioResponseInfo& info, const std::vector<OperatorInfo>& operatorInfos) {
43 rspInfo = info;
44 networkInfos = operatorInfos;
45 parent_network.notify(info.serial);
46 return ndk::ScopedAStatus::ok();
47 }
48
getBarringInfoResponse(const RadioResponseInfo & info,const CellIdentity & cellIdentity,const std::vector<BarringInfo> & barringInfos)49 ndk::ScopedAStatus RadioNetworkResponse::getBarringInfoResponse(
50 const RadioResponseInfo& info, const CellIdentity& cellIdentity,
51 const std::vector<BarringInfo>& barringInfos) {
52 rspInfo = info;
53 barringCellIdentity = cellIdentity;
54 barringInfoList = barringInfos;
55 parent_network.notify(info.serial);
56 return ndk::ScopedAStatus::ok();
57 }
58
getCdmaRoamingPreferenceResponse(const RadioResponseInfo & info,CdmaRoamingType)59 ndk::ScopedAStatus RadioNetworkResponse::getCdmaRoamingPreferenceResponse(
60 const RadioResponseInfo& info, CdmaRoamingType /*type*/) {
61 rspInfo = info;
62 parent_network.notify(info.serial);
63 return ndk::ScopedAStatus::ok();
64 }
65
getCellInfoListResponse(const RadioResponseInfo & info,const std::vector<CellInfo> &)66 ndk::ScopedAStatus RadioNetworkResponse::getCellInfoListResponse(
67 const RadioResponseInfo& info, const std::vector<CellInfo>& /*cellInfo*/) {
68 rspInfo = info;
69 parent_network.notify(info.serial);
70 return ndk::ScopedAStatus::ok();
71 }
72
getDataRegistrationStateResponse(const RadioResponseInfo & info,const RegStateResult & regResponse)73 ndk::ScopedAStatus RadioNetworkResponse::getDataRegistrationStateResponse(
74 const RadioResponseInfo& info, const RegStateResult& regResponse) {
75 rspInfo = info;
76 dataRegResp = regResponse;
77 parent_network.notify(info.serial);
78 return ndk::ScopedAStatus::ok();
79 }
80
getImsRegistrationStateResponse(const RadioResponseInfo & info,bool,RadioTechnologyFamily)81 ndk::ScopedAStatus RadioNetworkResponse::getImsRegistrationStateResponse(
82 const RadioResponseInfo& info, bool /*isRegistered*/, RadioTechnologyFamily /*ratFamily*/) {
83 rspInfo = info;
84 parent_network.notify(info.serial);
85 return ndk::ScopedAStatus::ok();
86 }
87
getNetworkSelectionModeResponse(const RadioResponseInfo & info,bool)88 ndk::ScopedAStatus RadioNetworkResponse::getNetworkSelectionModeResponse(
89 const RadioResponseInfo& info, bool /*manual*/) {
90 rspInfo = info;
91 parent_network.notify(info.serial);
92 return ndk::ScopedAStatus::ok();
93 }
94
getOperatorResponse(const RadioResponseInfo & info,const std::string &,const std::string &,const std::string &)95 ndk::ScopedAStatus RadioNetworkResponse::getOperatorResponse(const RadioResponseInfo& info,
96 const std::string& /*longName*/,
97 const std::string& /*shortName*/,
98 const std::string& /*numeric*/) {
99 rspInfo = info;
100 parent_network.notify(info.serial);
101 return ndk::ScopedAStatus::ok();
102 }
103
getSignalStrengthResponse(const RadioResponseInfo & info,const SignalStrength &)104 ndk::ScopedAStatus RadioNetworkResponse::getSignalStrengthResponse(
105 const RadioResponseInfo& info, const SignalStrength& /*sig_strength*/) {
106 rspInfo = info;
107 parent_network.notify(info.serial);
108 return ndk::ScopedAStatus::ok();
109 }
110
getSystemSelectionChannelsResponse(const RadioResponseInfo & info,const std::vector<RadioAccessSpecifier> & specifiers)111 ndk::ScopedAStatus RadioNetworkResponse::getSystemSelectionChannelsResponse(
112 const RadioResponseInfo& info, const std::vector<RadioAccessSpecifier>& specifiers) {
113 rspInfo = info;
114 this->specifiers = specifiers;
115 parent_network.notify(info.serial);
116 return ndk::ScopedAStatus::ok();
117 }
118
getUsageSettingResponse(const RadioResponseInfo & info,const UsageSetting usageSetting)119 ndk::ScopedAStatus RadioNetworkResponse::getUsageSettingResponse(const RadioResponseInfo& info,
120 const UsageSetting usageSetting) {
121 rspInfo = info;
122 this->usageSetting = usageSetting;
123 parent_network.notify(info.serial);
124 return ndk::ScopedAStatus::ok();
125 }
126
getVoiceRadioTechnologyResponse(const RadioResponseInfo & info,RadioTechnology)127 ndk::ScopedAStatus RadioNetworkResponse::getVoiceRadioTechnologyResponse(
128 const RadioResponseInfo& info, RadioTechnology /*rat*/) {
129 rspInfo = info;
130 parent_network.notify(info.serial);
131 return ndk::ScopedAStatus::ok();
132 }
133
getVoiceRegistrationStateResponse(const RadioResponseInfo & info,const RegStateResult & regResponse)134 ndk::ScopedAStatus RadioNetworkResponse::getVoiceRegistrationStateResponse(
135 const RadioResponseInfo& info, const RegStateResult& regResponse) {
136 rspInfo = info;
137 voiceRegResp = regResponse;
138 parent_network.notify(info.serial);
139 return ndk::ScopedAStatus::ok();
140 }
141
isNrDualConnectivityEnabledResponse(const RadioResponseInfo & info,bool isEnabled)142 ndk::ScopedAStatus RadioNetworkResponse::isNrDualConnectivityEnabledResponse(
143 const RadioResponseInfo& info, bool isEnabled) {
144 rspInfo = info;
145 isNrDualConnectivityEnabled = isEnabled;
146 parent_network.notify(info.serial);
147 return ndk::ScopedAStatus::ok();
148 }
149
setAllowedNetworkTypesBitmapResponse(const RadioResponseInfo & info)150 ndk::ScopedAStatus RadioNetworkResponse::setAllowedNetworkTypesBitmapResponse(
151 const RadioResponseInfo& info) {
152 rspInfo = info;
153 parent_network.notify(info.serial);
154 return ndk::ScopedAStatus::ok();
155 }
156
setBandModeResponse(const RadioResponseInfo & info)157 ndk::ScopedAStatus RadioNetworkResponse::setBandModeResponse(const RadioResponseInfo& info) {
158 rspInfo = info;
159 parent_network.notify(info.serial);
160 return ndk::ScopedAStatus::ok();
161 }
162
setBarringPasswordResponse(const RadioResponseInfo & info)163 ndk::ScopedAStatus RadioNetworkResponse::setBarringPasswordResponse(const RadioResponseInfo& info) {
164 rspInfo = info;
165 parent_network.notify(info.serial);
166 return ndk::ScopedAStatus::ok();
167 }
168
setCdmaRoamingPreferenceResponse(const RadioResponseInfo & info)169 ndk::ScopedAStatus RadioNetworkResponse::setCdmaRoamingPreferenceResponse(
170 const RadioResponseInfo& info) {
171 rspInfo = info;
172 parent_network.notify(info.serial);
173 return ndk::ScopedAStatus::ok();
174 }
175
setCellInfoListRateResponse(const RadioResponseInfo & info)176 ndk::ScopedAStatus RadioNetworkResponse::setCellInfoListRateResponse(
177 const RadioResponseInfo& info) {
178 rspInfo = info;
179 parent_network.notify(info.serial);
180 return ndk::ScopedAStatus::ok();
181 }
182
setIndicationFilterResponse(const RadioResponseInfo & info)183 ndk::ScopedAStatus RadioNetworkResponse::setIndicationFilterResponse(
184 const RadioResponseInfo& info) {
185 rspInfo = info;
186 parent_network.notify(info.serial);
187 return ndk::ScopedAStatus::ok();
188 }
189
setLinkCapacityReportingCriteriaResponse(const RadioResponseInfo & info)190 ndk::ScopedAStatus RadioNetworkResponse::setLinkCapacityReportingCriteriaResponse(
191 const RadioResponseInfo& info) {
192 rspInfo = info;
193 parent_network.notify(info.serial);
194 return ndk::ScopedAStatus::ok();
195 }
196
setLocationUpdatesResponse(const RadioResponseInfo & info)197 ndk::ScopedAStatus RadioNetworkResponse::setLocationUpdatesResponse(const RadioResponseInfo& info) {
198 rspInfo = info;
199 parent_network.notify(info.serial);
200 return ndk::ScopedAStatus::ok();
201 }
202
setNetworkSelectionModeAutomaticResponse(const RadioResponseInfo & info)203 ndk::ScopedAStatus RadioNetworkResponse::setNetworkSelectionModeAutomaticResponse(
204 const RadioResponseInfo& info) {
205 rspInfo = info;
206 parent_network.notify(info.serial);
207 return ndk::ScopedAStatus::ok();
208 }
209
setNetworkSelectionModeManualResponse(const RadioResponseInfo & info)210 ndk::ScopedAStatus RadioNetworkResponse::setNetworkSelectionModeManualResponse(
211 const RadioResponseInfo& info) {
212 rspInfo = info;
213 parent_network.notify(info.serial);
214 return ndk::ScopedAStatus::ok();
215 }
216
setNrDualConnectivityStateResponse(const RadioResponseInfo & info)217 ndk::ScopedAStatus RadioNetworkResponse::setNrDualConnectivityStateResponse(
218 const RadioResponseInfo& info) {
219 rspInfo = info;
220 parent_network.notify(info.serial);
221 return ndk::ScopedAStatus::ok();
222 }
223
setSignalStrengthReportingCriteriaResponse(const RadioResponseInfo & info)224 ndk::ScopedAStatus RadioNetworkResponse::setSignalStrengthReportingCriteriaResponse(
225 const RadioResponseInfo& info) {
226 rspInfo = info;
227 parent_network.notify(info.serial);
228 return ndk::ScopedAStatus::ok();
229 }
230
setSuppServiceNotificationsResponse(const RadioResponseInfo & info)231 ndk::ScopedAStatus RadioNetworkResponse::setSuppServiceNotificationsResponse(
232 const RadioResponseInfo& info) {
233 rspInfo = info;
234 parent_network.notify(info.serial);
235 return ndk::ScopedAStatus::ok();
236 }
237
setSystemSelectionChannelsResponse(const RadioResponseInfo & info)238 ndk::ScopedAStatus RadioNetworkResponse::setSystemSelectionChannelsResponse(
239 const RadioResponseInfo& info) {
240 rspInfo = info;
241 parent_network.notify(info.serial);
242 return ndk::ScopedAStatus::ok();
243 }
244
setUsageSettingResponse(const RadioResponseInfo & info)245 ndk::ScopedAStatus RadioNetworkResponse::setUsageSettingResponse(const RadioResponseInfo& info) {
246 rspInfo = info;
247 parent_network.notify(info.serial);
248 return ndk::ScopedAStatus::ok();
249 }
250
startNetworkScanResponse(const RadioResponseInfo & info)251 ndk::ScopedAStatus RadioNetworkResponse::startNetworkScanResponse(const RadioResponseInfo& info) {
252 rspInfo = info;
253 parent_network.notify(info.serial);
254 return ndk::ScopedAStatus::ok();
255 }
256
stopNetworkScanResponse(const RadioResponseInfo & info)257 ndk::ScopedAStatus RadioNetworkResponse::stopNetworkScanResponse(const RadioResponseInfo& info) {
258 rspInfo = info;
259 parent_network.notify(info.serial);
260 return ndk::ScopedAStatus::ok();
261 }
262
supplyNetworkDepersonalizationResponse(const RadioResponseInfo & info,int32_t)263 ndk::ScopedAStatus RadioNetworkResponse::supplyNetworkDepersonalizationResponse(
264 const RadioResponseInfo& info, int32_t /*remainingRetries*/) {
265 rspInfo = info;
266 parent_network.notify(info.serial);
267 return ndk::ScopedAStatus::ok();
268 }
269
setEmergencyModeResponse(const RadioResponseInfo & info,const EmergencyRegResult &)270 ndk::ScopedAStatus RadioNetworkResponse::setEmergencyModeResponse(
271 const RadioResponseInfo& info, const EmergencyRegResult& /*regState*/) {
272 rspInfo = info;
273 parent_network.notify(info.serial);
274 return ndk::ScopedAStatus::ok();
275 }
276
triggerEmergencyNetworkScanResponse(const RadioResponseInfo & info)277 ndk::ScopedAStatus RadioNetworkResponse::triggerEmergencyNetworkScanResponse(
278 const RadioResponseInfo& info) {
279 rspInfo = info;
280 parent_network.notify(info.serial);
281 return ndk::ScopedAStatus::ok();
282 }
283
exitEmergencyModeResponse(const RadioResponseInfo & info)284 ndk::ScopedAStatus RadioNetworkResponse::exitEmergencyModeResponse(const RadioResponseInfo& info) {
285 rspInfo = info;
286 parent_network.notify(info.serial);
287 return ndk::ScopedAStatus::ok();
288 }
289
cancelEmergencyNetworkScanResponse(const RadioResponseInfo & info)290 ndk::ScopedAStatus RadioNetworkResponse::cancelEmergencyNetworkScanResponse(
291 const RadioResponseInfo& info) {
292 rspInfo = info;
293 parent_network.notify(info.serial);
294 return ndk::ScopedAStatus::ok();
295 }
296
setNullCipherAndIntegrityEnabledResponse(const RadioResponseInfo & info)297 ndk::ScopedAStatus RadioNetworkResponse::setNullCipherAndIntegrityEnabledResponse(
298 const RadioResponseInfo& info) {
299 rspInfo = info;
300 parent_network.notify(info.serial);
301 return ndk::ScopedAStatus::ok();
302 }
303
isNullCipherAndIntegrityEnabledResponse(const RadioResponseInfo & info,bool)304 ndk::ScopedAStatus RadioNetworkResponse::isNullCipherAndIntegrityEnabledResponse(
305 const RadioResponseInfo& info, bool /*isEnabled*/) {
306 rspInfo = info;
307 parent_network.notify(info.serial);
308 return ndk::ScopedAStatus::ok();
309 }
310
isN1ModeEnabledResponse(const RadioResponseInfo & info,bool)311 ndk::ScopedAStatus RadioNetworkResponse::isN1ModeEnabledResponse(
312 const RadioResponseInfo& info, bool /*isEnabled*/) {
313 rspInfo = info;
314 parent_network.notify(info.serial);
315 return ndk::ScopedAStatus::ok();
316 }
317
setN1ModeEnabledResponse(const RadioResponseInfo & info)318 ndk::ScopedAStatus RadioNetworkResponse::setN1ModeEnabledResponse(const RadioResponseInfo& info) {
319 rspInfo = info;
320 parent_network.notify(info.serial);
321 return ndk::ScopedAStatus::ok();
322 }
323
setCellularIdentifierTransparencyEnabledResponse(const RadioResponseInfo & info)324 ndk::ScopedAStatus RadioNetworkResponse::setCellularIdentifierTransparencyEnabledResponse(
325 const RadioResponseInfo& info) {
326 rspInfo = info;
327 parent_network.notify(info.serial);
328 return ndk::ScopedAStatus::ok();
329 }
330
isCellularIdentifierTransparencyEnabledResponse(const RadioResponseInfo & info,bool enabled)331 ndk::ScopedAStatus RadioNetworkResponse::isCellularIdentifierTransparencyEnabledResponse(
332 const RadioResponseInfo& info, bool enabled) {
333 rspInfo = info;
334 this->isCellularIdentifierTransparencyEnabled = enabled;
335 parent_network.notify(info.serial);
336 return ndk::ScopedAStatus::ok();
337 }
338
setSecurityAlgorithmsUpdatedEnabledResponse(const RadioResponseInfo & info)339 ndk::ScopedAStatus RadioNetworkResponse::setSecurityAlgorithmsUpdatedEnabledResponse(
340 const RadioResponseInfo& info) {
341 rspInfo = info;
342 parent_network.notify(info.serial);
343 return ndk::ScopedAStatus::ok();
344 }
345
isSecurityAlgorithmsUpdatedEnabledResponse(const RadioResponseInfo & info,bool enabled)346 ndk::ScopedAStatus RadioNetworkResponse::isSecurityAlgorithmsUpdatedEnabledResponse(
347 const RadioResponseInfo& info, bool enabled) {
348 rspInfo = info;
349 this->isSecurityAlgorithmsUpdatedEnabled = enabled;
350 parent_network.notify(info.serial);
351 return ndk::ScopedAStatus::ok();
352 }
353