• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021 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 "update_service_proxy.h"
17 #include "update_helper.h"
18 #include "securec.h"
19 
20 namespace OHOS {
21 namespace UpdateEngine {
22 #define RETURN_WHEN_TOKEN_WRITE_FAIL(data)                             \
23     if (!(data).WriteInterfaceToken(GetDescriptor())) {                \
24         ENGINE_LOGE("UpdateServiceProxy WriteInterfaceToken fail");    \
25         return INT_CALL_IPC_ERR;                                       \
26     }
27 
28 #define RETURN_WHEN_REMOTE_NULL(remote) \
29     ENGINE_CHECK((remote) != nullptr, return INT_CALL_IPC_ERR, "Can not get remote")
30 
31 #define IPC_RESULT_TO_CALL_RESULT(result)           \
32     if ((result) == ERR_NONE) {                     \
33         result = INT_CALL_SUCCESS;                  \
34     } else if ((result) >= CALL_RESULT_OFFSET) {    \
35         result = (result) - CALL_RESULT_OFFSET;     \
36     } else {                                        \
37         result = INT_CALL_IPC_ERR;                  \
38     }
39 
40 #define RETURN_FAIL_WHEN_REMOTE_ERR(methodName, res)                             \
41     do {                                                                         \
42         ENGINE_LOGI("%{public}s is %{public}d", methodName, res);                \
43         IPC_RESULT_TO_CALL_RESULT(res);                                          \
44         ENGINE_CHECK((res) == INT_CALL_SUCCESS, return (res), "Transact error"); \
45     } while (0)
46 
RegisterUpdateCallback(const UpgradeInfo & info,const sptr<IUpdateCallback> & updateCallback)47 int32_t UpdateServiceProxy::RegisterUpdateCallback(const UpgradeInfo &info,
48     const sptr<IUpdateCallback>& updateCallback)
49 {
50     ENGINE_CHECK(updateCallback != nullptr, return INT_PARAM_ERR, "Invalid param");
51     ENGINE_LOGI("UpdateServiceProxy::RegisterUpdateCallback");
52 
53     auto remote = Remote();
54     RETURN_WHEN_REMOTE_NULL(remote);
55 
56     MessageParcel data;
57     RETURN_WHEN_TOKEN_WRITE_FAIL(data);
58     UpdateHelper::WriteUpgradeInfo(data, info);
59     bool res = data.WriteRemoteObject(updateCallback->AsObject());
60     ENGINE_CHECK(res, return INT_CALL_IPC_ERR, "RegisterUpdateCallback error, WriteRemoteObject fail");
61 
62     MessageParcel reply;
63     MessageOption option;
64     int32_t ret = remote->SendRequest(REGISTER_CALLBACK, data, reply, option);
65     RETURN_FAIL_WHEN_REMOTE_ERR("UpdateServiceProxy::RegisterUpdateCallback", ret);
66     return INT_CALL_SUCCESS;
67 }
68 
UnregisterUpdateCallback(const UpgradeInfo & info)69 int32_t UpdateServiceProxy::UnregisterUpdateCallback(const UpgradeInfo &info)
70 {
71     auto remote = Remote();
72     RETURN_WHEN_REMOTE_NULL(remote);
73 
74     MessageParcel data;
75     RETURN_WHEN_TOKEN_WRITE_FAIL(data);
76     UpdateHelper::WriteUpgradeInfo(data, info);
77 
78     MessageParcel reply;
79     MessageOption option;
80     int32_t ret = remote->SendRequest(UNREGISTER_CALLBACK, data, reply, option);
81     RETURN_FAIL_WHEN_REMOTE_ERR("UpdateServiceProxy::UnregisterUpdateCallback", ret);
82     return INT_CALL_SUCCESS;
83 }
84 
CheckNewVersion(const UpgradeInfo & info)85 int32_t UpdateServiceProxy::CheckNewVersion(const UpgradeInfo &info)
86 {
87     ENGINE_LOGI("UpdateServiceProxy::CheckNewVersion");
88     auto remote = Remote();
89     RETURN_WHEN_REMOTE_NULL(remote);
90 
91     MessageParcel data;
92     RETURN_WHEN_TOKEN_WRITE_FAIL(data);
93     UpdateHelper::WriteUpgradeInfo(data, info);
94 
95     MessageParcel reply;
96     MessageOption option;
97     int32_t ret = remote->SendRequest(CHECK_VERSION, data, reply, option);
98     RETURN_FAIL_WHEN_REMOTE_ERR("UpdateServiceProxy::CheckNewVersion", ret);
99     return INT_CALL_SUCCESS;
100 }
101 
DownloadVersion(const UpgradeInfo & info,const VersionDigestInfo & versionDigestInfo,const DownloadOptions & downloadOptions,BusinessError & businessError)102 int32_t UpdateServiceProxy::DownloadVersion(const UpgradeInfo &info, const VersionDigestInfo &versionDigestInfo,
103     const DownloadOptions &downloadOptions, BusinessError &businessError)
104 {
105     ENGINE_LOGI("UpdateServiceProxy::DownloadVersion");
106     auto remote = Remote();
107     RETURN_WHEN_REMOTE_NULL(remote);
108 
109     MessageParcel data;
110     RETURN_WHEN_TOKEN_WRITE_FAIL(data);
111     UpdateHelper::WriteUpgradeInfo(data, info);
112     UpdateHelper::WriteVersionDigestInfo(data, versionDigestInfo);
113     UpdateHelper::WriteDownloadOptions(data, downloadOptions);
114 
115     MessageParcel reply;
116     MessageOption option;
117     int32_t ret = remote->SendRequest(DOWNLOAD, data, reply, option);
118     RETURN_FAIL_WHEN_REMOTE_ERR("UpdateServiceProxy::DownloadVersion", ret);
119     UpdateHelper::ReadBusinessError(reply, businessError);
120     return INT_CALL_SUCCESS;
121 }
122 
PauseDownload(const UpgradeInfo & info,const VersionDigestInfo & versionDigestInfo,const PauseDownloadOptions & pauseDownloadOptions,BusinessError & businessError)123 int32_t UpdateServiceProxy::PauseDownload(const UpgradeInfo &info, const VersionDigestInfo &versionDigestInfo,
124     const PauseDownloadOptions &pauseDownloadOptions, BusinessError &businessError)
125 {
126     ENGINE_LOGI("UpdateServiceProxy::PauseDownload");
127     auto remote = Remote();
128     RETURN_WHEN_REMOTE_NULL(remote);
129 
130     MessageParcel data;
131     RETURN_WHEN_TOKEN_WRITE_FAIL(data);
132     UpdateHelper::WriteUpgradeInfo(data, info);
133     UpdateHelper::WriteVersionDigestInfo(data, versionDigestInfo);
134     UpdateHelper::WritePauseDownloadOptions(data, pauseDownloadOptions);
135 
136     MessageParcel reply;
137     MessageOption option;
138     int32_t ret = remote->SendRequest(PAUSE_DOWNLOAD, data, reply, option);
139     RETURN_FAIL_WHEN_REMOTE_ERR("UpdateServiceProxy::ResumeDownload", ret);
140     UpdateHelper::ReadBusinessError(reply, businessError);
141     return INT_CALL_SUCCESS;
142 }
143 
ResumeDownload(const UpgradeInfo & info,const VersionDigestInfo & versionDigestInfo,const ResumeDownloadOptions & resumeDownloadOptions,BusinessError & businessError)144 int32_t UpdateServiceProxy::ResumeDownload(const UpgradeInfo &info, const VersionDigestInfo &versionDigestInfo,
145     const ResumeDownloadOptions &resumeDownloadOptions, BusinessError &businessError)
146 {
147     ENGINE_LOGI("UpdateServiceProxy::ResumeDownload");
148     auto remote = Remote();
149     RETURN_WHEN_REMOTE_NULL(remote);
150 
151     MessageParcel data;
152     RETURN_WHEN_TOKEN_WRITE_FAIL(data);
153     UpdateHelper::WriteUpgradeInfo(data, info);
154     UpdateHelper::WriteVersionDigestInfo(data, versionDigestInfo);
155     UpdateHelper::WriteResumeDownloadOptions(data, resumeDownloadOptions);
156 
157     MessageParcel reply;
158     MessageOption option;
159     int32_t ret = remote->SendRequest(RESUME_DOWNLOAD, data, reply, option);
160     RETURN_FAIL_WHEN_REMOTE_ERR("UpdateServiceProxy::ResumeDownload", ret);
161     UpdateHelper::ReadBusinessError(reply, businessError);
162     return INT_CALL_SUCCESS;
163 }
164 
DoUpdate(const UpgradeInfo & info,const VersionDigestInfo & versionDigest,const UpgradeOptions & upgradeOptions,BusinessError & businessError)165 int32_t UpdateServiceProxy::DoUpdate(const UpgradeInfo &info, const VersionDigestInfo &versionDigest,
166     const UpgradeOptions &upgradeOptions, BusinessError &businessError)
167 {
168     ENGINE_LOGI("UpdateServiceProxy::DoUpdate, versionDigest %{public}s upgradeOptions %{public}d",
169         versionDigest.versionDigest.c_str(),
170         upgradeOptions.order);
171     auto remote = Remote();
172     RETURN_WHEN_REMOTE_NULL(remote);
173 
174     MessageParcel data;
175     RETURN_WHEN_TOKEN_WRITE_FAIL(data);
176     UpdateHelper::WriteUpgradeInfo(data, info);
177     UpdateHelper::WriteVersionDigestInfo(data, versionDigest);
178     UpdateHelper::WriteUpgradeOptions(data, upgradeOptions);
179 
180     MessageParcel reply;
181     MessageOption option;
182     int32_t ret = remote->SendRequest(UPGRADE, data, reply, option);
183     RETURN_FAIL_WHEN_REMOTE_ERR("UpdateServiceProxy::DoUpdate", ret);
184     UpdateHelper::ReadBusinessError(reply, businessError);
185     return INT_CALL_SUCCESS;
186 }
187 
ClearError(const UpgradeInfo & info,const VersionDigestInfo & versionDigest,const ClearOptions & clearOptions,BusinessError & businessError)188 int32_t UpdateServiceProxy::ClearError(const UpgradeInfo &info, const VersionDigestInfo &versionDigest,
189     const ClearOptions &clearOptions, BusinessError &businessError)
190 {
191     auto remote = Remote();
192     RETURN_WHEN_REMOTE_NULL(remote);
193 
194     MessageParcel data;
195     RETURN_WHEN_TOKEN_WRITE_FAIL(data);
196     UpdateHelper::WriteUpgradeInfo(data, info);
197     UpdateHelper::WriteVersionDigestInfo(data, versionDigest);
198     UpdateHelper::WriteClearOptions(data, clearOptions);
199 
200     MessageParcel reply;
201     MessageOption option;
202     int32_t ret = remote->SendRequest(CLEAR_ERROR, data, reply, option);
203     RETURN_FAIL_WHEN_REMOTE_ERR("UpdateServiceProxy::ClearError", ret);
204     UpdateHelper::ReadBusinessError(reply, businessError);
205     return INT_CALL_SUCCESS;
206 }
207 
TerminateUpgrade(const UpgradeInfo & info,BusinessError & businessError)208 int32_t UpdateServiceProxy::TerminateUpgrade(const UpgradeInfo &info, BusinessError &businessError)
209 {
210     auto remote = Remote();
211     RETURN_WHEN_REMOTE_NULL(remote);
212 
213     MessageParcel data;
214     RETURN_WHEN_TOKEN_WRITE_FAIL(data);
215     UpdateHelper::WriteUpgradeInfo(data, info);
216 
217     MessageParcel reply;
218     MessageOption option;
219     int32_t ret = remote->SendRequest(TERMINATE_UPGRADE, data, reply, option);
220     RETURN_FAIL_WHEN_REMOTE_ERR("UpdateServiceProxy::TerminateUpgrade", ret);
221     UpdateHelper::ReadBusinessError(reply, businessError);
222     return INT_CALL_SUCCESS;
223 }
224 
GetNewVersion(const UpgradeInfo & info,NewVersionInfo & newVersionInfo,BusinessError & businessError)225 int32_t UpdateServiceProxy::GetNewVersion(const UpgradeInfo &info, NewVersionInfo &newVersionInfo,
226     BusinessError &businessError)
227 {
228     ENGINE_LOGI("UpdateServiceProxy::GetNewVersion");
229     auto remote = Remote();
230     RETURN_WHEN_REMOTE_NULL(remote);
231 
232     MessageParcel data;
233     RETURN_WHEN_TOKEN_WRITE_FAIL(data);
234     UpdateHelper::WriteUpgradeInfo(data, info);
235 
236     MessageParcel reply;
237     MessageOption option;
238     int32_t ret = remote->SendRequest(GET_NEW_VERSION, data, reply, option);
239     RETURN_FAIL_WHEN_REMOTE_ERR("UpdateServiceProxy::GetNewVersion", ret);
240 
241     UpdateHelper::ReadBusinessError(reply, businessError);
242     UpdateHelper::ReadNewVersionInfo(reply, newVersionInfo);
243     return INT_CALL_SUCCESS;
244 }
245 
GetNewVersionDescription(const UpgradeInfo & info,const VersionDigestInfo & versionDigestInfo,const DescriptionOptions & descriptionOptions,VersionDescriptionInfo & newVersionDescriptionInfo,BusinessError & businessError)246 int32_t UpdateServiceProxy::GetNewVersionDescription(const UpgradeInfo &info,
247     const VersionDigestInfo &versionDigestInfo, const DescriptionOptions &descriptionOptions,
248     VersionDescriptionInfo &newVersionDescriptionInfo, BusinessError &businessError)
249 {
250     ENGINE_LOGI("UpdateServiceProxy::GetNewVersionDescription");
251     auto remote = Remote();
252     RETURN_WHEN_REMOTE_NULL(remote);
253 
254     MessageParcel data;
255     RETURN_WHEN_TOKEN_WRITE_FAIL(data);
256     UpdateHelper::WriteUpgradeInfo(data, info);
257     UpdateHelper::WriteVersionDigestInfo(data, versionDigestInfo);
258     UpdateHelper::WriteDescriptionOptions(data, descriptionOptions);
259 
260     MessageParcel reply;
261     MessageOption option;
262     int32_t ret = remote->SendRequest(GET_NEW_VERSION_DESCRIPTION, data, reply, option);
263     RETURN_FAIL_WHEN_REMOTE_ERR("UpdateServiceProxy::GetNewVersionDescription", ret);
264     UpdateHelper::ReadBusinessError(reply, businessError);
265     UpdateHelper::ReadVersionDescriptionInfo(reply, newVersionDescriptionInfo);
266     return INT_CALL_SUCCESS;
267 }
268 
GetCurrentVersionInfo(const UpgradeInfo & info,CurrentVersionInfo & currentVersionInfo,BusinessError & businessError)269 int32_t UpdateServiceProxy::GetCurrentVersionInfo(const UpgradeInfo &info, CurrentVersionInfo &currentVersionInfo,
270     BusinessError &businessError)
271 {
272     ENGINE_LOGI("UpdateServiceProxy::GetCurrentVersionInfo");
273     auto remote = Remote();
274     RETURN_WHEN_REMOTE_NULL(remote);
275 
276     MessageParcel data;
277     RETURN_WHEN_TOKEN_WRITE_FAIL(data);
278     UpdateHelper::WriteUpgradeInfo(data, info);
279 
280     MessageParcel reply;
281     MessageOption option;
282     int32_t ret = remote->SendRequest(GET_CURRENT_VERSION, data, reply, option);
283     RETURN_FAIL_WHEN_REMOTE_ERR("UpdateServiceProxy::GetCurrentVersionInfo", ret);
284 
285     UpdateHelper::ReadBusinessError(reply, businessError);
286     UpdateHelper::ReadCurrentVersionInfo(reply, currentVersionInfo);
287     return INT_CALL_SUCCESS;
288 }
289 
GetCurrentVersionDescription(const UpgradeInfo & info,const DescriptionOptions & descriptionOptions,VersionDescriptionInfo & currentVersionDescriptionInfo,BusinessError & businessError)290 int32_t UpdateServiceProxy::GetCurrentVersionDescription(const UpgradeInfo &info,
291     const DescriptionOptions &descriptionOptions, VersionDescriptionInfo &currentVersionDescriptionInfo,
292     BusinessError &businessError)
293 {
294     ENGINE_LOGI("UpdateServiceProxy::GetCurrentVersionDescription");
295     auto remote = Remote();
296     RETURN_WHEN_REMOTE_NULL(remote);
297 
298     MessageParcel data;
299     RETURN_WHEN_TOKEN_WRITE_FAIL(data);
300     UpdateHelper::WriteUpgradeInfo(data, info);
301     UpdateHelper::WriteDescriptionOptions(data, descriptionOptions);
302 
303     MessageParcel reply;
304     MessageOption option;
305     int32_t ret = remote->SendRequest(GET_CURRENT_VERSION_DESCRIPTION, data, reply, option);
306     RETURN_FAIL_WHEN_REMOTE_ERR("UpdateServiceProxy::GetCurrentVersionDescription", ret);
307     UpdateHelper::ReadBusinessError(reply, businessError);
308     UpdateHelper::ReadVersionDescriptionInfo(reply, currentVersionDescriptionInfo);
309     return INT_CALL_SUCCESS;
310 }
311 
GetTaskInfo(const UpgradeInfo & info,TaskInfo & taskInfo,BusinessError & businessError)312 int32_t UpdateServiceProxy::GetTaskInfo(const UpgradeInfo &info, TaskInfo &taskInfo, BusinessError &businessError)
313 {
314     ENGINE_LOGI("UpdateServiceProxy::GetTaskInfo");
315     auto remote = Remote();
316     RETURN_WHEN_REMOTE_NULL(remote);
317 
318     MessageParcel data;
319     RETURN_WHEN_TOKEN_WRITE_FAIL(data);
320     UpdateHelper::WriteUpgradeInfo(data, info);
321 
322     MessageParcel reply;
323     MessageOption option;
324     int32_t ret = remote->SendRequest(GET_TASK_INFO, data, reply, option);
325     RETURN_FAIL_WHEN_REMOTE_ERR("UpdateServiceProxy::GetTaskInfo", ret);
326 
327     UpdateHelper::ReadBusinessError(reply, businessError);
328     UpdateHelper::ReadTaskInfo(reply, taskInfo);
329     return INT_CALL_SUCCESS;
330 }
331 
SetUpgradePolicy(const UpgradeInfo & info,const UpgradePolicy & policy,BusinessError & businessError)332 int32_t UpdateServiceProxy::SetUpgradePolicy(const UpgradeInfo &info, const UpgradePolicy &policy,
333     BusinessError &businessError)
334 {
335     ENGINE_LOGI("UpdateServiceProxy::SetUpgradePolicy");
336     auto remote = Remote();
337     RETURN_WHEN_REMOTE_NULL(remote);
338 
339     MessageParcel data;
340     RETURN_WHEN_TOKEN_WRITE_FAIL(data);
341     UpdateHelper::WriteUpgradeInfo(data, info);
342     UpdateHelper::WriteUpgradePolicy(data, policy);
343 
344     MessageParcel reply;
345     MessageOption option;
346     int32_t ret = remote->SendRequest(SET_POLICY, data, reply, option);
347     RETURN_FAIL_WHEN_REMOTE_ERR("UpdateServiceProxy::SetUpgradePolicy", ret);
348 
349     UpdateHelper::ReadBusinessError(reply, businessError);
350     return INT_CALL_SUCCESS;
351 }
352 
GetUpgradePolicy(const UpgradeInfo & info,UpgradePolicy & policy,BusinessError & businessError)353 int32_t UpdateServiceProxy::GetUpgradePolicy(const UpgradeInfo &info, UpgradePolicy &policy,
354     BusinessError &businessError)
355 {
356     ENGINE_LOGI("UpdateServiceProxy::GetUpgradePolicy");
357     auto remote = Remote();
358     RETURN_WHEN_REMOTE_NULL(remote);
359 
360     MessageParcel data;
361     RETURN_WHEN_TOKEN_WRITE_FAIL(data);
362     UpdateHelper::WriteUpgradeInfo(data, info);
363 
364     MessageParcel reply;
365     MessageOption option;
366     int32_t ret = remote->SendRequest(GET_POLICY, data, reply, option);
367     RETURN_FAIL_WHEN_REMOTE_ERR("UpdateServiceProxy::GetUpgradePolicy", ret);
368 
369     UpdateHelper::ReadBusinessError(reply, businessError);
370     UpdateHelper::ReadUpgradePolicy(reply, policy);
371     return INT_CALL_SUCCESS;
372 }
373 
Cancel(const UpgradeInfo & info,int32_t service,BusinessError & businessError)374 int32_t UpdateServiceProxy::Cancel(const UpgradeInfo &info, int32_t service, BusinessError &businessError)
375 {
376     ENGINE_LOGI("UpdateServiceProxy::Cancel");
377     auto remote = Remote();
378     RETURN_WHEN_REMOTE_NULL(remote);
379 
380     MessageParcel data;
381     RETURN_WHEN_TOKEN_WRITE_FAIL(data);
382     UpdateHelper::WriteUpgradeInfo(data, info);
383     data.WriteInt32(static_cast<int32_t>(service));
384 
385     MessageParcel reply;
386     MessageOption option;
387     int32_t ret = remote->SendRequest(CANCEL, data, reply, option);
388     RETURN_FAIL_WHEN_REMOTE_ERR("UpdateServiceProxy::Cancel", ret);
389 
390     UpdateHelper::ReadBusinessError(reply, businessError);
391     return INT_CALL_SUCCESS;
392 }
393 
FactoryReset(BusinessError & businessError)394 int32_t UpdateServiceProxy::FactoryReset(BusinessError &businessError)
395 {
396     ENGINE_LOGI("UpdateServiceProxy::FactoryReset");
397     auto remote = Remote();
398     RETURN_WHEN_REMOTE_NULL(remote);
399 
400     MessageParcel data;
401     RETURN_WHEN_TOKEN_WRITE_FAIL(data);
402 
403     MessageParcel reply;
404     MessageOption option;
405     int32_t ret = ERR_NONE; // IPC errCode: defined in ipc_types.h
406 #ifndef UPDATER_UT
407     ret = remote->SendRequest(FACTORY_RESET, data, reply, option);
408 #endif
409     RETURN_FAIL_WHEN_REMOTE_ERR("UpdateServiceProxy::FactoryReset", ret);
410     UpdateHelper::ReadBusinessError(reply, businessError);
411     return INT_CALL_SUCCESS;
412 }
413 
ApplyNewVersion(const UpgradeInfo & info,const std::string & miscFile,const std::string & packageName,BusinessError & businessError)414 int32_t UpdateServiceProxy::ApplyNewVersion(const UpgradeInfo &info, const std::string &miscFile,
415     const std::string &packageName, BusinessError &businessError)
416 {
417     ENGINE_LOGI("UpdateServiceProxy::ApplyNewVersion");
418     auto remote = Remote();
419     RETURN_WHEN_REMOTE_NULL(remote);
420 
421     MessageParcel data;
422     RETURN_WHEN_TOKEN_WRITE_FAIL(data);
423     UpdateHelper::WriteUpgradeInfo(data, info);
424     data.WriteString16(Str8ToStr16(miscFile));
425     data.WriteString16(Str8ToStr16(packageName));
426 
427     MessageParcel reply;
428     MessageOption option;
429     int32_t ret = ERR_NONE;
430 #ifndef UPDATER_UT
431     ret = remote->SendRequest(APPLY_NEW_VERSION, data, reply, option);
432 #endif
433     RETURN_FAIL_WHEN_REMOTE_ERR("UpdateServiceProxy::ApplyNewVersion", ret);
434     UpdateHelper::ReadBusinessError(reply, businessError);
435     return INT_CALL_SUCCESS;
436 }
437 
VerifyUpgradePackage(const std::string & packagePath,const std::string & keyPath,BusinessError & businessError)438 int32_t UpdateServiceProxy::VerifyUpgradePackage(const std::string &packagePath, const std::string &keyPath,
439     BusinessError &businessError)
440 {
441     ENGINE_LOGI("UpdateServiceProxy::VerifyUpgradePackage");
442     auto remote = Remote();
443     RETURN_WHEN_REMOTE_NULL(remote);
444 
445     MessageParcel data;
446     RETURN_WHEN_TOKEN_WRITE_FAIL(data);
447     data.WriteString16(Str8ToStr16(packagePath));
448     data.WriteString16(Str8ToStr16(keyPath));
449 
450     MessageParcel reply;
451     MessageOption option;
452     int32_t ret = remote->SendRequest(VERIFY_UPGRADE_PACKAGE, data, reply, option);
453     RETURN_FAIL_WHEN_REMOTE_ERR("UpdateServiceProxy::VerifyUpgradePackage", ret);
454     UpdateHelper::ReadBusinessError(reply, businessError);
455     return INT_CALL_SUCCESS;
456 }
457 } // namespace UpdateEngine
458 } // namespace OHOS
459