1 /*
2 * Copyright (c) 2022 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16 #include "print_service_stub.h"
17 #include "ipc_skeleton.h"
18 #include "iprint_service.h"
19 #include "message_parcel.h"
20 #include "print_constant.h"
21 #include "print_extension_info.h"
22 #include "print_job.h"
23 #include "print_log.h"
24
25 namespace OHOS::Print {
26 using namespace OHOS::HiviewDFX;
27
PrintServiceStub()28 PrintServiceStub::PrintServiceStub()
29 {
30 cmdMap_[OHOS::Print::IPrintInterfaceCode::CMD_START_PRINT] = &PrintServiceStub::OnStartPrint;
31 cmdMap_[OHOS::Print::IPrintInterfaceCode::CMD_STOP_PRINT] = &PrintServiceStub::OnStopPrint;
32 cmdMap_[OHOS::Print::IPrintInterfaceCode::CMD_CONNECTPRINTER] = &PrintServiceStub::OnConnectPrinter;
33 cmdMap_[OHOS::Print::IPrintInterfaceCode::CMD_DISCONNECTPRINTER] = &PrintServiceStub::OnDisconnectPrinter;
34 cmdMap_[OHOS::Print::IPrintInterfaceCode::CMD_STARTDISCOVERPRINTER] = &PrintServiceStub::OnStartDiscoverPrinter;
35 cmdMap_[OHOS::Print::IPrintInterfaceCode::CMD_STOPDISCOVERPRINTER] = &PrintServiceStub::OnStopDiscoverPrint;
36 cmdMap_[OHOS::Print::IPrintInterfaceCode::CMD_QUERYALLEXTENSION] = &PrintServiceStub::OnQueryAllExtension;
37 cmdMap_[OHOS::Print::IPrintInterfaceCode::CMD_STARTPRINTJOB] = &PrintServiceStub::OnStartPrintJob;
38 cmdMap_[OHOS::Print::IPrintInterfaceCode::CMD_CANCELPRINTJOB] = &PrintServiceStub::OnCancelPrintJob;
39 cmdMap_[OHOS::Print::IPrintInterfaceCode::CMD_ADDPRINTERS] = &PrintServiceStub::OnAddPrinters;
40 cmdMap_[OHOS::Print::IPrintInterfaceCode::CMD_REMOVEPRINTERS] = &PrintServiceStub::OnRemovePrinters;
41 cmdMap_[OHOS::Print::IPrintInterfaceCode::CMD_UPDATEPRINTERS] = &PrintServiceStub::OnUpdatePrinters;
42 cmdMap_[OHOS::Print::IPrintInterfaceCode::CMD_UPDATEPRINTERSTATE] = &PrintServiceStub::OnUpdatePrinterState;
43 cmdMap_[OHOS::Print::IPrintInterfaceCode::CMD_UPDATEPRINTJOBSTATE_FORNORMALAPP] =
44 &PrintServiceStub::OnUpdatePrintJobStateForNormalApp;
45 cmdMap_[OHOS::Print::IPrintInterfaceCode::CMD_UPDATEPRINTJOBSTATE_FORSYSTEMAPP] =
46 &PrintServiceStub::OnUpdatePrintJobStateOnlyForSystemApp;
47 cmdMap_[OHOS::Print::IPrintInterfaceCode::CMD_UPDATEEXTENSIONINFO] = &PrintServiceStub::OnUpdateExtensionInfo;
48 cmdMap_[OHOS::Print::IPrintInterfaceCode::CMD_REQUESTPREVIEW] = &PrintServiceStub::OnRequestPreview;
49 cmdMap_[OHOS::Print::IPrintInterfaceCode::CMD_QUERYPRINTERCAPABILITY] =
50 &PrintServiceStub::OnQueryPrinterCapability;
51 cmdMap_[OHOS::Print::IPrintInterfaceCode::CMD_ON] = &PrintServiceStub::OnEventOn;
52 cmdMap_[OHOS::Print::IPrintInterfaceCode::CMD_OFF] = &PrintServiceStub::OnEventOff;
53 cmdMap_[OHOS::Print::IPrintInterfaceCode::CMD_REG_EXT_CB] = &PrintServiceStub::OnRegisterExtCallback;
54 cmdMap_[OHOS::Print::IPrintInterfaceCode::CMD_UNREG_EXT_CB] = &PrintServiceStub::OnUnregisterAllExtCallback;
55 cmdMap_[OHOS::Print::IPrintInterfaceCode::CMD_LOAD_EXT] = &PrintServiceStub::OnLoadExtSuccess;
56 cmdMap_[OHOS::Print::IPrintInterfaceCode::CMD_QUERYALLACTIVEPRINTJOB] = &PrintServiceStub::OnQueryAllActivePrintJob;
57 cmdMap_[OHOS::Print::IPrintInterfaceCode::CMD_QUERYALLPRINTJOB] =
58 &PrintServiceStub::OnQueryAllPrintJob;
59 cmdMap_[OHOS::Print::IPrintInterfaceCode::CMD_QUERYPRINTJOBBYID] = &PrintServiceStub::OnQueryPrintJobById;
60 cmdMap_[OHOS::Print::IPrintInterfaceCode::CMD_ADDPRINTERTOCUPS] = &PrintServiceStub::OnAddPrinterToCups;
61 cmdMap_[OHOS::Print::IPrintInterfaceCode::CMD_QUERYPRINTERCAPABILITYBYURI] =
62 &PrintServiceStub::OnQueryPrinterCapabilityByUri;
63 cmdMap_[OHOS::Print::IPrintInterfaceCode::CMD_STARTPRINTJOB_BY_ADAPTER] = &PrintServiceStub::OnPrintByAdapter;
64 cmdMap_[OHOS::Print::IPrintInterfaceCode::CMD_START_GET_FILE] = &PrintServiceStub::OnStartGetPrintFile;
65 cmdMap_[OHOS::Print::IPrintInterfaceCode::CMD_NOTIFY_PRINT_SERVICE] = &PrintServiceStub::OnNotifyPrintService;
66 cmdMap_[OHOS::Print::IPrintInterfaceCode::CMD_START_SERVICE] = &PrintServiceStub::OnStartService;
67 cmdMap_[OHOS::Print::IPrintInterfaceCode::CMD_REG_PRINTER_CB] = &PrintServiceStub::OnRegisterPrinterCallback;
68 cmdMap_[OHOS::Print::IPrintInterfaceCode::CMD_UNREG_PRINTER_CB] = &PrintServiceStub::OnUnregisterPrinterCallback;
69 cmdMap_[OHOS::Print::IPrintInterfaceCode::CMD_QUERYPRINTERINFOBYPRINTERID] =
70 &PrintServiceStub::OnQueryPrinterInfoByPrinterId;
71 cmdMap_[OHOS::Print::IPrintInterfaceCode::CMD_QUERYADDEDPRINTER] = &PrintServiceStub::OnQueryAddedPrinter;
72 cmdMap_[OHOS::Print::IPrintInterfaceCode::CMD_QUERYPRINTERPROPERTIES] =
73 &PrintServiceStub::OnQueryPrinterProperties;
74 cmdMap_[OHOS::Print::IPrintInterfaceCode::CMD_STARTNATIVEPRINTJOB] = &PrintServiceStub::OnStartNativePrintJob;
75 cmdMap_[OHOS::Print::IPrintInterfaceCode::CMD_NOTIFY_PRINT_SERVICE_EVENT] =
76 &PrintServiceStub::OnNotifyPrintServiceEvent;
77 cmdMap_[OHOS::Print::IPrintInterfaceCode::CMD_SET_PRINTER_PREFERENCE] =
78 &PrintServiceStub::OnSetPrinterPreference;
79 cmdMap_[OHOS::Print::IPrintInterfaceCode::CMD_SET_DEFAULT_PRINTERID] = &PrintServiceStub::OnSetDefaultPrinter;
80 cmdMap_[OHOS::Print::IPrintInterfaceCode::CMD_DELETE_PRINTER_FROM_CUPS] =
81 &PrintServiceStub::OnDeletePrinterFromCups;
82 cmdMap_[OHOS::Print::IPrintInterfaceCode::CMD_DISCOVER_USB_PRINTERS] = &PrintServiceStub::OnDiscoverUsbPrinters;
83 cmdMap_[OHOS::Print::IPrintInterfaceCode::CMD_ADDPRINTERTODISCOVERY] = &PrintServiceStub::OnAddPrinterToDiscovery;
84 cmdMap_[OHOS::Print::IPrintInterfaceCode::CMD_UPDATEPRINTERINDISCOVERY] =
85 &PrintServiceStub::OnUpdatePrinterInDiscovery;
86 cmdMap_[OHOS::Print::IPrintInterfaceCode::CMD_REMOVEPRINTERFROMDISCOVERY] =
87 &PrintServiceStub::OnRemovePrinterFromDiscovery;
88 cmdMap_[OHOS::Print::IPrintInterfaceCode::CMD_UPDATEPRINTERINSYSTEM] =
89 &PrintServiceStub::OnUpdatePrinterInSystem;
90 cmdMap_[OHOS::Print::IPrintInterfaceCode::CMD_RESTARTPRINTJOB] = &PrintServiceStub::OnRestartPrintJob;
91 }
92
OnRemoteRequest(uint32_t code,MessageParcel & data,MessageParcel & reply,MessageOption & option)93 int32_t PrintServiceStub::OnRemoteRequest(
94 uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option)
95 {
96 PRINT_HILOGD("OnRemoteRequest started, code = %{public}d", code);
97 auto descriptorToken = data.ReadInterfaceToken();
98 if (descriptorToken != GetDescriptor()) {
99 PRINT_HILOGE("Remote descriptor not the same as local descriptor.");
100 return E_PRINT_RPC_FAILURE;
101 }
102
103 auto itFunc = cmdMap_.find(code);
104 if (itFunc != cmdMap_.end()) {
105 auto requestFunc = itFunc->second;
106 if (requestFunc != nullptr) {
107 bool result = (this->*requestFunc)(data, reply);
108 return result ? E_PRINT_NONE : E_PRINT_GENERIC_FAILURE;
109 }
110 }
111 PRINT_HILOGW("default case, need check.");
112 return IPCObjectStub::OnRemoteRequest(code, data, reply, option);
113 }
114
OnStartService(MessageParcel & data,MessageParcel & reply)115 bool PrintServiceStub::OnStartService(MessageParcel &data, MessageParcel &reply)
116 {
117 PRINT_HILOGD("nativePrint PrintServiceStub::OnStartService in");
118 int32_t ret = E_PRINT_INVALID_PARAMETER;
119 if (data.ReadString() == "nativePrint") {
120 ret = StartService();
121 reply.WriteInt32(ret);
122 PRINT_HILOGI("nativePrint PrintServiceStub::OnStartService out:%{public}d", ret);
123 }
124 return ret == E_PRINT_NONE;
125 }
126
OnStartPrint(MessageParcel & data,MessageParcel & reply)127 bool PrintServiceStub::OnStartPrint(MessageParcel &data, MessageParcel &reply)
128 {
129 PRINT_HILOGI("PrintServiceStub::OnStartPrint in");
130 std::vector<std::string> fileList;
131 std::vector<uint32_t> fdList;
132
133 if (data.ReadBool()) {
134 data.ReadStringVector(&fileList);
135 PRINT_HILOGD("Current file is %{public}zd", fileList.size());
136 if (fileList.size() > PRINT_MAX_PRINT_COUNT) {
137 PRINT_HILOGE("fileList'size is out of range.");
138 reply.WriteInt32(E_PRINT_INVALID_PARAMETER);
139 return false;
140 }
141 }
142
143 if (data.ReadBool()) {
144 int32_t len = data.ReadInt32();
145 if (len > PRINT_MAX_PRINT_COUNT) {
146 PRINT_HILOGE("len is out of range.");
147 reply.WriteInt32(E_PRINT_INVALID_PARAMETER);
148 return false;
149 }
150 for (int32_t index = 0; index < len; index++) {
151 uint32_t fd = static_cast<uint32_t>(data.ReadFileDescriptor());
152 PRINT_HILOGD("fdList[%{public}d] = %{public}d", index, fd);
153 fdList.emplace_back(fd);
154 }
155 }
156 std::string taskId = data.ReadString();
157 int32_t ret = StartPrint(fileList, fdList, taskId);
158 reply.WriteInt32(ret);
159 PRINT_HILOGD("PrintServiceStub::OnStartPrint out");
160 return ret == E_PRINT_NONE;
161 }
162
OnStopPrint(MessageParcel & data,MessageParcel & reply)163 bool PrintServiceStub::OnStopPrint(MessageParcel &data, MessageParcel &reply)
164 {
165 PRINT_HILOGI("PrintServiceStub::OnStopPrint in");
166 std::string taskId = data.ReadString();
167 int32_t ret = StopPrint(taskId);
168 reply.WriteInt32(ret);
169 PRINT_HILOGD("PrintServiceStub::OnStopPrint out");
170 return ret == E_PRINT_NONE;
171 }
172
OnConnectPrinter(MessageParcel & data,MessageParcel & reply)173 bool PrintServiceStub::OnConnectPrinter(MessageParcel &data, MessageParcel &reply)
174 {
175 PRINT_HILOGI("PrintServiceStub::OnConnectPrinter in");
176 int32_t ret = ConnectPrinter(data.ReadString());
177 reply.WriteInt32(ret);
178 PRINT_HILOGD("PrintServiceStub::OnConnectPrinter out");
179 return ret == E_PRINT_NONE;
180 }
181
OnDisconnectPrinter(MessageParcel & data,MessageParcel & reply)182 bool PrintServiceStub::OnDisconnectPrinter(MessageParcel &data, MessageParcel &reply)
183 {
184 PRINT_HILOGI("PrintServiceStub::OnDisconnectPrinter in");
185 int32_t ret = DisconnectPrinter(data.ReadString());
186 reply.WriteInt32(ret);
187 PRINT_HILOGD("PrintServiceStub::OnDisconnectPrinter out");
188 return ret == E_PRINT_NONE;
189 }
190
OnStartDiscoverPrinter(MessageParcel & data,MessageParcel & reply)191 bool PrintServiceStub::OnStartDiscoverPrinter(MessageParcel &data, MessageParcel &reply)
192 {
193 PRINT_HILOGI("PrintServiceStub::OnStartDiscoverPrinter in");
194 std::vector<std::string> extensionList;
195 data.ReadStringVector(&extensionList);
196 int32_t ret = StartDiscoverPrinter(extensionList);
197 reply.WriteInt32(ret);
198 PRINT_HILOGD("PrintServiceStub::OnStartDiscoverPrinter out");
199 return ret == E_PRINT_NONE;
200 }
201
OnStopDiscoverPrint(MessageParcel & data,MessageParcel & reply)202 bool PrintServiceStub::OnStopDiscoverPrint(MessageParcel &data, MessageParcel &reply)
203 {
204 PRINT_HILOGI("PrintServiceStub::OnStopDiscoverPrint in");
205 int32_t ret = StopDiscoverPrinter();
206 reply.WriteInt32(ret);
207 PRINT_HILOGD("PrintServiceStub::OnStopDiscoverPrint out");
208 return ret == E_PRINT_NONE;
209 }
210
OnQueryAllExtension(MessageParcel & data,MessageParcel & reply)211 bool PrintServiceStub::OnQueryAllExtension(MessageParcel &data, MessageParcel &reply)
212 {
213 PRINT_HILOGI("PrintServiceStub::OnQueryAllExtension in");
214 std::vector<PrintExtensionInfo> printerInfo;
215 int32_t ret = QueryAllExtension(printerInfo);
216 reply.WriteInt32(ret);
217 if (ret == E_PRINT_NONE) {
218 uint32_t size = static_cast<uint32_t>(printerInfo.size());
219 reply.WriteUint32(size);
220 for (uint32_t index = 0; index < size; index++) {
221 printerInfo[index].Marshalling(reply);
222 }
223 }
224 PRINT_HILOGD("PrintServiceStub::OnQueryAllExtension out");
225 return ret == E_PRINT_NONE;
226 }
227
OnStartPrintJob(MessageParcel & data,MessageParcel & reply)228 bool PrintServiceStub::OnStartPrintJob(MessageParcel &data, MessageParcel &reply)
229 {
230 PRINT_HILOGI("PrintServiceStub::OnStartPrintJob in");
231 int32_t ret = E_PRINT_RPC_FAILURE;
232 auto jobInfoPtr = PrintJob::Unmarshalling(data);
233 if (jobInfoPtr != nullptr) {
234 jobInfoPtr->Dump();
235 ret = StartPrintJob(*jobInfoPtr);
236 }
237 reply.WriteInt32(ret);
238 PRINT_HILOGD("PrintServiceStub::OnStartPrintJob out");
239 return ret == E_PRINT_NONE;
240 }
241
OnCancelPrintJob(MessageParcel & data,MessageParcel & reply)242 bool PrintServiceStub::OnCancelPrintJob(MessageParcel &data, MessageParcel &reply)
243 {
244 PRINT_HILOGI("PrintServiceStub::OnCancelPrintJob in");
245 int32_t ret = CancelPrintJob(data.ReadString());
246 reply.WriteInt32(ret);
247 PRINT_HILOGD("PrintServiceStub::OnCancelPrintJob out");
248 return ret == E_PRINT_NONE;
249 }
250
OnAddPrinters(MessageParcel & data,MessageParcel & reply)251 bool PrintServiceStub::OnAddPrinters(MessageParcel &data, MessageParcel &reply)
252 {
253 PRINT_HILOGI("PrintServiceStub::OnAddPrinters in");
254 std::vector<PrinterInfo> printerInfos;
255 uint32_t len = 0;
256 if (!data.ReadUint32(len)) {
257 PRINT_HILOGE("read data len failed.");
258 return false;
259 }
260 PRINT_HILOGD("OnStartDiscoverPrinter len = %{public}d", len);
261
262 if (len > PRINT_MAX_PRINT_COUNT) {
263 PRINT_HILOGE("len is out of range.");
264 reply.WriteInt32(E_PRINT_INVALID_PARAMETER);
265 return false;
266 }
267 for (uint32_t i = 0; i < len; i++) {
268 auto infoPtr = PrinterInfo::Unmarshalling(data);
269 if (infoPtr == nullptr) {
270 PRINT_HILOGW("invalid printer object");
271 continue;
272 }
273 infoPtr->Dump();
274 printerInfos.emplace_back(*infoPtr);
275 }
276 int32_t ret = E_PRINT_RPC_FAILURE;
277 if (printerInfos.size() > 0) {
278 ret = AddPrinters(printerInfos);
279 }
280 reply.WriteInt32(ret);
281 PRINT_HILOGD("PrintServiceStub::OnAddPrinters out");
282 return ret == E_PRINT_NONE;
283 }
284
OnQueryPrinterInfoByPrinterId(MessageParcel & data,MessageParcel & reply)285 bool PrintServiceStub::OnQueryPrinterInfoByPrinterId(MessageParcel &data, MessageParcel &reply)
286 {
287 PRINT_HILOGI("PrintServiceStub::OnQueryPrinterInfoByPrinterId in");
288 std::string printerId = data.ReadString();
289 PrinterInfo info;
290 int32_t ret = QueryPrinterInfoByPrinterId(printerId, info);
291 reply.WriteInt32(ret);
292 PRINT_HILOGI("PrintServiceStub::OnQueryPrinterInfoByPrinterId out %{private}s", info.GetPrinterName().c_str());
293 info.Marshalling(reply);
294 PRINT_HILOGI("PrintServiceStub::OnQueryPrinterInfoByPrinterId out");
295 return ret == E_PRINT_NONE;
296 }
297
OnSetPrinterPreference(MessageParcel & data,MessageParcel & reply)298 bool PrintServiceStub::OnSetPrinterPreference(MessageParcel &data, MessageParcel &reply)
299 {
300 PRINT_HILOGI("PrintServiceStub::OnSetPrinterPreference in");
301 std::string printerId = data.ReadString();
302 auto preferencesPtr = PrinterPreferences::Unmarshalling(data);
303 if (preferencesPtr == nullptr) {
304 PRINT_HILOGE("Failed to unmarshall printer preferences");
305 reply.WriteInt32(E_PRINT_RPC_FAILURE);
306 return false;
307 }
308
309 int32_t ret = SetPrinterPreference(printerId, *preferencesPtr);
310 reply.WriteInt32(ret);
311 return ret == E_PRINT_NONE;
312 }
313
OnQueryAddedPrinter(MessageParcel & data,MessageParcel & reply)314 bool PrintServiceStub::OnQueryAddedPrinter(MessageParcel &data, MessageParcel &reply)
315 {
316 PRINT_HILOGI("PrintServiceStub::OnQueryAddedPrinter in");
317 std::vector<std::string> printerNameList;
318
319 int32_t ret = QueryAddedPrinter(printerNameList);
320 reply.WriteInt32(ret);
321 reply.WriteStringVector(printerNameList);
322
323 PRINT_HILOGI("PrintServiceStub::OnQueryAddedPrinter out");
324 return ret == E_PRINT_NONE;
325 }
326
OnQueryPrinterProperties(MessageParcel & data,MessageParcel & reply)327 bool PrintServiceStub::OnQueryPrinterProperties(MessageParcel &data, MessageParcel &reply)
328 {
329 PRINT_HILOGI("PrintServiceStub::OnQueryAddedPrinter in");
330 std::string printerId = data.ReadString();
331 std::vector<std::string> keyList;
332 data.ReadStringVector(&keyList);
333 std::vector<std::string> valueList;
334 int32_t ret = QueryPrinterProperties(printerId, keyList, valueList);
335 reply.WriteInt32(ret);
336 reply.WriteStringVector(valueList);
337 PRINT_HILOGI("PrintServiceStub::OnQueryAddedPrinter out");
338 return ret == E_PRINT_NONE;
339 }
340
OnStartNativePrintJob(MessageParcel & data,MessageParcel & reply)341 bool PrintServiceStub::OnStartNativePrintJob(MessageParcel &data, MessageParcel &reply)
342 {
343 PRINT_HILOGI("PrintServiceStub::OnStartNativePrintJob in");
344 int32_t ret = E_PRINT_RPC_FAILURE;
345 auto printJobPtr = PrintJob::Unmarshalling(data);
346 if (printJobPtr != nullptr) {
347 printJobPtr->Dump();
348 ret = StartNativePrintJob(*printJobPtr);
349 }
350 reply.WriteInt32(ret);
351 PRINT_HILOGD("PrintServiceStub::OnStartPrintJob out");
352 return ret == E_PRINT_NONE;
353 }
354
OnRemovePrinters(MessageParcel & data,MessageParcel & reply)355 bool PrintServiceStub::OnRemovePrinters(MessageParcel &data, MessageParcel &reply)
356 {
357 PRINT_HILOGI("PrintServiceStub::OnRemovePrinters in");
358 std::vector<std::string> printerIds;
359 data.ReadStringVector(&printerIds);
360 PRINT_HILOGD("OnStartDiscoverPrinter len = %{public}zd", printerIds.size());
361
362 if (printerIds.size() > PRINT_MAX_PRINT_COUNT) {
363 PRINT_HILOGE("printerIds'size is out of range.");
364 reply.WriteInt32(E_PRINT_INVALID_PARAMETER);
365 return false;
366 }
367 int32_t ret = RemovePrinters(printerIds);
368 reply.WriteInt32(ret);
369
370 PRINT_HILOGD("PrintServiceStub::OnRemovePrinters out");
371 return ret == E_PRINT_NONE;
372 }
373
OnUpdatePrinters(MessageParcel & data,MessageParcel & reply)374 bool PrintServiceStub::OnUpdatePrinters(MessageParcel &data, MessageParcel &reply)
375 {
376 PRINT_HILOGI("PrintServiceStub::OnUpdatePrinters in");
377 std::vector<PrinterInfo> printerInfos;
378 uint32_t len = 0;
379 if (!data.ReadUint32(len)) {
380 PRINT_HILOGE("read data len failed.");
381 return false;
382 }
383 PRINT_HILOGD("OnUpdatePrinters len = %{public}d", len);
384
385 if (len > PRINT_MAX_PRINT_COUNT) {
386 PRINT_HILOGE("len is out of range.");
387 reply.WriteInt32(E_PRINT_INVALID_PARAMETER);
388 return false;
389 }
390 for (uint32_t i = 0; i < len; i++) {
391 auto infoPtr = PrinterInfo::Unmarshalling(data);
392 if (infoPtr == nullptr) {
393 PRINT_HILOGW("invalid printer object");
394 continue;
395 }
396 infoPtr->Dump();
397 printerInfos.emplace_back(*infoPtr);
398 }
399 int32_t ret = E_PRINT_RPC_FAILURE;
400 if (printerInfos.size() > 0) {
401 ret = UpdatePrinters(printerInfos);
402 }
403 reply.WriteInt32(ret);
404 PRINT_HILOGD("PrintServiceStub::OnUpdatePrinters out");
405 return ret == E_PRINT_NONE;
406 }
407
OnUpdatePrinterState(MessageParcel & data,MessageParcel & reply)408 bool PrintServiceStub::OnUpdatePrinterState(MessageParcel &data, MessageParcel &reply)
409 {
410 PRINT_HILOGI("PrintServiceStub::OnUpdatePrinterState in");
411 std::string printerId = data.ReadString();
412 uint32_t state = data.ReadUint32();
413 int32_t ret = UpdatePrinterState(printerId, state);
414 reply.WriteInt32(ret);
415 PRINT_HILOGD("PrintServiceStub::OnUpdatePrinterState out");
416 return ret == E_PRINT_NONE;
417 }
418
OnUpdatePrintJobStateForNormalApp(MessageParcel & data,MessageParcel & reply)419 bool PrintServiceStub::OnUpdatePrintJobStateForNormalApp(MessageParcel &data, MessageParcel &reply)
420 {
421 PRINT_HILOGI("PrintServiceStub::OnUpdatePrintJobStateForNormalApp in");
422 std::string jobId = data.ReadString();
423 uint32_t state = data.ReadUint32();
424 uint32_t subState = data.ReadUint32();
425 PRINT_HILOGD("jobId = %{public}s; state = %{public}d; subState = %{public}d",
426 jobId.c_str(), state, subState);
427 int32_t ret = UpdatePrintJobStateForNormalApp(jobId, state, subState);
428 reply.WriteInt32(ret);
429 PRINT_HILOGD("PrintServiceStub::OnUpdatePrintJobStateForNormalApp out");
430 return ret == E_PRINT_NONE;
431 }
432
OnUpdatePrintJobStateOnlyForSystemApp(MessageParcel & data,MessageParcel & reply)433 bool PrintServiceStub::OnUpdatePrintJobStateOnlyForSystemApp(MessageParcel &data, MessageParcel &reply)
434 {
435 PRINT_HILOGI("PrintServiceStub::OnUpdatePrintJobStateOnlyForSystemApp in");
436 std::string jobId = data.ReadString();
437 uint32_t state = data.ReadUint32();
438 uint32_t subState = data.ReadUint32();
439 PRINT_HILOGD("OnUpdatePrintJobStateOnlyForSystemApp jobId = %{public}s", jobId.c_str());
440 PRINT_HILOGD("OnUpdatePrintJobStateOnlyForSystemApp state = %{public}d", state);
441 PRINT_HILOGD("OnUpdatePrintJobStateOnlyForSystemApp subState = %{public}d", subState);
442
443 int32_t ret = UpdatePrintJobStateOnlyForSystemApp(jobId, state, subState);
444 reply.WriteInt32(ret);
445 PRINT_HILOGD("PrintServiceStub::OnUpdatePrintJobStateOnlyForSystemApp out");
446 return ret == E_PRINT_NONE;
447 }
448
OnUpdateExtensionInfo(MessageParcel & data,MessageParcel & reply)449 bool PrintServiceStub::OnUpdateExtensionInfo(MessageParcel &data, MessageParcel &reply)
450 {
451 PRINT_HILOGI("PrintServiceStub::OnUpdateExtensionInfo in");
452 std::string extInfo = data.ReadString();
453 PRINT_HILOGD("OnUpdateExtensionInfo extInfo = %{public}s", extInfo.c_str());
454
455 int32_t ret = UpdateExtensionInfo(extInfo);
456 reply.WriteInt32(ret);
457 PRINT_HILOGD("PrintServiceStub::OnUpdateExtensionInfo out");
458 return ret == E_PRINT_NONE;
459 }
460
OnRequestPreview(MessageParcel & data,MessageParcel & reply)461 bool PrintServiceStub::OnRequestPreview(MessageParcel &data, MessageParcel &reply)
462 {
463 PRINT_HILOGI("PrintServiceStub::OnRequestPreview in");
464 int32_t ret = E_PRINT_RPC_FAILURE;
465 std::string previewResult = "";
466 auto jobInfoPtr = PrintJob::Unmarshalling(data);
467 if (jobInfoPtr != nullptr) {
468 jobInfoPtr->Dump();
469 ret = RequestPreview(*jobInfoPtr, previewResult);
470 }
471 reply.WriteInt32(ret);
472 reply.WriteString(previewResult);
473 PRINT_HILOGD("PrintServiceStub::OnRequestPreview out");
474 return ret == E_PRINT_NONE;
475 }
476
OnQueryPrinterCapability(MessageParcel & data,MessageParcel & reply)477 bool PrintServiceStub::OnQueryPrinterCapability(MessageParcel &data, MessageParcel &reply)
478 {
479 PRINT_HILOGI("PrintServiceStub::OnQueryPrinterCapability in");
480 std::string printerId = data.ReadString();
481 PRINT_HILOGD("printerId : %{private}s", printerId.c_str());
482 int32_t ret = QueryPrinterCapability(printerId);
483 reply.WriteInt32(ret);
484 PRINT_HILOGD("PrintServiceStub::OnQueryPrinterCapability out");
485 return ret == E_PRINT_NONE;
486 }
487
OnQueryAllActivePrintJob(MessageParcel & data,MessageParcel & reply)488 bool PrintServiceStub::OnQueryAllActivePrintJob(MessageParcel &data, MessageParcel &reply)
489 {
490 PRINT_HILOGI("PrintServiceStub::OnQueryAllActivePrintJob in");
491 std::vector<PrintJob> printJob;
492 printJob.clear();
493 int32_t ret = QueryAllActivePrintJob(printJob);
494 reply.WriteInt32(ret);
495 if (ret == E_PRINT_NONE) {
496 uint32_t size = static_cast<uint32_t>(printJob.size());
497 reply.WriteUint32(size);
498 for (uint32_t index = 0; index < size; index++) {
499 printJob[index].Marshalling(reply);
500 }
501 }
502 PRINT_HILOGD("PrintServiceStub::OnQueryAllActivePrintJob out");
503 return ret == E_PRINT_NONE;
504 }
505
OnQueryAllPrintJob(MessageParcel & data,MessageParcel & reply)506 bool PrintServiceStub::OnQueryAllPrintJob(MessageParcel &data, MessageParcel &reply)
507 {
508 PRINT_HILOGI("PrintServiceStub::OnQueryAllPrintJob in");
509 std::vector<PrintJob> printJob;
510 printJob.clear();
511 int32_t ret = QueryAllPrintJob(printJob);
512 reply.WriteInt32(ret);
513 if (ret == E_PRINT_NONE) {
514 uint32_t size = static_cast<uint32_t>(printJob.size());
515 reply.WriteUint32(size);
516 for (uint32_t index = 0; index < size; index++) {
517 printJob[index].Marshalling(reply);
518 }
519 }
520 PRINT_HILOGD("PrintServiceStub::OnQueryAllPrintJob out");
521 return ret == E_PRINT_NONE;
522 }
523
OnQueryPrintJobById(MessageParcel & data,MessageParcel & reply)524 bool PrintServiceStub::OnQueryPrintJobById(MessageParcel &data, MessageParcel &reply)
525 {
526 PRINT_HILOGI("PrintServiceStub::OnQueryPrintJobById in");
527 PrintJob printJob;
528 std::string printJobId = data.ReadString();
529 int32_t ret = QueryPrintJobById(printJobId, printJob);
530 reply.WriteInt32(ret);
531 printJob.Marshalling(reply);
532 PRINT_HILOGD("PrintServiceStub::OnQueryPrintJobById out");
533 return ret == E_PRINT_NONE;
534 }
535
OnAddPrinterToCups(MessageParcel & data,MessageParcel & reply)536 bool PrintServiceStub::OnAddPrinterToCups(MessageParcel &data, MessageParcel &reply)
537 {
538 PRINT_HILOGI("PrintServiceStub::OnAddPrinterToCups in");
539 std::string printerUri = data.ReadString();
540 std::string printerName = data.ReadString();
541 std::string printerMake = data.ReadString();
542 int32_t ret = AddPrinterToCups(printerUri, printerName, printerMake);
543 reply.WriteInt32(ret);
544 PRINT_HILOGD("PrintServiceStub::OnAddPrinterToCups out");
545 return ret == E_PRINT_NONE;
546 }
547
OnQueryPrinterCapabilityByUri(MessageParcel & data,MessageParcel & reply)548 bool PrintServiceStub::OnQueryPrinterCapabilityByUri(MessageParcel &data, MessageParcel &reply)
549 {
550 PRINT_HILOGI("PrintServiceStub::OnQueryPrinterCapabilityByUri in");
551 PrinterCapability printerCaps;
552 std::string printerUri = data.ReadString();
553 std::string printerId = data.ReadString();
554 int32_t ret = QueryPrinterCapabilityByUri(printerUri, printerId, printerCaps);
555 reply.WriteInt32(ret);
556 printerCaps.Marshalling(reply);
557 PRINT_HILOGD("PrintServiceStub::OnQueryPrinterCapabilityByUri out");
558 return ret == E_PRINT_NONE;
559 }
560
OnNotifyPrintServiceEvent(MessageParcel & data,MessageParcel & reply)561 bool PrintServiceStub::OnNotifyPrintServiceEvent(MessageParcel &data, MessageParcel &reply)
562 {
563 PRINT_HILOGI("PrintServiceStub::OnNotifyPrintServiceEvent in");
564 std::string jobId = data.ReadString();
565 uint32_t event = data.ReadUint32();
566 PRINT_HILOGD("OnNotifyPrintServiceEvent jobId = %{public}s, event = %{public}d", jobId.c_str(), event);
567 int32_t ret = NotifyPrintServiceEvent(jobId, event);
568 reply.WriteInt32(ret);
569 PRINT_HILOGD("PrintServiceStub::OnNotifyPrintServiceEvent out");
570 return ret == E_PRINT_NONE;
571 }
572
OnSetDefaultPrinter(MessageParcel & data,MessageParcel & reply)573 bool PrintServiceStub::OnSetDefaultPrinter(MessageParcel &data, MessageParcel &reply)
574 {
575 PRINT_HILOGI("PrintServiceStub::OnSetDefaultPrinter in");
576 std::string printerId = data.ReadString();
577 uint32_t type = data.ReadUint32();
578 int32_t ret = SetDefaultPrinter(printerId, type);
579 reply.WriteInt32(ret);
580 PRINT_HILOGD("PrintServiceStub::OnSetDefaultPrinter out");
581 return ret == E_PRINT_NONE;
582 }
583
OnDeletePrinterFromCups(MessageParcel & data,MessageParcel & reply)584 bool PrintServiceStub::OnDeletePrinterFromCups(MessageParcel &data, MessageParcel &reply)
585 {
586 PRINT_HILOGI("PrintServiceStub::OnDeletePrinterFromCups in");
587 std::string printerName = data.ReadString();
588 int32_t ret = DeletePrinterFromCups(printerName);
589 reply.WriteInt32(ret);
590 PRINT_HILOGD("PrintServiceStub::OnDeletePrinterFromCups out");
591 return ret == E_PRINT_NONE;
592 }
593
OnDiscoverUsbPrinters(MessageParcel & data,MessageParcel & reply)594 bool PrintServiceStub::OnDiscoverUsbPrinters(MessageParcel &data, MessageParcel &reply)
595 {
596 PRINT_HILOGI("PrintServiceStub::OnDiscoverUsbPrinters in");
597 std::vector<PrinterInfo> printers;
598 int32_t ret = DiscoverUsbPrinters(printers);
599 reply.WriteInt32(ret);
600 if (ret == E_PRINT_NONE) {
601 uint32_t size = static_cast<uint32_t>(printers.size());
602 reply.WriteUint32(size);
603 for (uint32_t index = 0; index < size; index++) {
604 printers[index].Marshalling(reply);
605 }
606 }
607 PRINT_HILOGD("PrintServiceStub::OnDiscoverUsbPrinters out");
608 return ret == E_PRINT_NONE;
609 }
610
OnEventOn(MessageParcel & data,MessageParcel & reply)611 bool PrintServiceStub::OnEventOn(MessageParcel &data, MessageParcel &reply)
612 {
613 std::string taskId = data.ReadString();
614 std::string type = data.ReadString();
615 PRINT_HILOGI("PrintServiceStub::OnEventOn type=%{public}s ", type.c_str());
616 if (type.empty()) {
617 PRINT_HILOGE("PrintServiceStub::OnEventOn type is null.");
618 reply.WriteInt32(E_PRINT_RPC_FAILURE);
619 return false;
620 }
621 sptr<IRemoteObject> remote = data.ReadRemoteObject();
622 if (remote == nullptr) {
623 PRINT_HILOGE("PrintServiceStub::OnEventOn remote is nullptr");
624 reply.WriteInt32(E_PRINT_RPC_FAILURE);
625 return false;
626 }
627 sptr<IPrintCallback> listener = iface_cast<IPrintCallback>(remote);
628 if (listener.GetRefPtr() == nullptr) {
629 PRINT_HILOGE("PrintServiceStub::OnEventOn listener is null");
630 reply.WriteInt32(E_PRINT_RPC_FAILURE);
631 return false;
632 }
633 int32_t ret = On(taskId, type, listener);
634 reply.WriteInt32(ret);
635 PRINT_HILOGD("PrintServiceStub::OnEventOn out");
636 return ret == E_PRINT_NONE;
637 }
638
OnEventOff(MessageParcel & data,MessageParcel & reply)639 bool PrintServiceStub::OnEventOff(MessageParcel &data, MessageParcel &reply)
640 {
641 PRINT_HILOGD("PrintServiceStub::OnEventOff in");
642 std::string taskId = data.ReadString();
643 std::string type = data.ReadString();
644 PRINT_HILOGI("PrintServiceStub::OnEventOff type=%{public}s ", type.c_str());
645 int32_t ret = Off(taskId, type);
646 reply.WriteInt32(ret);
647 PRINT_HILOGD("PrintServiceStub::OnEventOff out");
648 return ret == E_PRINT_NONE;
649 }
650
OnRegisterPrinterCallback(MessageParcel & data,MessageParcel & reply)651 bool PrintServiceStub::OnRegisterPrinterCallback(MessageParcel &data, MessageParcel &reply)
652 {
653 std::string type = data.ReadString();
654 if (type.empty()) {
655 PRINT_HILOGE("PrintServiceStub::OnEventOn type is null.");
656 reply.WriteInt32(E_PRINT_RPC_FAILURE);
657 return false;
658 }
659 PRINT_HILOGI("PrintServiceStub::OnRegisterPrinterCallback type=%{public}s ", type.c_str());
660 sptr<IRemoteObject> remote = data.ReadRemoteObject();
661 if (remote == nullptr) {
662 PRINT_HILOGE("PrintServiceStub::OnEventOn remote is nullptr");
663 reply.WriteInt32(E_PRINT_RPC_FAILURE);
664 return false;
665 }
666 sptr<IPrintCallback> listener = iface_cast<IPrintCallback>(remote);
667 if (listener.GetRefPtr() == nullptr) {
668 PRINT_HILOGE("PrintServiceStub::OnEventOn listener is null");
669 reply.WriteInt32(E_PRINT_RPC_FAILURE);
670 return false;
671 }
672 int32_t ret = RegisterPrinterCallback(type, listener);
673 reply.WriteInt32(ret);
674 PRINT_HILOGD("PrintServiceStub::OnRegisterPrinterCallback out");
675 return ret == E_PRINT_NONE;
676 }
677
OnUnregisterPrinterCallback(MessageParcel & data,MessageParcel & reply)678 bool PrintServiceStub::OnUnregisterPrinterCallback(MessageParcel &data, MessageParcel &reply)
679 {
680 std::string type = data.ReadString();
681 if (type.empty()) {
682 reply.WriteInt32(E_PRINT_RPC_FAILURE);
683 return false;
684 }
685 PRINT_HILOGI("PrintServiceStub::OnUnregisterPrinterCallback type=%{public}s ", type.c_str());
686 int32_t ret = UnregisterPrinterCallback(type);
687 reply.WriteInt32(ret);
688 PRINT_HILOGD("PrintServiceStub::OnUnregisterPrinterCallback out");
689 return ret == E_PRINT_NONE;
690 }
691
OnRegisterExtCallback(MessageParcel & data,MessageParcel & reply)692 bool PrintServiceStub::OnRegisterExtCallback(MessageParcel &data, MessageParcel &reply)
693 {
694 PRINT_HILOGI("PrintServiceStub::OnRegisterExtCallback in");
695 std::string extensionCID = data.ReadString();
696 sptr<IRemoteObject> remote = data.ReadRemoteObject();
697 if (remote == nullptr) {
698 PRINT_HILOGD("PrintServiceStub::OnRegisterExtCallback remote is nullptr");
699 reply.WriteInt32(E_PRINT_RPC_FAILURE);
700 return false;
701 }
702 sptr<IPrintExtensionCallback> listener = iface_cast<IPrintExtensionCallback>(remote);
703 if (listener.GetRefPtr() == nullptr) {
704 PRINT_HILOGD("PrintServiceStub::OnRegisterExtCallback listener is null");
705 reply.WriteInt32(E_PRINT_RPC_FAILURE);
706 return false;
707 }
708
709 int32_t ret = RegisterExtCallback(extensionCID, listener);
710 reply.WriteInt32(ret);
711 PRINT_HILOGD("PrintServiceStub::OnRegisterExtCallback out");
712 return ret == E_PRINT_NONE;
713 }
714
OnUnregisterAllExtCallback(MessageParcel & data,MessageParcel & reply)715 bool PrintServiceStub::OnUnregisterAllExtCallback(MessageParcel &data, MessageParcel &reply)
716 {
717 PRINT_HILOGI("PrintServiceStub::OnUnregisterAllExtCallback in");
718 std::string extensionId = data.ReadString();
719 int32_t ret = UnregisterAllExtCallback(extensionId);
720 reply.WriteInt32(ret);
721 PRINT_HILOGD("PrintServiceStub::OnUnregisterAllExtCallback out");
722 return ret == E_PRINT_NONE;
723 }
724
OnLoadExtSuccess(MessageParcel & data,MessageParcel & reply)725 bool PrintServiceStub::OnLoadExtSuccess(MessageParcel &data, MessageParcel &reply)
726 {
727 PRINT_HILOGI("PrintServiceStub::OnLoadExtSuccess in");
728 std::string extensionId = data.ReadString();
729 int32_t ret = LoadExtSuccess(extensionId);
730 reply.WriteInt32(ret);
731 PRINT_HILOGD("PrintServiceStub::OnLoadExtSuccess out");
732 return ret == E_PRINT_NONE;
733 }
734
OnPrintByAdapter(MessageParcel & data,MessageParcel & reply)735 bool PrintServiceStub::OnPrintByAdapter(MessageParcel &data, MessageParcel &reply)
736 {
737 PRINT_HILOGI("PrintServiceStub::OnPrintByAdapter in");
738 int32_t ret = E_PRINT_RPC_FAILURE;
739 std::string jobName = data.ReadString();
740 auto attrs = PrintAttributes::Unmarshalling(data);
741 std::string taskId = data.ReadString();
742 if (attrs != nullptr) {
743 attrs->Dump();
744 ret = PrintByAdapter(jobName, *attrs, taskId);
745 }
746 reply.WriteInt32(ret);
747 PRINT_HILOGI("PrintServiceStub::OnPrintByAdapter out");
748 return ret == E_PRINT_NONE;
749 }
750
OnStartGetPrintFile(MessageParcel & data,MessageParcel & reply)751 bool PrintServiceStub::OnStartGetPrintFile(MessageParcel &data, MessageParcel &reply)
752 {
753 PRINT_HILOGI("PrintServiceStub::OnStartGetPrintFile in");
754 int32_t ret = E_PRINT_RPC_FAILURE;
755 std::string jobId = data.ReadString();
756 auto attrs = PrintAttributes::Unmarshalling(data);
757 int32_t fd = data.ReadFileDescriptor();
758 if (fd >= 0 && attrs != nullptr) {
759 ret = StartGetPrintFile(jobId, *attrs, static_cast<uint32_t>(fd));
760 close(fd);
761 }
762 reply.WriteInt32(ret);
763 PRINT_HILOGI("PrintServiceStub::OnStartGetPrintFile out");
764 return ret == E_PRINT_NONE;
765 }
766
OnNotifyPrintService(MessageParcel & data,MessageParcel & reply)767 bool PrintServiceStub::OnNotifyPrintService(MessageParcel &data, MessageParcel &reply)
768 {
769 PRINT_HILOGI("PrintServiceStub::OnNotifyPrintService in");
770 std::string jobId = data.ReadString();
771 std::string type = data.ReadString();
772 PRINT_HILOGD(
773 "PrintServiceStub::OnNotifyPrintService jobId=%{public}s type=%{public}s ", jobId.c_str(), type.c_str());
774 int32_t ret = NotifyPrintService(jobId, type);
775 reply.WriteInt32(ret);
776 PRINT_HILOGD("PrintServiceStub::OnNotifyPrintService out");
777 return ret == E_PRINT_NONE;
778 }
779
780
OnAddPrinterToDiscovery(MessageParcel & data,MessageParcel & reply)781 bool PrintServiceStub::OnAddPrinterToDiscovery(MessageParcel &data, MessageParcel &reply)
782 {
783 PRINT_HILOGI("PrintServiceStub::OnAddPrinterToDiscovery in");
784 auto infoPtr = PrinterInfo::Unmarshalling(data);
785 if (infoPtr == nullptr) {
786 PRINT_HILOGW("invalid printer object");
787 reply.WriteInt32(E_PRINT_RPC_FAILURE);
788 PRINT_HILOGD("PrintServiceStub::OnAddPrinterToDiscovery out with failure");
789 return false;
790 }
791 infoPtr->Dump();
792 int32_t ret = AddPrinterToDiscovery(*infoPtr);
793 reply.WriteInt32(ret);
794 PRINT_HILOGD("PrintServiceStub::OnAddPrinterToDiscovery out with ret = %{public}d", ret);
795 return ret == E_PRINT_NONE;
796 }
797
OnUpdatePrinterInDiscovery(MessageParcel & data,MessageParcel & reply)798 bool PrintServiceStub::OnUpdatePrinterInDiscovery(MessageParcel &data, MessageParcel &reply)
799 {
800 PRINT_HILOGI("PrintServiceStub::OnUpdatePrinterInDiscovery in");
801
802 auto infoPtr = PrinterInfo::Unmarshalling(data);
803 if (infoPtr == nullptr) {
804 PRINT_HILOGE("Failed to unmarshall printer info");
805 reply.WriteInt32(E_PRINT_RPC_FAILURE);
806 return false;
807 }
808
809 infoPtr->Dump();
810 int32_t ret = UpdatePrinterInDiscovery(*infoPtr);
811 reply.WriteInt32(ret);
812
813 PRINT_HILOGD("PrintServiceStub::OnUpdatePrinterInDiscovery out");
814 return ret == E_PRINT_NONE;
815 }
816
OnRemovePrinterFromDiscovery(MessageParcel & data,MessageParcel & reply)817 bool PrintServiceStub::OnRemovePrinterFromDiscovery(MessageParcel &data, MessageParcel &reply)
818 {
819 PRINT_HILOGI("PrintServiceStub::OnRemovePrinterFromDiscovery in");
820
821 std::string printerId = data.ReadString();
822
823 int32_t ret = RemovePrinterFromDiscovery(printerId);
824 reply.WriteInt32(ret);
825
826 PRINT_HILOGD("PrintServiceStub::OnRemovePrinterFromDiscovery out");
827 return ret == E_PRINT_NONE;
828 }
829
OnUpdatePrinterInSystem(MessageParcel & data,MessageParcel & reply)830 bool PrintServiceStub::OnUpdatePrinterInSystem(MessageParcel &data, MessageParcel &reply)
831 {
832 PRINT_HILOGI("PrintServiceStub::OnUpdatePrinterInSystem in");
833
834 auto infoPtr = PrinterInfo::Unmarshalling(data);
835 if (infoPtr == nullptr) {
836 PRINT_HILOGE("Failed to unmarshall printer info");
837 reply.WriteInt32(E_PRINT_RPC_FAILURE);
838 return false;
839 }
840
841 infoPtr->Dump();
842 int32_t ret = UpdatePrinterInSystem(*infoPtr);
843 reply.WriteInt32(ret);
844
845 PRINT_HILOGD("PrintServiceStub::OnUpdatePrinterInSystem out");
846 return ret == E_PRINT_NONE;
847 }
848
OnRestartPrintJob(MessageParcel & data,MessageParcel & reply)849 bool PrintServiceStub::OnRestartPrintJob(MessageParcel &data, MessageParcel &reply)
850 {
851 PRINT_HILOGI("PrintServiceStub::RestartPrintJob in");
852 int32_t ret = RestartPrintJob(data.ReadString());
853 reply.WriteInt32(ret);
854 PRINT_HILOGD("PrintServiceStub::RestartPrintJob out");
855 return ret == E_PRINT_NONE;
856 }
857
858 } // namespace OHOS::Print
859