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_voice_utils.h"
18
RadioVoiceResponse(RadioServiceTest & parent)19 RadioVoiceResponse::RadioVoiceResponse(RadioServiceTest& parent) : parent_voice(parent) {}
20
acceptCallResponse(const RadioResponseInfo & info)21 ndk::ScopedAStatus RadioVoiceResponse::acceptCallResponse(const RadioResponseInfo& info) {
22 rspInfo = info;
23 parent_voice.notify(info.serial);
24 return ndk::ScopedAStatus::ok();
25 }
26
acknowledgeRequest(int32_t)27 ndk::ScopedAStatus RadioVoiceResponse::acknowledgeRequest(int32_t /*serial*/) {
28 return ndk::ScopedAStatus::ok();
29 }
30
cancelPendingUssdResponse(const RadioResponseInfo & info)31 ndk::ScopedAStatus RadioVoiceResponse::cancelPendingUssdResponse(const RadioResponseInfo& info) {
32 rspInfo = info;
33 parent_voice.notify(info.serial);
34 return ndk::ScopedAStatus::ok();
35 }
36
conferenceResponse(const RadioResponseInfo & info)37 ndk::ScopedAStatus RadioVoiceResponse::conferenceResponse(const RadioResponseInfo& info) {
38 rspInfo = info;
39 parent_voice.notify(info.serial);
40 return ndk::ScopedAStatus::ok();
41 }
42
dialResponse(const RadioResponseInfo & info)43 ndk::ScopedAStatus RadioVoiceResponse::dialResponse(const RadioResponseInfo& info) {
44 rspInfo = info;
45 parent_voice.notify(info.serial);
46 return ndk::ScopedAStatus::ok();
47 }
48
emergencyDialResponse(const RadioResponseInfo & info)49 ndk::ScopedAStatus RadioVoiceResponse::emergencyDialResponse(const RadioResponseInfo& info) {
50 rspInfo = info;
51 parent_voice.notify(info.serial);
52 return ndk::ScopedAStatus::ok();
53 }
54
exitEmergencyCallbackModeResponse(const RadioResponseInfo & info)55 ndk::ScopedAStatus RadioVoiceResponse::exitEmergencyCallbackModeResponse(
56 const RadioResponseInfo& info) {
57 rspInfo = info;
58 parent_voice.notify(info.serial);
59 return ndk::ScopedAStatus::ok();
60 }
61
explicitCallTransferResponse(const RadioResponseInfo & info)62 ndk::ScopedAStatus RadioVoiceResponse::explicitCallTransferResponse(const RadioResponseInfo& info) {
63 rspInfo = info;
64 parent_voice.notify(info.serial);
65 return ndk::ScopedAStatus::ok();
66 }
67
getCallForwardStatusResponse(const RadioResponseInfo & info,const std::vector<CallForwardInfo> &)68 ndk::ScopedAStatus RadioVoiceResponse::getCallForwardStatusResponse(
69 const RadioResponseInfo& info, const std::vector<CallForwardInfo>& /*callForwardInfos*/) {
70 rspInfo = info;
71 parent_voice.notify(info.serial);
72 return ndk::ScopedAStatus::ok();
73 }
74
getCallWaitingResponse(const RadioResponseInfo & info,bool,int32_t)75 ndk::ScopedAStatus RadioVoiceResponse::getCallWaitingResponse(const RadioResponseInfo& info,
76 bool /*enable*/,
77 int32_t /*serviceClass*/) {
78 rspInfo = info;
79 parent_voice.notify(info.serial);
80 return ndk::ScopedAStatus::ok();
81 }
82
getClipResponse(const RadioResponseInfo & info,ClipStatus)83 ndk::ScopedAStatus RadioVoiceResponse::getClipResponse(const RadioResponseInfo& info,
84 ClipStatus /*status*/) {
85 rspInfo = info;
86 parent_voice.notify(info.serial);
87 return ndk::ScopedAStatus::ok();
88 }
89
getClirResponse(const RadioResponseInfo & info,int32_t,int32_t)90 ndk::ScopedAStatus RadioVoiceResponse::getClirResponse(const RadioResponseInfo& info, int32_t /*n*/,
91 int32_t /*m*/) {
92 rspInfo = info;
93 parent_voice.notify(info.serial);
94 return ndk::ScopedAStatus::ok();
95 }
96
getCurrentCallsResponse(const RadioResponseInfo & info,const std::vector<Call> & calls)97 ndk::ScopedAStatus RadioVoiceResponse::getCurrentCallsResponse(const RadioResponseInfo& info,
98 const std::vector<Call>& calls) {
99 rspInfo = info;
100 currentCalls = calls;
101 parent_voice.notify(info.serial);
102 return ndk::ScopedAStatus::ok();
103 }
104
getLastCallFailCauseResponse(const RadioResponseInfo & info,const LastCallFailCauseInfo &)105 ndk::ScopedAStatus RadioVoiceResponse::getLastCallFailCauseResponse(
106 const RadioResponseInfo& info, const LastCallFailCauseInfo& /*failCauseInfo*/) {
107 rspInfo = info;
108 parent_voice.notify(info.serial);
109 return ndk::ScopedAStatus::ok();
110 }
111
getMuteResponse(const RadioResponseInfo & info,bool)112 ndk::ScopedAStatus RadioVoiceResponse::getMuteResponse(const RadioResponseInfo& info,
113 bool /*enable*/) {
114 rspInfo = info;
115 parent_voice.notify(info.serial);
116 return ndk::ScopedAStatus::ok();
117 }
118
getPreferredVoicePrivacyResponse(const RadioResponseInfo & info,bool)119 ndk::ScopedAStatus RadioVoiceResponse::getPreferredVoicePrivacyResponse(
120 const RadioResponseInfo& info, bool /*enable*/) {
121 rspInfo = info;
122 parent_voice.notify(info.serial);
123 return ndk::ScopedAStatus::ok();
124 }
125
getTtyModeResponse(const RadioResponseInfo & info,TtyMode)126 ndk::ScopedAStatus RadioVoiceResponse::getTtyModeResponse(const RadioResponseInfo& info,
127 TtyMode /*mode*/) {
128 rspInfo = info;
129 parent_voice.notify(info.serial);
130 return ndk::ScopedAStatus::ok();
131 }
132
handleStkCallSetupRequestFromSimResponse(const RadioResponseInfo & info)133 ndk::ScopedAStatus RadioVoiceResponse::handleStkCallSetupRequestFromSimResponse(
134 const RadioResponseInfo& info) {
135 rspInfo = info;
136 parent_voice.notify(info.serial);
137 return ndk::ScopedAStatus::ok();
138 }
139
hangupConnectionResponse(const RadioResponseInfo & info)140 ndk::ScopedAStatus RadioVoiceResponse::hangupConnectionResponse(const RadioResponseInfo& info) {
141 rspInfo = info;
142 parent_voice.notify(info.serial);
143 return ndk::ScopedAStatus::ok();
144 }
145
hangupForegroundResumeBackgroundResponse(const RadioResponseInfo & info)146 ndk::ScopedAStatus RadioVoiceResponse::hangupForegroundResumeBackgroundResponse(
147 const RadioResponseInfo& info) {
148 rspInfo = info;
149 parent_voice.notify(info.serial);
150 return ndk::ScopedAStatus::ok();
151 }
152
hangupWaitingOrBackgroundResponse(const RadioResponseInfo & info)153 ndk::ScopedAStatus RadioVoiceResponse::hangupWaitingOrBackgroundResponse(
154 const RadioResponseInfo& info) {
155 rspInfo = info;
156 parent_voice.notify(info.serial);
157 return ndk::ScopedAStatus::ok();
158 }
159
isVoNrEnabledResponse(const RadioResponseInfo & info,bool)160 ndk::ScopedAStatus RadioVoiceResponse::isVoNrEnabledResponse(const RadioResponseInfo& info,
161 bool /*enabled*/) {
162 rspInfo = info;
163 parent_voice.notify(info.serial);
164 return ndk::ScopedAStatus::ok();
165 }
166
rejectCallResponse(const RadioResponseInfo & info)167 ndk::ScopedAStatus RadioVoiceResponse::rejectCallResponse(const RadioResponseInfo& info) {
168 rspInfo = info;
169 parent_voice.notify(info.serial);
170 return ndk::ScopedAStatus::ok();
171 }
172
sendBurstDtmfResponse(const RadioResponseInfo & info)173 ndk::ScopedAStatus RadioVoiceResponse::sendBurstDtmfResponse(const RadioResponseInfo& info) {
174 rspInfo = info;
175 parent_voice.notify(info.serial);
176 return ndk::ScopedAStatus::ok();
177 }
178
sendCdmaFeatureCodeResponse(const RadioResponseInfo & info)179 ndk::ScopedAStatus RadioVoiceResponse::sendCdmaFeatureCodeResponse(const RadioResponseInfo& info) {
180 rspInfo = info;
181 parent_voice.notify(info.serial);
182 return ndk::ScopedAStatus::ok();
183 }
184
sendDtmfResponse(const RadioResponseInfo & info)185 ndk::ScopedAStatus RadioVoiceResponse::sendDtmfResponse(const RadioResponseInfo& info) {
186 rspInfo = info;
187 parent_voice.notify(info.serial);
188 return ndk::ScopedAStatus::ok();
189 }
190
sendUssdResponse(const RadioResponseInfo & info)191 ndk::ScopedAStatus RadioVoiceResponse::sendUssdResponse(const RadioResponseInfo& info) {
192 rspInfo = info;
193 parent_voice.notify(info.serial);
194 return ndk::ScopedAStatus::ok();
195 }
196
separateConnectionResponse(const RadioResponseInfo & info)197 ndk::ScopedAStatus RadioVoiceResponse::separateConnectionResponse(const RadioResponseInfo& info) {
198 rspInfo = info;
199 parent_voice.notify(info.serial);
200 return ndk::ScopedAStatus::ok();
201 }
202
setCallForwardResponse(const RadioResponseInfo & info)203 ndk::ScopedAStatus RadioVoiceResponse::setCallForwardResponse(const RadioResponseInfo& info) {
204 rspInfo = info;
205 parent_voice.notify(info.serial);
206 return ndk::ScopedAStatus::ok();
207 }
208
setCallWaitingResponse(const RadioResponseInfo & info)209 ndk::ScopedAStatus RadioVoiceResponse::setCallWaitingResponse(const RadioResponseInfo& info) {
210 rspInfo = info;
211 parent_voice.notify(info.serial);
212 return ndk::ScopedAStatus::ok();
213 }
214
setClirResponse(const RadioResponseInfo & info)215 ndk::ScopedAStatus RadioVoiceResponse::setClirResponse(const RadioResponseInfo& info) {
216 rspInfo = info;
217 parent_voice.notify(info.serial);
218 return ndk::ScopedAStatus::ok();
219 }
220
setMuteResponse(const RadioResponseInfo & info)221 ndk::ScopedAStatus RadioVoiceResponse::setMuteResponse(const RadioResponseInfo& info) {
222 rspInfo = info;
223 parent_voice.notify(info.serial);
224 return ndk::ScopedAStatus::ok();
225 }
226
setPreferredVoicePrivacyResponse(const RadioResponseInfo & info)227 ndk::ScopedAStatus RadioVoiceResponse::setPreferredVoicePrivacyResponse(
228 const RadioResponseInfo& info) {
229 rspInfo = info;
230 parent_voice.notify(info.serial);
231 return ndk::ScopedAStatus::ok();
232 }
233
setTtyModeResponse(const RadioResponseInfo & info)234 ndk::ScopedAStatus RadioVoiceResponse::setTtyModeResponse(const RadioResponseInfo& info) {
235 rspInfo = info;
236 parent_voice.notify(info.serial);
237 return ndk::ScopedAStatus::ok();
238 }
239
setVoNrEnabledResponse(const RadioResponseInfo & info)240 ndk::ScopedAStatus RadioVoiceResponse::setVoNrEnabledResponse(const RadioResponseInfo& info) {
241 rspInfo = info;
242 parent_voice.notify(info.serial);
243 return ndk::ScopedAStatus::ok();
244 }
245
startDtmfResponse(const RadioResponseInfo & info)246 ndk::ScopedAStatus RadioVoiceResponse::startDtmfResponse(const RadioResponseInfo& info) {
247 rspInfo = info;
248 parent_voice.notify(info.serial);
249 return ndk::ScopedAStatus::ok();
250 }
251
stopDtmfResponse(const RadioResponseInfo & info)252 ndk::ScopedAStatus RadioVoiceResponse::stopDtmfResponse(const RadioResponseInfo& info) {
253 rspInfo = info;
254 parent_voice.notify(info.serial);
255 return ndk::ScopedAStatus::ok();
256 }
257
switchWaitingOrHoldingAndActiveResponse(const RadioResponseInfo & info)258 ndk::ScopedAStatus RadioVoiceResponse::switchWaitingOrHoldingAndActiveResponse(
259 const RadioResponseInfo& info) {
260 rspInfo = info;
261 parent_voice.notify(info.serial);
262 return ndk::ScopedAStatus::ok();
263 }
264