• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021-2023 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 "app_scheduler_proxy.h"
17 
18 #include "hilog_wrapper.h"
19 #include "hitrace_meter.h"
20 #include "ipc_types.h"
21 #include "iremote_object.h"
22 
23 namespace OHOS {
24 namespace AppExecFwk {
AppSchedulerProxy(const sptr<IRemoteObject> & impl)25 AppSchedulerProxy::AppSchedulerProxy(const sptr<IRemoteObject> &impl) : IRemoteProxy<IAppScheduler>(impl)
26 {}
27 
WriteInterfaceToken(MessageParcel & data)28 bool AppSchedulerProxy::WriteInterfaceToken(MessageParcel &data)
29 {
30     if (!data.WriteInterfaceToken(AppSchedulerProxy::GetDescriptor())) {
31         HILOG_ERROR("write interface token failed");
32         return false;
33     }
34     return true;
35 }
36 
ScheduleForegroundApplication()37 void AppSchedulerProxy::ScheduleForegroundApplication()
38 {
39     MessageParcel data;
40     MessageParcel reply;
41     MessageOption option(MessageOption::TF_ASYNC);
42     if (!WriteInterfaceToken(data)) {
43         return;
44     }
45     sptr<IRemoteObject> remote = Remote();
46     if (remote == nullptr) {
47         HILOG_ERROR("Remote() is NULL");
48         return;
49     }
50     int32_t ret =
51         remote->SendRequest(static_cast<uint32_t>(IAppScheduler::Message::SCHEDULE_FOREGROUND_APPLICATION_TRANSACTION),
52             data,
53             reply,
54             option);
55     if (ret != NO_ERROR) {
56         HILOG_WARN("SendRequest is failed, error code: %{public}d", ret);
57     }
58 }
59 
ScheduleBackgroundApplication()60 void AppSchedulerProxy::ScheduleBackgroundApplication()
61 {
62     MessageParcel data;
63     MessageParcel reply;
64     MessageOption option(MessageOption::TF_ASYNC);
65     if (!WriteInterfaceToken(data)) {
66         return;
67     }
68     sptr<IRemoteObject> remote = Remote();
69     if (remote == nullptr) {
70         HILOG_ERROR("Remote() is NULL");
71         return;
72     }
73     int32_t ret =
74         remote->SendRequest(static_cast<uint32_t>(IAppScheduler::Message::SCHEDULE_BACKGROUND_APPLICATION_TRANSACTION),
75             data,
76             reply,
77             option);
78     if (ret != NO_ERROR) {
79         HILOG_WARN("SendRequest is failed, error code: %{public}d", ret);
80     }
81 }
82 
ScheduleTerminateApplication()83 void AppSchedulerProxy::ScheduleTerminateApplication()
84 {
85     MessageParcel data;
86     MessageParcel reply;
87     MessageOption option(MessageOption::TF_ASYNC);
88     if (!WriteInterfaceToken(data)) {
89         return;
90     }
91     sptr<IRemoteObject> remote = Remote();
92     if (remote == nullptr) {
93         HILOG_ERROR("Remote() is NULL");
94         return;
95     }
96     int32_t ret = remote->SendRequest(
97         static_cast<uint32_t>(IAppScheduler::Message::SCHEDULE_TERMINATE_APPLICATION_TRANSACTION), data, reply, option);
98     if (ret != NO_ERROR) {
99         HILOG_WARN("SendRequest is failed, error code: %{public}d", ret);
100     }
101 }
102 
ScheduleLowMemory()103 void AppSchedulerProxy::ScheduleLowMemory()
104 {
105     MessageParcel data;
106     MessageParcel reply;
107     MessageOption option(MessageOption::TF_ASYNC);
108     if (!WriteInterfaceToken(data)) {
109         return;
110     }
111     sptr<IRemoteObject> remote = Remote();
112     if (remote == nullptr) {
113         HILOG_ERROR("Remote() is NULL");
114         return;
115     }
116     int32_t ret = remote->SendRequest(
117         static_cast<uint32_t>(IAppScheduler::Message::SCHEDULE_LOWMEMORY_APPLICATION_TRANSACTION), data, reply, option);
118     if (ret != NO_ERROR) {
119         HILOG_WARN("SendRequest is failed, error code: %{public}d", ret);
120     }
121 }
122 
ScheduleMemoryLevel(int32_t level)123 void AppSchedulerProxy::ScheduleMemoryLevel(int32_t level)
124 {
125     uint32_t operation = static_cast<uint32_t>(IAppScheduler::Message::SCHEDULE_MEMORYLEVEL_APPLICATION_TRANSACTION);
126     ScheduleMemoryCommon(level, operation);
127 }
128 
ScheduleHeapMemory(const int32_t pid,OHOS::AppExecFwk::MallocInfo & mallocInfo)129 void AppSchedulerProxy::ScheduleHeapMemory(const int32_t pid, OHOS::AppExecFwk::MallocInfo &mallocInfo)
130 {
131     uint32_t operation = static_cast<uint32_t>(IAppScheduler::Message::SCHEDULE_HEAPMEMORY_APPLICATION_TRANSACTION);
132     MessageParcel data;
133     MessageParcel reply;
134     MessageOption option(MessageOption::TF_SYNC);
135     if (!WriteInterfaceToken(data)) {
136         HILOG_ERROR("AppSchedulerProxy !WriteInterfaceToken.");
137         return;
138     }
139     data.WriteInt32(pid);
140     sptr<IRemoteObject> remote = Remote();
141     if (remote == nullptr) {
142         HILOG_ERROR("Remote() is NULL");
143         return;
144     }
145     int32_t ret = remote->SendRequest(operation, data, reply, option);
146     if (ret != NO_ERROR) {
147         HILOG_ERROR("SendRequest is failed, error code: %{public}d", ret);
148         return;
149     }
150 
151     std::unique_ptr<MallocInfo> info(reply.ReadParcelable<MallocInfo>());
152     if (info == nullptr) {
153         HILOG_ERROR("MallocInfo ReadParcelable nullptr");
154         return;
155     }
156     mallocInfo = *info;
157 }
158 
ScheduleShrinkMemory(const int32_t level)159 void AppSchedulerProxy::ScheduleShrinkMemory(const int32_t level)
160 {
161     uint32_t operation = static_cast<uint32_t>(IAppScheduler::Message::SCHEDULE_SHRINK_MEMORY_APPLICATION_TRANSACTION);
162     ScheduleMemoryCommon(level, operation);
163 }
164 
ScheduleMemoryCommon(const int32_t level,const uint32_t operation)165 void AppSchedulerProxy::ScheduleMemoryCommon(const int32_t level, const uint32_t operation)
166 {
167     MessageParcel data;
168     MessageParcel reply;
169     MessageOption option(MessageOption::TF_ASYNC);
170     if (!WriteInterfaceToken(data)) {
171         return;
172     }
173     data.WriteInt32(level);
174     sptr<IRemoteObject> remote = Remote();
175     if (remote == nullptr) {
176         HILOG_ERROR("Remote() is NULL");
177         return;
178     }
179     int32_t ret = remote->SendRequest(operation, data, reply, option);
180     if (ret != NO_ERROR) {
181         HILOG_WARN("SendRequest is failed, error code: %{public}d", ret);
182     }
183 }
184 
ScheduleLaunchAbility(const AbilityInfo & info,const sptr<IRemoteObject> & token,const std::shared_ptr<AAFwk::Want> & want)185 void AppSchedulerProxy::ScheduleLaunchAbility(const AbilityInfo &info, const sptr<IRemoteObject> &token,
186     const std::shared_ptr<AAFwk::Want> &want)
187 {
188     MessageParcel data;
189     MessageParcel reply;
190     MessageOption option(MessageOption::TF_ASYNC);
191     if (!WriteInterfaceToken(data)) {
192         return;
193     }
194     data.WriteParcelable(&info);
195 
196     if (token) {
197         if (!data.WriteBool(true) || !data.WriteRemoteObject(token.GetRefPtr())) {
198             HILOG_ERROR("Failed to write flag and token");
199             return;
200         }
201     } else {
202         if (!data.WriteBool(false)) {
203             HILOG_ERROR("Failed to write flag");
204             return;
205         }
206     }
207 
208     if (!data.WriteParcelable(want.get())) {
209         HILOG_ERROR("write want fail.");
210         return;
211     }
212     sptr<IRemoteObject> remote = Remote();
213     if (remote == nullptr) {
214         HILOG_ERROR("Remote() is NULL");
215         return;
216     }
217     int32_t ret = remote->SendRequest(
218         static_cast<uint32_t>(IAppScheduler::Message::SCHEDULE_LAUNCH_ABILITY_TRANSACTION), data, reply, option);
219     if (ret != NO_ERROR) {
220         HILOG_WARN("SendRequest is failed, error code: %{public}d", ret);
221     }
222 }
223 
ScheduleCleanAbility(const sptr<IRemoteObject> & token)224 void AppSchedulerProxy::ScheduleCleanAbility(const sptr<IRemoteObject> &token)
225 {
226     MessageParcel data;
227     MessageParcel reply;
228     MessageOption option(MessageOption::TF_ASYNC);
229     if (!WriteInterfaceToken(data)) {
230         return;
231     }
232     if (!data.WriteRemoteObject(token.GetRefPtr())) {
233         HILOG_ERROR("Failed to write token");
234         return;
235     }
236     sptr<IRemoteObject> remote = Remote();
237     if (remote == nullptr) {
238         HILOG_ERROR("Remote() is NULL");
239         return;
240     }
241     int32_t ret = remote->SendRequest(
242         static_cast<uint32_t>(IAppScheduler::Message::SCHEDULE_CLEAN_ABILITY_TRANSACTION), data, reply, option);
243     if (ret != NO_ERROR) {
244         HILOG_WARN("SendRequest is failed, error code: %{public}d", ret);
245     }
246 }
247 
ScheduleLaunchApplication(const AppLaunchData & launchData,const Configuration & config)248 void AppSchedulerProxy::ScheduleLaunchApplication(const AppLaunchData &launchData, const Configuration &config)
249 {
250     HILOG_DEBUG("AppSchedulerProxy ScheduleLaunchApplication start");
251     MessageParcel data;
252     MessageParcel reply;
253     MessageOption option(MessageOption::TF_ASYNC);
254     if (!WriteInterfaceToken(data)) {
255         return;
256     }
257 
258     if (!data.WriteParcelable(&launchData)) {
259         HILOG_ERROR("WriteParcelable launchData failed");
260         return ;
261     }
262 
263     if (!data.WriteParcelable(&config)) {
264         HILOG_ERROR("WriteParcelable config failed");
265         return ;
266     }
267 
268     sptr<IRemoteObject> remote = Remote();
269     if (remote == nullptr) {
270         HILOG_ERROR("Remote() is NULL");
271         return;
272     }
273     int32_t ret = remote->SendRequest(
274         static_cast<uint32_t>(IAppScheduler::Message::SCHEDULE_LAUNCH_APPLICATION_TRANSACTION), data, reply, option);
275     if (ret != NO_ERROR) {
276         HILOG_WARN("SendRequest is failed, error code: %{public}d", ret);
277     }
278 }
279 
ScheduleUpdateApplicationInfoInstalled(const ApplicationInfo & appInfo)280 void AppSchedulerProxy::ScheduleUpdateApplicationInfoInstalled(const ApplicationInfo &appInfo)
281 {
282     HILOG_INFO("AppSchedulerProxy ScheduleUpdateApplicationInfoInstalled start");
283     MessageParcel data;
284     if (!WriteInterfaceToken(data)) {
285         return;
286     }
287     if (!data.WriteParcelable(&appInfo)) {
288         return ;
289     }
290     sptr<IRemoteObject> remote = Remote();
291     if (remote == nullptr) {
292         HILOG_ERROR("Remote() is NULL");
293         return;
294     }
295     MessageParcel reply;
296     MessageOption option(MessageOption::TF_ASYNC);
297     int32_t ret = remote->SendRequest(
298         static_cast<uint32_t>(IAppScheduler::Message::SCHEDULE_UPDATE_APPLICATION_INFO_INSTALLED), data, reply, option);
299     if (ret != NO_ERROR) {
300         HILOG_WARN("SendRequest is failed, error code: %{public}d", ret);
301     }
302     HILOG_INFO("AppSchedulerProxy ScheduleUpdateApplicationInfoInstalled end");
303 }
304 
ScheduleAbilityStage(const HapModuleInfo & abilityStage)305 void AppSchedulerProxy::ScheduleAbilityStage(const HapModuleInfo &abilityStage)
306 {
307     HILOG_INFO("AppSchedulerProxy ScheduleAbilityStage start");
308     MessageParcel data;
309     constexpr int32_t max = 10000;
310     constexpr int32_t large = 60;
311     constexpr int32_t mid = 20;
312     auto abilityInfoSize = static_cast<int32_t>(abilityStage.abilityInfos.size());
313     auto extensionInfoSize = static_cast<int32_t>(abilityStage.extensionInfos.size());
314     if (abilityInfoSize > max || extensionInfoSize > max) {
315         HILOG_ERROR("size exceeds max");
316         return;
317     }
318     auto componentSize = abilityInfoSize + extensionInfoSize;
319     if (componentSize > large) {
320         constexpr int32_t size = 2 * 1024 * 1024; // 1.6 M
321         data.SetDataCapacity(size);
322     } else if (componentSize > mid) {
323         constexpr int32_t size = 800 * 1024; // 800 kb
324         data.SetDataCapacity(size);
325     }
326     if (!WriteInterfaceToken(data)) {
327         return;
328     }
329 
330     if (!data.WriteParcelable(&abilityStage)) {
331         return ;
332     }
333 
334     sptr<IRemoteObject> remote = Remote();
335     if (remote == nullptr) {
336         HILOG_ERROR("Remote() is NULL");
337         return;
338     }
339 
340     MessageParcel reply;
341     MessageOption option(MessageOption::TF_ASYNC);
342     int32_t ret = remote->SendRequest(
343         static_cast<uint32_t>(IAppScheduler::Message::SCHEDULE_ABILITY_STAGE_INFO), data, reply, option);
344     if (ret != NO_ERROR) {
345         HILOG_WARN("SendRequest is failed, error code: %{public}d", ret);
346     }
347     HILOG_INFO("AppSchedulerProxy ScheduleAbilityStage end");
348 }
349 
ScheduleProfileChanged(const Profile & profile)350 void AppSchedulerProxy::ScheduleProfileChanged(const Profile &profile)
351 {
352     MessageParcel data;
353     MessageParcel reply;
354     MessageOption option(MessageOption::TF_ASYNC);
355     if (!WriteInterfaceToken(data)) {
356         return;
357     }
358     data.WriteParcelable(&profile);
359     sptr<IRemoteObject> remote = Remote();
360     if (remote == nullptr) {
361         HILOG_ERROR("Remote() is NULL");
362         return;
363     }
364     int32_t ret = remote->SendRequest(
365         static_cast<uint32_t>(IAppScheduler::Message::SCHEDULE_PROFILE_CHANGED_TRANSACTION), data, reply, option);
366     if (ret != NO_ERROR) {
367         HILOG_WARN("SendRequest is failed, error code: %{public}d", ret);
368     }
369 }
370 
ScheduleConfigurationUpdated(const Configuration & config)371 void AppSchedulerProxy::ScheduleConfigurationUpdated(const Configuration &config)
372 {
373     MessageParcel data;
374     MessageParcel reply;
375     MessageOption option(MessageOption::TF_ASYNC);
376     if (!WriteInterfaceToken(data)) {
377         return;
378     }
379     data.WriteParcelable(&config);
380     sptr<IRemoteObject> remote = Remote();
381     if (remote == nullptr) {
382         HILOG_ERROR("Remote() is NULL");
383         return;
384     }
385     int32_t ret = remote->SendRequest(
386         static_cast<uint32_t>(IAppScheduler::Message::SCHEDULE_CONFIGURATION_UPDATED), data, reply, option);
387     if (ret != NO_ERROR) {
388         HILOG_WARN("SendRequest is failed, error code: %{public}d", ret);
389     }
390 }
391 
ScheduleProcessSecurityExit()392 void AppSchedulerProxy::ScheduleProcessSecurityExit()
393 {
394     MessageParcel data;
395     MessageParcel reply;
396     MessageOption option(MessageOption::TF_ASYNC);
397     if (!WriteInterfaceToken(data)) {
398         return;
399     }
400     sptr<IRemoteObject> remote = Remote();
401     if (remote == nullptr) {
402         HILOG_ERROR("Remote() is NULL");
403         return;
404     }
405     int32_t ret = remote->SendRequest(
406         static_cast<uint32_t>(IAppScheduler::Message::SCHEDULE_PROCESS_SECURITY_EXIT_TRANSACTION), data, reply, option);
407     if (ret != NO_ERROR) {
408         HILOG_WARN("SendRequest is failed, error code: %{public}d", ret);
409     }
410 }
411 
ScheduleAcceptWant(const AAFwk::Want & want,const std::string & moduleName)412 void AppSchedulerProxy::ScheduleAcceptWant(const AAFwk::Want &want, const std::string &moduleName)
413 {
414     MessageParcel data;
415     MessageParcel reply;
416     MessageOption option(MessageOption::TF_ASYNC);
417     if (!WriteInterfaceToken(data)) {
418         return;
419     }
420 
421     if (!data.WriteParcelable(&want) || !data.WriteString(moduleName)) {
422         return;
423     }
424     sptr<IRemoteObject> remote = Remote();
425     if (remote == nullptr) {
426         HILOG_ERROR("Remote() is NULL");
427         return;
428     }
429     int32_t ret = remote->SendRequest(
430         static_cast<uint32_t>(IAppScheduler::Message::SCHEDULE_ACCEPT_WANT), data, reply, option);
431     if (ret != NO_ERROR) {
432         HILOG_WARN("SendRequest is failed, error code: %{public}d", ret);
433     }
434 }
435 
ScheduleNotifyLoadRepairPatch(const std::string & bundleName,const sptr<IQuickFixCallback> & callback,const int32_t recordId)436 int32_t AppSchedulerProxy::ScheduleNotifyLoadRepairPatch(const std::string &bundleName,
437     const sptr<IQuickFixCallback> &callback, const int32_t recordId)
438 {
439     HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__);
440     MessageParcel data;
441     if (!WriteInterfaceToken(data)) {
442         HILOG_ERROR("ScheduleNotifyLoadRepairPatch, Write interface token failed.");
443         return ERR_INVALID_DATA;
444     }
445 
446     if (!data.WriteString(bundleName)) {
447         HILOG_ERROR("ScheduleNotifyLoadRepairPatch, Write bundle name failed.");
448         return ERR_INVALID_DATA;
449     }
450 
451     if (callback == nullptr || !data.WriteRemoteObject(callback->AsObject())) {
452         HILOG_ERROR("Write callback failed.");
453         return ERR_INVALID_DATA;
454     }
455 
456     if (!data.WriteInt32(recordId)) {
457         HILOG_ERROR("Write record id failed.");
458         return ERR_INVALID_DATA;
459     }
460 
461     sptr<IRemoteObject> remote = Remote();
462     if (remote == nullptr) {
463         HILOG_ERROR("ScheduleNotifyLoadRepairPatch, Remote is nullptr");
464         return ERR_NULL_OBJECT;
465     }
466 
467     MessageParcel reply;
468     MessageOption option;
469     int32_t ret = remote->SendRequest(static_cast<uint32_t>(IAppScheduler::Message::SCHEDULE_NOTIFY_LOAD_REPAIR_PATCH),
470         data, reply, option);
471     if (ret != 0) {
472         HILOG_ERROR("ScheduleNotifyLoadRepairPatch, Send request failed with errno %{public}d.", ret);
473         return ret;
474     }
475 
476     return reply.ReadInt32();
477 }
478 
ScheduleNotifyHotReloadPage(const sptr<IQuickFixCallback> & callback,const int32_t recordId)479 int32_t AppSchedulerProxy::ScheduleNotifyHotReloadPage(const sptr<IQuickFixCallback> &callback, const int32_t recordId)
480 {
481     HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__);
482     MessageParcel data;
483     if (!WriteInterfaceToken(data)) {
484         HILOG_ERROR("Write interface token failed.");
485         return ERR_INVALID_DATA;
486     }
487 
488     if (callback == nullptr || !data.WriteRemoteObject(callback->AsObject())) {
489         HILOG_ERROR("Write callback failed.");
490         return ERR_INVALID_DATA;
491     }
492 
493     if (!data.WriteInt32(recordId)) {
494         HILOG_ERROR("Write record id failed.");
495         return ERR_INVALID_DATA;
496     }
497 
498     sptr<IRemoteObject> remote = Remote();
499     if (remote == nullptr) {
500         HILOG_ERROR("Remote is nullptr");
501         return ERR_NULL_OBJECT;
502     }
503 
504     MessageParcel reply;
505     MessageOption option;
506     auto ret = remote->SendRequest(static_cast<uint32_t>(IAppScheduler::Message::SCHEDULE_NOTIFY_HOT_RELOAD_PAGE),
507         data, reply, option);
508     if (ret != 0) {
509         HILOG_ERROR("Send request failed with errno %{public}d.", ret);
510         return ret;
511     }
512 
513     return reply.ReadInt32();
514 }
515 
ScheduleNotifyUnLoadRepairPatch(const std::string & bundleName,const sptr<IQuickFixCallback> & callback,const int32_t recordId)516 int32_t AppSchedulerProxy::ScheduleNotifyUnLoadRepairPatch(const std::string &bundleName,
517     const sptr<IQuickFixCallback> &callback, const int32_t recordId)
518 {
519     HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__);
520     MessageParcel data;
521     if (!WriteInterfaceToken(data)) {
522         HILOG_ERROR("Schedule notify unload patch, Write interface token failed.");
523         return ERR_INVALID_DATA;
524     }
525 
526     if (!data.WriteString(bundleName)) {
527         HILOG_ERROR("Schedule notify unload patch, Write bundle name failed.");
528         return ERR_INVALID_DATA;
529     }
530 
531     if (callback == nullptr || !data.WriteRemoteObject(callback->AsObject())) {
532         HILOG_ERROR("Write callback failed.");
533         return ERR_INVALID_DATA;
534     }
535 
536     if (!data.WriteInt32(recordId)) {
537         HILOG_ERROR("Write record id failed.");
538         return ERR_INVALID_DATA;
539     }
540 
541     sptr<IRemoteObject> remote = Remote();
542     if (remote == nullptr) {
543         HILOG_ERROR("Schedule notify unload patch, Remote is nullptr");
544         return ERR_NULL_OBJECT;
545     }
546 
547     MessageParcel reply;
548     MessageOption option;
549     int32_t ret = remote->SendRequest(
550         static_cast<uint32_t>(IAppScheduler::Message::SCHEDULE_NOTIFY_UNLOAD_REPAIR_PATCH), data, reply, option);
551     if (ret != 0) {
552         HILOG_ERROR("Schedule notify unload patch, Send request failed with errno %{public}d.", ret);
553         return ret;
554     }
555 
556     return reply.ReadInt32();
557 }
558 
ScheduleNotifyAppFault(const FaultData & faultData)559 int32_t AppSchedulerProxy::ScheduleNotifyAppFault(const FaultData &faultData)
560 {
561     MessageParcel data;
562 
563     if (!WriteInterfaceToken(data)) {
564         HILOG_ERROR("Write interface token failed.");
565         return ERR_INVALID_DATA;
566     }
567 
568     if (!data.WriteParcelable(&faultData)) {
569         HILOG_ERROR("Write FaultData error.");
570         return ERR_FLATTEN_OBJECT;
571     }
572 
573     sptr<IRemoteObject> remote = Remote();
574     if (remote == nullptr) {
575         HILOG_ERROR("Remote is nullptr.");
576         return ERR_NULL_OBJECT;
577     }
578 
579     MessageParcel reply;
580     MessageOption option(MessageOption::TF_ASYNC);
581     auto ret = remote->SendRequest(static_cast<uint32_t>(IAppScheduler::Message::SCHEDULE_NOTIFY_FAULT),
582         data, reply, option);
583     if (ret != NO_ERROR) {
584         HILOG_ERROR("Send request failed with error code %{public}d.", ret);
585         return ret;
586     }
587 
588     return reply.ReadInt32();
589 }
590 }  // namespace AppExecFwk
591 }  // namespace OHOS
592