• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2023-2024 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 #ifndef OHOS_ABILITY_RUNTIME_ABILITY_MANAGER_PROXY_H
17 #define OHOS_ABILITY_RUNTIME_ABILITY_MANAGER_PROXY_H
18 
19 #include "ability_manager_interface.h"
20 #include "auto_startup_info.h"
21 #include "iremote_proxy.h"
22 #include "mission_info.h"
23 
24 namespace OHOS {
25 namespace AAFwk {
26 using AutoStartupInfo = AbilityRuntime::AutoStartupInfo;
27 /**
28  * @class AbilityManagerProxy
29  * AbilityManagerProxy.
30  */
31 class AbilityManagerProxy : public IRemoteProxy<IAbilityManager> {
32 public:
AbilityManagerProxy(const sptr<IRemoteObject> & impl)33     explicit AbilityManagerProxy(const sptr<IRemoteObject> &impl) : IRemoteProxy<IAbilityManager>(impl)
34     {}
35 
~AbilityManagerProxy()36     virtual ~AbilityManagerProxy()
37     {}
38 
39     /**
40      * StartSelfUIAbility with want, start self uiability only on 2-in-1 devices.
41      *
42      * @param want, the want of the ability to start.
43      * @return Returns ERR_OK on success, others on failure.
44      */
45     virtual int StartSelfUIAbility(const Want &want) override;
46 
47     /**
48      * StartAbility with want, send want to ability manager service.
49      *
50      * @param want, the want of the ability to start.
51      * @param requestCode, Ability request code.
52      * @param userId, Designation User ID.
53      * @return Returns ERR_OK on success, others on failure.
54      */
55     virtual int StartAbility(
56         const Want &want,
57         int32_t userId = DEFAULT_INVAL_VALUE,
58         int requestCode = DEFAULT_INVAL_VALUE) override;
59 
60     /**
61      * StartAbility with want, send want to ability manager service.
62      *
63      * @param want, the want of the ability to start.
64      * @param callerToken, caller ability token.
65      * @param requestCode the resultCode of the ability to start.
66      * @param userId, Designation User ID.
67      * @return Returns ERR_OK on success, others on failure.
68      */
69     virtual int StartAbility(
70         const Want &want,
71         const sptr<IRemoteObject> &callerToken,
72         int32_t userId = DEFAULT_INVAL_VALUE,
73         int requestCode = DEFAULT_INVAL_VALUE) override;
74 
75     /**
76      * StartAbilityWithSpecifyTokenId with want and specialId, send want to ability manager service.
77      *
78      * @param want, the want of the ability to start.
79      * @param callerToken, caller ability token.
80      * @param specialId the caller Id.
81      * @param userId, Designation User ID.
82      * @param requestCode the resultCode of the ability to start.
83      * @return Returns ERR_OK on success, others on failure.
84      */
85     virtual int StartAbilityWithSpecifyTokenId(
86         const Want &want,
87         const sptr<IRemoteObject> &callerToken,
88         uint32_t specifyTokenId,
89         int32_t userId = DEFAULT_INVAL_VALUE,
90         int requestCode = DEFAULT_INVAL_VALUE) override;
91 
92     /**
93      * StartAbility by insight intent, send want to ability manager service.
94      *
95      * @param want Ability want.
96      * @param callerToken caller ability token.
97      * @param intentId insight intent id.
98      * @param userId userId of target ability.
99      * @return Returns ERR_OK on success, others on failure.
100      */
101     int32_t StartAbilityByInsightIntent(
102         const Want &want,
103         const sptr<IRemoteObject> &callerToken,
104         uint64_t intentId,
105         int32_t userId = DEFAULT_INVAL_VALUE) override;
106 
107     /**
108      * Starts a new ability with specific start settings.
109      *
110      * @param want Indicates the ability to start.
111      * @param callerToken caller ability token.
112      * @param abilityStartSetting Indicates the setting ability used to start.
113      * @param userId, Designation User ID.
114      * @return Returns ERR_OK on success, others on failure.
115      */
116     virtual int StartAbility(
117         const Want &want,
118         const AbilityStartSetting &abilityStartSetting,
119         const sptr<IRemoteObject> &callerToken,
120         int32_t userId = DEFAULT_INVAL_VALUE,
121         int requestCode = DEFAULT_INVAL_VALUE) override;
122 
123     /**
124      * Starts a new ability with specific start options.
125      *
126      * @param want, the want of the ability to start.
127      * @param startOptions Indicates the options used to start.
128      * @param callerToken, caller ability token.
129      * @param userId, Designation User ID.
130      * @param requestCode the resultCode of the ability to start.
131      * @return Returns ERR_OK on success, others on failure.
132      */
133     virtual int StartAbility(
134         const Want &want,
135         const StartOptions &startOptions,
136         const sptr<IRemoteObject> &callerToken,
137         int32_t userId = DEFAULT_INVAL_VALUE,
138         int requestCode = DEFAULT_INVAL_VALUE) override;
139 
140     /**
141      * Starts a new ability using the original caller information.
142      *
143      * @param want the want of the ability to start.
144      * @param callerToken current caller ability token.
145      * @param asCallerSourceToken source caller ability token.
146      * @param userId Designation User ID.
147      * @param requestCode the resultCode of the ability to start.
148      * @return Returns ERR_OK on success, others on failure.
149      */
150     virtual int StartAbilityAsCaller(
151         const Want &want,
152         const sptr<IRemoteObject> &callerToken,
153         sptr<IRemoteObject> asCallerSourceToken,
154         int32_t userId = DEFAULT_INVAL_VALUE,
155         int requestCode = DEFAULT_INVAL_VALUE) override;
156 
157     /**
158      * Starts a new ability using the original caller information.
159      *
160      * @param want the want of the ability to start.
161      * @param startOptions Indicates the options used to start.
162      * @param callerToken current caller ability token.
163      * @param asCallerSourceToken source caller ability token.
164      * @param userId Designation User ID.
165      * @param requestCode the resultCode of the ability to start.
166      * @return Returns ERR_OK on success, others on failure.
167      */
168     virtual int StartAbilityAsCaller(
169         const Want &want,
170         const StartOptions &startOptions,
171         const sptr<IRemoteObject> &callerToken,
172         sptr<IRemoteObject> asCallerSourceToken,
173         int32_t userId = DEFAULT_INVAL_VALUE,
174         int requestCode = DEFAULT_INVAL_VALUE) override;
175 
176     /**
177      * Starts a new ability for result using the original caller information.
178      *
179      * @param want the want of the ability to start.
180      * @param callerToken current caller ability token.
181      * @param requestCode the resultCode of the ability to start.
182      * @param userId Designation User ID.
183      * @return Returns ERR_OK on success, others on failure.
184      */
185     int StartAbilityForResultAsCaller(
186         const Want &want,
187         const sptr<IRemoteObject> &callerToken,
188         int requestCode = DEFAULT_INVAL_VALUE,
189         int32_t userId = DEFAULT_INVAL_VALUE) override;
190 
191     /**
192      * Starts a new ability for result using the original caller information.
193      *
194      * @param want the want of the ability to start.
195      * @param startOptions Indicates the options used to start.
196      * @param callerToken current caller ability token.
197      * @param requestCode the resultCode of the ability to start.
198      * @param userId Designation User ID.
199      * @return Returns ERR_OK on success, others on failure.
200      */
201     int StartAbilityForResultAsCaller(
202         const Want &want,
203         const StartOptions &startOptions,
204         const sptr<IRemoteObject> &callerToken,
205         int requestCode = DEFAULT_INVAL_VALUE,
206         int32_t userId = DEFAULT_INVAL_VALUE) override;
207 
208     /**
209      * Start ui session ability with extension session info, send session info to ability manager service.
210      *
211      * @param want, the want of the ability to start.
212      * @param callerToken, caller ability token.
213      * @param sessionInfo the information of UIExtensionContentSession.
214      * @param userId, Designation User ID.
215      * @param requestCode, Ability request code.
216      * @return Returns ERR_OK on success, others on failure.
217      */
218     virtual int StartAbilityByUIContentSession(
219         const Want &want,
220         const sptr<IRemoteObject> &callerToken,
221         const sptr<SessionInfo> &sessionInfo,
222         int32_t userId = DEFAULT_INVAL_VALUE,
223         int requestCode = DEFAULT_INVAL_VALUE) override;
224 
225     /**
226      * Start ui session ability with extension session info, send session info to ability manager service.
227      *
228      * @param want, the want of the ability to start.
229      * @param startOptions Indicates the options used to start.
230      * @param callerToken, caller ability token.
231      * @param sessionInfo the information of UIExtensionContentSession.
232      * @param userId, Designation User ID.
233      * @param requestCode the resultCode of the ability to start.
234      * @return Returns ERR_OK on success, others on failure.
235      */
236     virtual int StartAbilityByUIContentSession(
237         const Want &want,
238         const StartOptions &startOptions,
239         const sptr<IRemoteObject> &callerToken,
240         const sptr<SessionInfo> &sessionInfo,
241         int32_t userId = DEFAULT_INVAL_VALUE,
242         int requestCode = DEFAULT_INVAL_VALUE) override;
243 
244     /**
245      * Start ui ability
246      *
247      * @param want the want of the ability to start.
248      * @param callerToken caller ability token.
249      * @param specifyTokenId The Caller ID.
250      * @return Returns ERR_OK on success, others on failure.
251      */
252     virtual int StartAbilityOnlyUIAbility(
253         const Want &want,
254         const sptr<IRemoteObject> &callerToken,
255         uint32_t specifyTokenId) override;
256 
257     /**
258      * Start extension ability with want, send want to ability manager service.
259      *
260      * @param want, the want of the ability to start.
261      * @param callerToken, caller ability token.
262      * @param userId, Designation User ID.
263      * @param extensionType If an ExtensionAbilityType is set, only extension of that type can be started.
264      * @return Returns ERR_OK on success, others on failure.
265      */
266     virtual int StartExtensionAbility(
267         const Want &want,
268         const sptr<IRemoteObject> &callerToken,
269         int32_t userId = DEFAULT_INVAL_VALUE,
270         AppExecFwk::ExtensionAbilityType extensionType = AppExecFwk::ExtensionAbilityType::UNSPECIFIED) override;
271 
272     /**
273      * Create UIExtension with want, send want to ability manager service.
274      *
275      * @param want, the want of the ability to start.
276      * @return Returns ERR_OK on success, others on failure.
277      */
278     int RequestModalUIExtension(const Want &want) override;
279 
280     /**
281      * Preload UIExtension with want, send want to ability manager service.
282      *
283      * @param want, the want of the ability to start.
284      * @param hostBundleName, the caller application bundle name.
285      * @param userId, the extension runs in.
286      * @return Returns ERR_OK on success, others on failure.
287      */
288     int PreloadUIExtensionAbility(const Want &want, std::string &hostBundleName,
289         int32_t userId = DEFAULT_INVAL_VALUE) override;
290 
291     int ChangeAbilityVisibility(sptr<IRemoteObject> token, bool isShow) override;
292 
293     int ChangeUIAbilityVisibilityBySCB(sptr<SessionInfo> sessionInfo, bool isShow) override;
294     /**
295      * Start ui extension ability with extension session info, send extension session info to ability manager service.
296      *
297      * @param extensionSessionInfo the extension session info of the ability to start.
298      * @param userId, Designation User ID.
299      * @return Returns ERR_OK on success, others on failure.
300      */
301     virtual int StartUIExtensionAbility(
302         const sptr<SessionInfo> &extensionSessionInfo,
303         int32_t userId = DEFAULT_INVAL_VALUE) override;
304 
305     /**
306      * Start ui ability with want, send want to ability manager service.
307      *
308      * @param sessionInfo the session info of the ability to start.
309      * @param isColdStart the session info of the ability is or not cold start.
310      * @return Returns ERR_OK on success, others on failure.
311      */
312     virtual int StartUIAbilityBySCB(sptr<SessionInfo> sessionInfo, bool &isColdStart, uint32_t sceneFlag = 0) override;
313 
314     /**
315      * Stop extension ability with want, send want to ability manager service.
316      *
317      * @param want, the want of the ability to stop.
318      * @param callerToken, caller ability token.
319      * @param userId, Designation User ID.
320      * @param extensionType If an ExtensionAbilityType is set, only extension of that type can be stopped.
321      * @return Returns ERR_OK on success, others on failure.
322      */
323     virtual int StopExtensionAbility(
324         const Want& want,
325         const sptr<IRemoteObject>& callerToken,
326         int32_t userId = DEFAULT_INVAL_VALUE,
327         AppExecFwk::ExtensionAbilityType extensionType = AppExecFwk::ExtensionAbilityType::UNSPECIFIED) override;
328     /**
329      * TerminateAbility, terminate the special ability.
330      *
331      * @param token, the token of the ability to terminate.
332      * @param resultCode, the resultCode of the ability to terminate.
333      * @param resultWant, the Want of the ability to return.
334      * @return Returns ERR_OK on success, others on failure.
335      */
336     virtual int TerminateAbility(
337         const sptr<IRemoteObject> &token, int resultCode, const Want *resultWant = nullptr) override;
338 
339     /**
340      * BackToCallerAbilityWithResult, return to the caller ability.
341      *
342      * @param token, the token of the ability to terminate.
343      * @param resultCode, the resultCode of the ability to terminate.
344      * @param resultWant, the Want of the ability to return.
345      * @param callerRequestCode, the requestCode of caller ability.
346      * @return Returns ERR_OK on success, others on failure.
347      */
348     virtual int BackToCallerAbilityWithResult(const sptr<IRemoteObject> &token, int resultCode,
349         const Want *resultWant, int64_t callerRequestCode) override;
350 
351     /**
352      * TerminateUIServiceExtensionAbility, terminate UIServiceExtensionAbility.
353      *
354      * @param token, the token of the UIServiceExtensionAbility to terminate.
355      * @return Returns ERR_OK on success, others on failure.
356      */
357     virtual int32_t TerminateUIServiceExtensionAbility(const sptr<IRemoteObject> &token) override;
358 
359     /**
360      * TerminateUIExtensionAbility, terminate the special ui extension ability.
361      *
362      * @param extensionSessionInfo the extension session info of the ability to terminate.
363      * @param resultCode resultCode.
364      * @param Want Ability want returned.
365      * @return Returns ERR_OK on success, others on failure.
366      */
367     virtual int TerminateUIExtensionAbility(const sptr<SessionInfo> &extensionSessionInfo, int resultCode,
368         const Want *resultWant) override;
369 
370     /**
371      * CloseUIExtensionAbilityBySCB, terminate the specified ui extension ability by SCB.
372      *
373      * @param token the ability token.
374      * @return Returns ERR_OK on success, others on failure.
375      */
376     int CloseUIExtensionAbilityBySCB(const sptr<IRemoteObject> token) override;
377 
378     /**
379      * CloseUIAbilityBySCB, close the special ability by scb.
380      *
381      * @param sessionInfo the session info of the ability to terminate.
382      * @return Returns ERR_OK on success, others on failure.
383      */
384     virtual int CloseUIAbilityBySCB(const sptr<SessionInfo> &sessionInfo) override;
385 
386     /**
387      * SendResultToAbility with want, return want from ability manager service.(Only used for dms)
388      *
389      * @param requestCode, request code.
390      * @param resultCode, resultCode to return.
391      * @param resultWant, the Want of the ability to return.
392      * @return Returns ERR_OK on success, others on failure.
393      */
394     virtual int SendResultToAbility(int32_t requestCode, int32_t resultCode, Want& resultWant) override;
395 
396     /**
397      * MoveAbilityToBackground.
398      *
399      * @param token, the token of the ability to move.
400      * @return Returns ERR_OK on success, others on failure.
401      */
402     virtual int MoveAbilityToBackground(const sptr<IRemoteObject> &token) override;
403 
404     /**
405      * Move the UIAbility to background, called by app self.
406      *
407      * @param token the token of the ability to move.
408      * @return Returns ERR_OK on success, others on failure.
409      */
410     virtual int32_t MoveUIAbilityToBackground(const sptr<IRemoteObject> token) override;
411 
412     /**
413      * CloseAbility, close the special ability.
414      *
415      * @param token, the token of the ability to terminate.
416      * @param resultCode, the resultCode of the ability to terminate.
417      * @param resultWant, the Want of the ability to return.
418      * @return Returns ERR_OK on success, others on failure.
419      */
420     virtual int CloseAbility(
421         const sptr<IRemoteObject> &token, int resultCode, const Want *resultWant = nullptr) override;
422 
423     /**
424      * MinimizeAbility, minimize the special ability.
425      *
426      * @param token, ability token.
427      * @param fromUser mark the minimize operation source.
428      * @return Returns ERR_OK on success, others on failure.
429      */
430     virtual int MinimizeAbility(const sptr<IRemoteObject> &token, bool fromUser = false) override;
431 
432     /**
433      * MinimizeUIExtensionAbility, minimize the special ui extension ability.
434      *
435      * @param extensionSessionInfo the extension session info of the ability to minimize.
436      * @param fromUser mark the minimize operation source.
437      * @return Returns ERR_OK on success, others on failure.
438      */
439     virtual int MinimizeUIExtensionAbility(const sptr<SessionInfo> &extensionSessionInfo,
440         bool fromUser = false) override;
441 
442     /**
443      * MinimizeUIAbilityBySCB, minimize the special ability by scb.
444      *
445      * @param sessionInfo the session info of the ability to minimize.
446      * @param fromUser, Whether form user.
447      * @return Returns ERR_OK on success, others on failure.
448      */
449     virtual int MinimizeUIAbilityBySCB(const sptr<SessionInfo> &sessionInfo, bool fromUser = false,
450         uint32_t sceneFlag = 0) override;
451 
452     /**
453      * ConnectAbility, connect session with service ability.
454      *
455      * @param want, Special want for service type's ability.
456      * @param connect, Callback used to notify caller the result of connecting or disconnecting.
457      * @param callerToken, caller ability token.
458      * @param userId, Designation User ID.
459      * @return Returns ERR_OK on success, others on failure.
460      */
461     virtual int ConnectAbility(
462         const Want &want,
463         const sptr<IAbilityConnection> &connect,
464         const sptr<IRemoteObject> &callerToken,
465         int32_t userId = DEFAULT_INVAL_VALUE) override;
466 
467     virtual int ConnectAbilityCommon(
468         const Want &want,
469         const sptr<IAbilityConnection> &connect,
470         const sptr<IRemoteObject> &callerToken,
471         AppExecFwk::ExtensionAbilityType extensionType,
472         int32_t userId = DEFAULT_INVAL_VALUE,
473         bool isQueryExtensionOnly = false) override;
474 
475     virtual int ConnectUIExtensionAbility(
476         const Want &want,
477         const sptr<IAbilityConnection> &connect,
478         const sptr<SessionInfo> &sessionInfo,
479         int32_t userId = DEFAULT_INVAL_VALUE,
480         sptr<UIExtensionAbilityConnectInfo> connectInfo = nullptr) override;
481 
482     /**
483      * DisconnectAbility, connect session with service ability.
484      *
485      * @param connect, Callback used to notify caller the result of connecting or disconnecting.
486      * @return Returns ERR_OK on success, others on failure.
487      */
488     virtual int DisconnectAbility(sptr<IAbilityConnection> connect) override;
489 
490     /**
491      * AcquireDataAbility, acquire a data ability by its authority, if it not existed,
492      * AMS loads it synchronously.
493      *
494      * @param uri, data ability uri.
495      * @param isKill, true: when a data ability is died, ams will kill this client, or do nothing.
496      * @param callerToken, specifies the caller ability token.
497      * @return returns the data ability ipc object, or nullptr for failed.
498      */
499     virtual sptr<IAbilityScheduler> AcquireDataAbility(
500         const Uri &uri, bool isKill, const sptr<IRemoteObject> &callerToken) override;
501 
502     /**
503      * ReleaseDataAbility, release the data ability that referenced by 'dataAbilityToken'.
504      *
505      * @param dataAbilityScheduler, specifies the data ability that will be released.
506      * @param callerToken, specifies the caller ability token.
507      * @return returns ERR_OK if succeeded, or error codes for failed.
508      */
509     virtual int ReleaseDataAbility(
510         sptr<IAbilityScheduler> dataAbilityScheduler, const sptr<IRemoteObject> &callerToken) override;
511 
512     /**
513      * AttachAbilityThread, ability call this interface after loaded.
514      *
515      * @param scheduler,.the interface handler of kit ability.
516      * @param token,.ability's token.
517      * @return Returns ERR_OK on success, others on failure.
518      */
519     virtual int AttachAbilityThread(
520         const sptr<IAbilityScheduler> &scheduler, const sptr<IRemoteObject> &token) override;
521 
522     /**
523      * AbilityTransitionDone, ability call this interface after lift cycle was changed.
524      *
525      * @param token,.ability's token.
526      * @param state,.the state of ability lift cycle.
527      * @return Returns ERR_OK on success, others on failure.
528      */
529     virtual int AbilityTransitionDone(const sptr<IRemoteObject> &token, int state, const PacMap &saveData) override;
530 
531     /**
532      * AbilityWindowConfigTransitionDone, ability call this interface after lift cycle was changed.
533      *
534      * @param token,.ability's token.
535      * @return Returns ERR_OK on success, others on failure.
536      */
537     virtual int AbilityWindowConfigTransitionDone(
538         const sptr<IRemoteObject> &token, const WindowConfig &windowConfig) override;
539 
540     /**
541      * ScheduleConnectAbilityDone, service ability call this interface while session was connected.
542      *
543      * @param token,.service ability's token.
544      * @param remoteObject,.the session proxy of service ability.
545      * @return Returns ERR_OK on success, others on failure.
546      */
547     virtual int ScheduleConnectAbilityDone(
548         const sptr<IRemoteObject> &token, const sptr<IRemoteObject> &remoteObject) override;
549 
550     /**
551      * ScheduleDisconnectAbilityDone, service ability call this interface while session was disconnected.
552      *
553      * @param token,.service ability's token.
554      * @return Returns ERR_OK on success, others on failure.
555      */
556     virtual int ScheduleDisconnectAbilityDone(const sptr<IRemoteObject> &token) override;
557 
558     /**
559      * ScheduleCommandAbilityDone, service ability call this interface while session was commanded.
560      *
561      * @param token,.service ability's token.
562      * @return Returns ERR_OK on success, others on failure.
563      */
564     virtual int ScheduleCommandAbilityDone(const sptr<IRemoteObject> &token) override;
565 
566     virtual int ScheduleCommandAbilityWindowDone(
567         const sptr<IRemoteObject> &token,
568         const sptr<SessionInfo> &sessionInfo,
569         WindowCommand winCmd,
570         AbilityCommand abilityCmd) override;
571 
572     /**
573      * dump ability stack info, about userID, mission stack info,
574      * mission record info and ability info.
575      *
576      * @param state Ability stack info.
577      * @return Returns ERR_OK on success, others on failure.
578      */
579     virtual void DumpState(const std::string &args, std::vector<std::string> &state) override;
580     virtual void DumpSysState(
581         const std::string& args, std::vector<std::string>& state, bool isClient, bool isUserID, int UserID) override;
582 
583     /**
584      * Destroys this Service ability by Want.
585      *
586      * @param want, Special want for service type's ability.
587      * @param token ability's token.
588      * @return Returns true if this Service ability will be destroyed; returns false otherwise.
589      */
590     virtual int StopServiceAbility(const Want &want, int32_t userId = DEFAULT_INVAL_VALUE,
591         const sptr<IRemoteObject> &token = nullptr) override;
592 
593     /**
594      * Get top ability.
595      *
596      * @param isNeedLocalDeviceId is need local device id.
597      * @return Returns front desk focus ability elementName.
598      */
599     virtual AppExecFwk::ElementName GetTopAbility(bool isNeedLocalDeviceId = true) override;
600 
601     /**
602      * Get element name by token.
603      *
604      * @param token ability's token.
605      * @param isNeedLocalDeviceId is need local device id.
606      * @return Returns front desk focus ability elementName by token.
607      */
608     virtual AppExecFwk::ElementName GetElementNameByToken(sptr<IRemoteObject> token,
609         bool isNeedLocalDeviceId = true) override;
610 
611     /**
612      * Kill the process immediately.
613      *
614      * @param bundleName.
615      * @return Returns ERR_OK on success, others on failure.
616      */
617     virtual int KillProcess(const std::string &bundleName, const bool clearPageStack = true) override;
618 
619     #ifdef ABILITY_COMMAND_FOR_TEST
620     /**
621      * force timeout ability.
622      *
623      * @param abilityName.
624      * @param state.
625      * @return Returns ERR_OK on success, others on failure.
626      */
627     virtual int ForceTimeoutForTest(const std::string &abilityName, const std::string &state) override;
628     #endif
629 
630     /**
631      * Uninstall app
632      *
633      * @param bundleName bundle name of uninstalling app.
634      * @param uid uid of bundle.
635      * @return Returns ERR_OK on success, others on failure.
636      */
637     virtual int UninstallApp(const std::string &bundleName, int32_t uid) override;
638 
639     /**
640      * Uninstall app
641      *
642      * @param bundleName bundle name of uninstalling app.
643      * @param uid uid of bundle.
644      * @param appIndex the app index of app clone.
645      * @return Returns ERR_OK on success, others on failure.
646      */
647     virtual int32_t UninstallApp(const std::string &bundleName, int32_t uid, int32_t appIndex) override;
648 
649     /**
650      * Upgrade app, record exit reason and kill application
651      *
652      * @param bundleName bundle name of upgrading app.
653      * @param uid uid of bundle.
654      * @param exitMsg the exit reason message.
655      * @param appIndex the app index of app clone.
656      * @return Returns ERR_OK on success, others on failure.
657      */
658     virtual int32_t UpgradeApp(const std::string &bundleName, const int32_t uid, const std::string &exitMsg,
659         int32_t appIndex = 0) override;
660 
661     virtual sptr<IWantSender> GetWantSender(
662         const WantSenderInfo &wantSenderInfo, const sptr<IRemoteObject> &callerToken, int32_t uid = -1) override;
663 
664     virtual int SendWantSender(sptr<IWantSender> target, const SenderInfo &senderInfo) override;
665 
666     virtual void CancelWantSender(const sptr<IWantSender> &sender) override;
667 
668     virtual int GetPendingWantUid(const sptr<IWantSender> &target) override;
669 
670     virtual int GetPendingWantUserId(const sptr<IWantSender> &target) override;
671 
672     virtual std::string GetPendingWantBundleName(const sptr<IWantSender> &target) override;
673 
674     virtual int GetPendingWantCode(const sptr<IWantSender> &target) override;
675 
676     virtual int GetPendingWantType(const sptr<IWantSender> &target) override;
677 
678     virtual void RegisterCancelListener(const sptr<IWantSender> &sender, const sptr<IWantReceiver> &receiver) override;
679 
680     virtual void UnregisterCancelListener(
681         const sptr<IWantSender> &sender, const sptr<IWantReceiver> &receiver) override;
682 
683     virtual int GetPendingRequestWant(const sptr<IWantSender> &target, std::shared_ptr<Want> &want) override;
684 
685     virtual int GetWantSenderInfo(const sptr<IWantSender> &target, std::shared_ptr<WantSenderInfo> &info) override;
686 
687     virtual int GetAppMemorySize() override;
688 
689     virtual bool IsRamConstrainedDevice() override;
690     virtual int ContinueMission(const std::string &srcDeviceId, const std::string &dstDeviceId,
691         int32_t missionId, const sptr<IRemoteObject> &callBack, AAFwk::WantParams &wantParams) override;
692 
693     virtual int ContinueMission(AAFwk::ContinueMissionInfo continueMissionInfo,
694         const sptr<IRemoteObject> &callback) override;
695 
696     virtual int ContinueAbility(const std::string &deviceId, int32_t missionId, uint32_t versionCode) override;
697 
698     virtual int StartContinuation(const Want &want, const sptr<IRemoteObject> &abilityToken, int32_t status) override;
699 
700     virtual void NotifyCompleteContinuation(const std::string &deviceId, int32_t sessionId, bool isSuccess) override;
701 
702     virtual int NotifyContinuationResult(int32_t missionId, int32_t result) override;
703 
704     virtual int StartSyncRemoteMissions(const std::string& devId, bool fixConflict, int64_t tag) override;
705 
706     virtual int StopSyncRemoteMissions(const std::string& devId) override;
707 
708     virtual int LockMissionForCleanup(int32_t missionId) override;
709 
710     virtual int UnlockMissionForCleanup(int32_t missionId) override;
711 
712     virtual void SetLockedState(int32_t sessionId, bool lockedState) override;
713 
714     virtual int RegisterMissionListener(const sptr<IMissionListener> &listener) override;
715 
716     virtual int UnRegisterMissionListener(const sptr<IMissionListener> &listener) override;
717 
718     virtual int GetMissionInfos(const std::string& deviceId, int32_t numMax,
719         std::vector<MissionInfo> &missionInfos) override;
720 
721     virtual int GetMissionInfo(const std::string& deviceId, int32_t missionId,
722         MissionInfo &missionInfos) override;
723 
724     virtual int CleanMission(int32_t missionId) override;
725 
726     virtual int CleanAllMissions() override;
727 
728     virtual int MoveMissionToFront(int32_t missionId) override;
729 
730     virtual int MoveMissionToFront(int32_t missionId, const StartOptions &startOptions) override;
731 
732     virtual int MoveMissionsToForeground(const std::vector<int32_t>& missionIds, int32_t topMissionId) override;
733 
734     virtual int MoveMissionsToBackground(const std::vector<int32_t>& missionIds,
735         std::vector<int32_t>& result) override;
736 
737     /**
738      * Start Ability, connect session with common ability.
739      *
740      * @param want, Special want for service type's ability.
741      * @param connect, Callback used to notify caller the result of connecting or disconnecting.
742      * @param accountId Indicates the account to start.
743      * @return Returns ERR_OK on success, others on failure.
744      */
745     virtual int StartAbilityByCall(const Want &want, const sptr<IAbilityConnection> &connect,
746         const sptr<IRemoteObject> &callerToken, int32_t accountId = DEFAULT_INVAL_VALUE) override;
747 
748     /**
749      * CallRequestDone, after invoke callRequest, ability will call this interface to return callee.
750      *
751      * @param token, ability's token.
752      * @param callStub, ability's callee.
753      */
754     void CallRequestDone(const sptr<IRemoteObject> &token, const sptr<IRemoteObject> &callStub) override;
755 
756     /**
757      * Release the call between Ability, disconnect session with common ability.
758      *
759      * @param connect, Callback used to notify caller the result of connecting or disconnecting.
760      * @param element, the element of target service.
761      * @return Returns ERR_OK on success, others on failure.
762      */
763     virtual int ReleaseCall(
764         const sptr<IAbilityConnection> &connect, const AppExecFwk::ElementName &element) override;
765 
766     virtual int StartUser(int userId, sptr<IUserCallback> callback) override;
767 
768     virtual int StopUser(int userId, const sptr<IUserCallback> &callback) override;
769 
770     virtual int LogoutUser(int32_t userId) override;
771 
772     virtual int SetMissionContinueState(const sptr<IRemoteObject> &token, const AAFwk::ContinueState &state) override;
773 
774 #ifdef SUPPORT_GRAPHICS
775     virtual int SetMissionLabel(const sptr<IRemoteObject> &abilityToken, const std::string &label) override;
776 
777     virtual int SetMissionIcon(const sptr<IRemoteObject> &token,
778         const std::shared_ptr<OHOS::Media::PixelMap> &icon) override;
779 
780     virtual int RegisterWindowManagerServiceHandler(const sptr<IWindowManagerServiceHandler>& handler,
781         bool animationEnabled) override;
782 
783     virtual void CompleteFirstFrameDrawing(const sptr<IRemoteObject> &abilityToken) override;
784 
785     virtual void CompleteFirstFrameDrawing(int32_t sessionId) override;
786 
787     virtual int PrepareTerminateAbility(
788         const sptr<IRemoteObject> &token, sptr<IPrepareTerminateCallback> &callback) override;
789 
790     virtual int GetDialogSessionInfo(const std::string &dialogSessionId, sptr<DialogSessionInfo> &info) override;
791 
792     virtual int SendDialogResult(const Want &want, const std::string &dialogSessionId, bool isAllow) override;
793 
794     virtual int RegisterAbilityFirstFrameStateObserver(const sptr<IAbilityFirstFrameStateObserver> &observer,
795         const std::string &targetBundleName) override;
796 
797     virtual int UnregisterAbilityFirstFrameStateObserver(
798         const sptr<IAbilityFirstFrameStateObserver> &observer) override;
799 #endif
800 
801     virtual int GetAbilityRunningInfos(std::vector<AbilityRunningInfo> &info) override;
802 
803     virtual int GetExtensionRunningInfos(int upperLimit, std::vector<ExtensionRunningInfo> &info) override;
804 
805     virtual int GetProcessRunningInfos(std::vector<AppExecFwk::RunningProcessInfo> &info) override;
806 
807     virtual int RegisterMissionListener(const std::string &deviceId,
808         const sptr<IRemoteMissionListener> &listener) override;
809 
810     virtual int RegisterOnListener(const std::string &type,
811         const sptr<IRemoteOnListener> &listener) override;
812 
813     virtual int RegisterOffListener(const std::string &deviceId,
814         const sptr<IRemoteOnListener> &listener) override;
815 
816     virtual int UnRegisterMissionListener(const std::string &deviceId,
817         const sptr<IRemoteMissionListener> &listener) override;
818 
819     /**
820      * Set ability controller.
821      *
822      * @param abilityController, The ability controller.
823      * @return Returns ERR_OK on success, others on failure.
824      */
825     virtual int SetAbilityController(const sptr<AppExecFwk::IAbilityController> &abilityController,
826         bool imAStabilityTest) override;
827 
828     /**
829      * Is user a stability test.
830      *
831      * @return Returns true if user is a stability test.
832      */
833     virtual bool IsRunningInStabilityTest() override;
834 
835     virtual int RegisterSnapshotHandler(const sptr<ISnapshotHandler>& handler) override;
836 
837     virtual int GetMissionSnapshot(const std::string& deviceId, int32_t missionId,
838         MissionSnapshot& snapshot, bool isLowResolution) override;
839 
840     virtual int StartUserTest(const Want &want, const sptr<IRemoteObject> &observer) override;
841 
842     virtual int FinishUserTest(
843         const std::string &msg, const int64_t &resultCode, const std::string &bundleName) override;
844 
845      /**
846      * GetTopAbility, get the token of top ability.
847      *
848      * @param token, the token of top ability.
849      * @return Returns ERR_OK on success, others on failure.
850      */
851     virtual int GetTopAbility(sptr<IRemoteObject> &token) override;
852 
853     virtual int CheckUIExtensionIsFocused(uint32_t uiExtensionTokenId, bool& isFocused) override;
854 
855     /**
856      * The delegator calls this interface to move the ability to the foreground.
857      *
858      * @param token, ability's token.
859      * @return Returns ERR_OK on success, others on failure.
860      */
861     virtual int DelegatorDoAbilityForeground(const sptr<IRemoteObject> &token) override;
862 
863     /**
864      * The delegator calls this interface to move the ability to the background.
865      *
866      * @param token, ability's token.
867      * @return Returns ERR_OK on success, others on failure.
868      */
869     virtual int DelegatorDoAbilityBackground(const sptr<IRemoteObject> &token) override;
870 
871     /**
872      * Calls this interface to move the ability to the foreground.
873      *
874      * @param token, ability's token.
875      * @param flag, use for lock or unlock flag and so on.
876      * @return Returns ERR_OK on success, others on failure.
877      */
878     virtual int DoAbilityForeground(const sptr<IRemoteObject> &token, uint32_t flag) override;
879 
880     /**
881      * Calls this interface to move the ability to the background.
882      *
883      * @param token, ability's token.
884      * @param flag, use for lock or unlock flag and so on.
885      * @return Returns ERR_OK on success, others on failure.
886      */
887     virtual int DoAbilityBackground(const sptr<IRemoteObject> &token, uint32_t flag) override;
888 
889     /**
890      * Get mission id by ability token.
891      *
892      * @param token The token of ability.
893      * @return Returns -1 if do not find mission, otherwise return mission id.
894      */
895     virtual int32_t GetMissionIdByToken(const sptr<IRemoteObject> &token) override;
896 
897     /**
898      * Get ability token by connect.
899      *
900      * @param token The token of ability.
901      * @param callStub The callee object.
902      */
903     void GetAbilityTokenByCalleeObj(const sptr<IRemoteObject> &callStub, sptr<IRemoteObject> &token) override;
904 
905     /**
906      * Call free install from remote.
907      *
908      * @param want, the want of the ability to start.
909      * @param userId, Designation User ID.
910      * @param requestCode, Ability request code.
911      * @param callback, Callback from remote.
912      * @return Returns ERR_OK on success, others on failure.
913      */
914     virtual int FreeInstallAbilityFromRemote(const Want &want, const sptr<IRemoteObject> &callback,
915         int32_t userId, int requestCode = DEFAULT_INVAL_VALUE) override;
916 
917     /**
918      * Add FreeInstall Observer
919      *
920      * @param observer the observer of ability free install start.
921      * @return Returns ERR_OK on success, others on failure.
922      */
923     virtual int AddFreeInstallObserver(const sptr<IRemoteObject> &callerToken,
924         const sptr<AbilityRuntime::IFreeInstallObserver> &observer) override;
925 
926     /**
927      * Called when client complete dump.
928      *
929      * @param infos The dump info.
930      * @return Returns ERR_OK on success, others on failure.
931      */
932     virtual int DumpAbilityInfoDone(std::vector<std::string> &infos, const sptr<IRemoteObject> &callerToken) override;
933 
934     /**
935      * Called to update mission snapshot.
936      * @param token The target ability.
937      * @param pixelMap The snapshot.
938      */
939     virtual void UpdateMissionSnapShot(const sptr<IRemoteObject> &token,
940         const std::shared_ptr<Media::PixelMap> &pixelMap) override;
941     virtual void EnableRecoverAbility(const sptr<IRemoteObject>& token) override;
942     virtual void SubmitSaveRecoveryInfo(const sptr<IRemoteObject>& token) override;
943     virtual void ScheduleRecoverAbility(const sptr<IRemoteObject> &token, int32_t reason,
944         const Want *want = nullptr) override;
945 
946     virtual void ScheduleClearRecoveryPageStack() override;
947 
948     /**
949      * Called to verify that the MissionId is valid.
950      * @param missionIds Query mission list.
951      * @param results Output parameters, return results up to 20 query results.
952      * @return Returns ERR_OK on success, others on failure.
953      */
954     int32_t IsValidMissionIds(
955         const std::vector<int32_t> &missionIds, std::vector<MissionValidResult> &results) override;
956 
957     /**
958      * Query whether the application of the specified PID and UID has been granted a certain permission
959      * @param permission
960      * @param pid Process id
961      * @param uid
962      * @return Returns ERR_OK if the current process has the permission, others on failure.
963      */
964     virtual int VerifyPermission(const std::string &permission, int pid, int uid) override;
965 
966     /**
967      * Request dialog service with want, send want to ability manager service.
968      *
969      * @param want, the want of the dialog service to start.
970      * @param callerToken, caller ability token.
971      * @return Returns ERR_OK on success, others on failure.
972      */
973     virtual int32_t RequestDialogService(const Want &want, const sptr<IRemoteObject> &callerToken) override;
974 
975     int32_t ReportDrawnCompleted(const sptr<IRemoteObject> &callerToken) override;
976 
977     virtual int32_t AcquireShareData(
978         const int32_t &missionId, const sptr<IAcquireShareDataCallback> &shareData) override;
979     virtual int32_t ShareDataDone(const sptr<IRemoteObject> &token,
980         const int32_t &resultCode, const int32_t &uniqueId, WantParams &wantParam) override;
981 
982     /**
983      * Force app exit and record exit reason.
984      * @param pid Process id .
985      * @param exitReason The reason of app exit.
986      * @return Returns ERR_OK on success, others on failure.
987      */
988     virtual int32_t ForceExitApp(const int32_t pid, const ExitReason &exitReason) override;
989 
990     /**
991      * Record app exit reason.
992      * @param exitReason The reason of app exit.
993      * @return Returns ERR_OK on success, others on failure.
994      */
995     virtual int32_t RecordAppExitReason(const ExitReason &exitReason) override;
996 
997     /**
998      * Record the process exit reason before the process being killed.
999      * @param pid The process id.
1000      * @param exitReason The reason of process exit.
1001      * @return Returns ERR_OK on success, others on failure.
1002      */
1003     virtual int32_t RecordProcessExitReason(const int32_t pid, const ExitReason &exitReason) override;
1004 
1005     /**
1006      * Set rootSceneSession by SCB.
1007      *
1008      * @param rootSceneSession Indicates root scene session of SCB.
1009      */
1010     virtual void SetRootSceneSession(const sptr<IRemoteObject> &rootSceneSession) override;
1011 
1012     /**
1013      * Call UIAbility by SCB.
1014      *
1015      * @param sessionInfo the session info of the ability to be called.
1016      * @param isColdStart the session of the ability is or not cold start.
1017      */
1018     virtual void CallUIAbilityBySCB(const sptr<SessionInfo> &sessionInfo, bool &isColdStart) override;
1019 
1020     /**
1021      * Start specified ability by SCB.
1022      *
1023      * @param want Want information.
1024      */
1025     void StartSpecifiedAbilityBySCB(const Want &want) override;
1026 
1027     /**
1028      * Notify sandbox app the result of saving file.
1029      * @param want Result of saving file, which contains the file's uri if success.
1030      * @param resultCode Indicates the action's result.
1031      * @param requestCode Pass the requestCode to match request.
1032      * @return Returns ERR_OK on success, others on failure.
1033      */
1034     virtual int32_t NotifySaveAsResult(const Want &want, int resultCode, int requestCode) override;
1035 
1036     /**
1037      * Set sessionManagerService
1038      * @param sessionManagerService the point of sessionManagerService.
1039      *
1040      * @return Returns ERR_OK on success, others on failure.
1041      */
1042     virtual int32_t SetSessionManagerService(const sptr<IRemoteObject> &sessionManagerService) override;
1043 
1044     /**
1045      * @brief Register collaborator.
1046      * @param type collaborator type.
1047      * @param impl collaborator.
1048      * @return 0 or else.
1049     */
1050     virtual int32_t RegisterIAbilityManagerCollaborator(
1051         int32_t type, const sptr<IAbilityManagerCollaborator> &impl) override;
1052 
1053     /**
1054      * @brief Unregister collaborator.
1055      * @param type collaborator type.
1056      * @return 0 or else.
1057     */
1058     virtual int32_t UnregisterIAbilityManagerCollaborator(int32_t type) override;
1059 
1060     virtual int32_t RegisterStatusBarDelegate(sptr<AbilityRuntime::IStatusBarDelegate> delegate) override;
1061 
1062     virtual int32_t KillProcessWithPrepareTerminate(const std::vector<int32_t>& pids) override;
1063 
1064     /**
1065      * @brief Register auto start up callback for system api.
1066      * @param callback The point of JsAbilityAutoStartupCallBack.
1067      * @return Returns ERR_OK on success, others on failure.
1068      */
1069     virtual int32_t RegisterAutoStartupSystemCallback(const sptr<IRemoteObject> &callback) override;
1070 
1071     /**
1072      * @brief Unregister auto start up callback for system api.
1073      * @param callback The point of JsAbilityAutoStartupCallBack.
1074      * @return Returns ERR_OK on success, others on failure.
1075      */
1076     virtual int32_t UnregisterAutoStartupSystemCallback(const sptr<IRemoteObject> &callback) override;
1077 
1078     /**
1079      * @brief Set every application auto start up state.
1080      * @param info The auto startup info,include bundle name, module name, ability name.
1081      * @return Returns ERR_OK on success, others on failure.
1082      */
1083     virtual int32_t SetApplicationAutoStartup(const AutoStartupInfo &info) override;
1084 
1085     /**
1086      * @brief Cancel every application auto start up .
1087      * @param info The auto startup info,include bundle name, module name, ability name.
1088      * @return Returns ERR_OK on success, others on failure.
1089      */
1090     virtual int32_t CancelApplicationAutoStartup(const AutoStartupInfo &info) override;
1091 
1092     /**
1093      * @brief Query auto startup state all application.
1094      * @param infoList Output parameters, return auto startup info list.
1095      * @return Returns ERR_OK on success, others on failure.
1096      */
1097     virtual int32_t QueryAllAutoStartupApplications(std::vector<AutoStartupInfo> &infoList) override;
1098 
1099     /**
1100      * PrepareTerminateAbilityBySCB, prepare to terminate ability by scb.
1101      *
1102      * @param sessionInfo the session info of the ability to start.
1103      * @param isPrepareTerminate the result of ability onPrepareToTermiante.
1104      * @return Returns ERR_OK on success, others on failure.
1105      */
1106     virtual int PrepareTerminateAbilityBySCB(const sptr<SessionInfo> &sessionInfo, bool &isPrepareTerminate) override;
1107     virtual int RegisterSessionHandler(const sptr<IRemoteObject> &object) override;
1108 
1109     /**
1110      * @brief Register app debug listener.
1111      * @param listener App debug listener.
1112      * @return Returns ERR_OK on success, others on failure.
1113      */
1114     int32_t RegisterAppDebugListener(sptr<AppExecFwk::IAppDebugListener> listener) override;
1115 
1116     /**
1117      * @brief Unregister app debug listener.
1118      * @param listener App debug listener.
1119      * @return Returns ERR_OK on success, others on failure.
1120      */
1121     int32_t UnregisterAppDebugListener(sptr<AppExecFwk::IAppDebugListener> listener) override;
1122 
1123     /**
1124      * @brief Attach app debug.
1125      * @param bundleName The application bundle name.
1126      * @return Returns ERR_OK on success, others on failure.
1127      */
1128     int32_t AttachAppDebug(const std::string &bundleName) override;
1129 
1130     /**
1131      * @brief Detach app debug.
1132      * @param bundleName The application bundle name.
1133      * @return Returns ERR_OK on success, others on failure.
1134      */
1135     int32_t DetachAppDebug(const std::string &bundleName) override;
1136 
1137     /**
1138      * @brief Execute intent.
1139      * @param key The key of intent executing client.
1140      * @param callerToken Caller ability token.
1141      * @param param The Intent execute param.
1142      * @return Returns ERR_OK on success, others on failure.
1143      */
1144     int32_t ExecuteIntent(uint64_t key, const sptr<IRemoteObject> &callerToken,
1145         const InsightIntentExecuteParam &param) override;
1146 
1147     /**
1148      * @brief Check if ability controller can start.
1149      * @param want The want of ability to start.
1150      * @return Return true to allow ability to start, or false to reject.
1151      */
1152     virtual bool IsAbilityControllerStart(const Want &want) override;
1153 
1154     /**
1155      * @brief Called when insight intent execute finished.
1156      *
1157      * @param token ability's token.
1158      * @param intentId insight intent id.
1159      * @param result insight intent execute result.
1160      * @return Returns ERR_OK on success, others on failure.
1161      */
1162     int32_t ExecuteInsightIntentDone(const sptr<IRemoteObject> &token, uint64_t intentId,
1163         const InsightIntentExecuteResult &result) override;
1164 
1165     /**
1166      * @brief Set application auto start up state by EDM.
1167      * @param info The auto startup info, include bundle name, module name, ability name.
1168      * @param flag Indicate whether to allow the application to change the auto start up state.
1169      * @return Returns ERR_OK on success, others on failure.
1170      */
1171     int32_t SetApplicationAutoStartupByEDM(const AutoStartupInfo &info, bool flag) override;
1172 
1173     /**
1174      * @brief Cancel application auto start up state by EDM.
1175      * @param info The auto startup info, include bundle name, module name, ability name.
1176      * @param flag Indicate whether to allow the application to change the auto start up state.
1177      * @return Returns ERR_OK on success, others on failure.
1178      */
1179     int32_t CancelApplicationAutoStartupByEDM(const AutoStartupInfo &info, bool flag) override;
1180 
1181     /**
1182      * @brief Get foreground ui abilities.
1183      * @param list Foreground ui abilities.
1184      * @return Returns ERR_OK on success, others on failure.
1185      */
1186     int32_t GetForegroundUIAbilities(std::vector<AppExecFwk::AbilityStateData> &list) override;
1187 
1188     /**
1189      * @brief Open file by uri.
1190      * @param uri The file uri.
1191      * @param flag Want::FLAG_AUTH_READ_URI_PERMISSION or Want::FLAG_AUTH_WRITE_URI_PERMISSION.
1192      * @return int The file descriptor.
1193      */
1194     virtual int32_t OpenFile(const Uri& uri, uint32_t flag) override;
1195 
1196     /**
1197      * @brief Update session info.
1198      * @param sessionInfos The vector of session info.
1199      */
1200     virtual int32_t UpdateSessionInfoBySCB(std::list<SessionInfo> &sessionInfos, int32_t userId,
1201         std::vector<int32_t> &sessionIds) override;
1202 
1203     /**
1204      * @brief Restart app self.
1205      * @param want The ability type must be UIAbility.
1206      * @param isAppRecovery True indicates that the app is restarted because of recovery.
1207      * @return Returns ERR_OK on success, others on failure.
1208      */
1209     int32_t RestartApp(const AAFwk::Want &want, bool isAppRecovery = false) override;
1210 
1211     /**
1212      * @brief Get host info of root caller.
1213      *
1214      * @param token The ability token.
1215      * @param hostInfo The host info of root caller.
1216      * @param userId The user id.
1217      * @return int32_t Returns 0 on success, others on failure.
1218      */
1219     int32_t GetUIExtensionRootHostInfo(const sptr<IRemoteObject> token, UIExtensionHostInfo &hostInfo,
1220         int32_t userId = DEFAULT_INVAL_VALUE) override;
1221 
1222     /**
1223      * @brief Get ui extension session info
1224      *
1225      * @param token The ability token.
1226      * @param uiExtensionSessionInfo The ui extension session info.
1227      * @param userId The user id.
1228      * @return int32_t Returns ERR_OK on success, others on failure.
1229      */
1230     int32_t GetUIExtensionSessionInfo(const sptr<IRemoteObject> token, UIExtensionSessionInfo &uiExtensionSessionInfo,
1231         int32_t userId = DEFAULT_INVAL_VALUE) override;
1232 
1233     /**
1234      * @brief Pop-up launch of full-screen atomic service.
1235      * @param want The want with parameters.
1236      * @param callerToken caller ability token.
1237      * @param requestCode Ability request code.
1238      * @param userId The User ID.
1239      * @return Returns ERR_OK on success, others on failure.
1240      */
1241     virtual int32_t OpenAtomicService(Want& want, const StartOptions &options, sptr<IRemoteObject> callerToken,
1242         int32_t requestCode = DEFAULT_INVAL_VALUE, int32_t userId = DEFAULT_INVAL_VALUE) override;
1243 
1244     /**
1245      * @brief Querying whether to allow embedded startup of atomic service.
1246      *
1247      * @param token The caller UIAbility token.
1248      * @param appId The ID of the application to which this bundle belongs.
1249      * @return Returns true to allow ability to start, or false to reject.
1250      */
1251     virtual bool IsEmbeddedOpenAllowed(sptr<IRemoteObject> callerToken, const std::string &appId) override;
1252 
1253     /**
1254      * Set the enable status for starting and stopping resident processes.
1255      * The caller application can only set the resident status of the configured process.
1256      * @param bundleName The bundle name of the resident process.
1257      * @param enable Set resident process enable status.
1258      * @return Returns ERR_OK on success, others on failure.
1259      */
1260     int32_t SetResidentProcessEnabled(const std::string &bundleName, bool enable) override;
1261 
1262     /**
1263      * @brief Request to display assert fault dialog.
1264      * @param callback Listen for user operation callbacks.
1265      * @param wantParams Assert dialog box display information.
1266      * @return Returns ERR_OK on success, others on failure.
1267      */
1268     virtual int32_t RequestAssertFaultDialog(
1269         const sptr<IRemoteObject> &callback, const AAFwk::WantParams &wantParams) override;
1270 
1271     /**
1272      * @brief Notify the operation status of the user.
1273      * @param assertFaultSessionId Indicates the request ID of AssertFault.
1274      * @param userStatus Operation status of the user.
1275      * @return Returns ERR_OK on success, others on failure.
1276      */
1277     virtual int32_t NotifyDebugAssertResult(uint64_t assertFaultSessionId, AAFwk::UserStatus userStatus) override;
1278 
1279     /**
1280      * Starts a new ability with specific start options.
1281      *
1282      * @param want, the want of the ability to start.
1283      * @param startOptions Indicates the options used to start.
1284      * @return Returns ERR_OK on success, others on failure.
1285      */
1286     virtual int32_t StartShortcut(const Want &want, const StartOptions &startOptions) override;
1287 
1288     /**
1289      * Get ability state by persistent id.
1290      *
1291      * @param persistentId, the persistentId of the session.
1292      * @param state Indicates the ability state.
1293      * @return Returns ERR_OK on success, others on failure.
1294      */
1295     virtual int32_t GetAbilityStateByPersistentId(int32_t persistentId, bool &state) override;
1296 
1297     /**
1298      * Transfer resultCode & want to ability manager service.
1299      *
1300      * @param callerToken caller ability token.
1301      * @param requestCode the resultCode of the ability to start.
1302      * @param want Indicates the ability to start.
1303      * @return Returns ERR_OK on success, others on failure.
1304      */
1305     virtual int32_t TransferAbilityResultForExtension(const sptr<IRemoteObject> &callerToken, int32_t resultCode,
1306         const Want &want) override;
1307 
1308     /**
1309      * Notify ability manager service frozen process.
1310      *
1311      * @param pidList, the pid list of the frozen process.
1312      * @param uid, the uid of the frozen process.
1313      */
1314     virtual void NotifyFrozenProcessByRSS(const std::vector<int32_t> &pidList, int32_t uid) override;
1315 
1316     /**
1317      * Open atomic service window prior to finishing free install.
1318      *
1319      * @param bundleName, the bundle name of the atomic service.
1320      * @param moduleName, the module name of the atomic service.
1321      * @param abilityName, the ability name of the atomic service.
1322      * @param startTime, the starting time of the free install task.
1323      * @return Returns ERR_OK on success, others on failure.
1324      */
1325     virtual int32_t PreStartMission(const std::string& bundleName, const std::string& moduleName,
1326         const std::string& abilityName, const std::string& startTime) override;
1327 
1328     /**
1329      *  Request to clean UIAbility from user.
1330      *
1331      * @param sessionInfo the session info of the ability to clean.
1332      * @return Returns ERR_OK on success, others on failure.
1333      */
1334     virtual int32_t CleanUIAbilityBySCB(const sptr<SessionInfo> &sessionInfo) override;
1335 
1336     /**
1337      * Open link of ability and atomic service.
1338      *
1339      * @param want Ability want.
1340      * @param callerToken Caller ability token.
1341      * @param userId User ID.
1342      * @param requestCode Ability request code.
1343      * @return Returns ERR_OK on success, others on failure.
1344     */
1345     virtual int32_t OpenLink(const Want& want, sptr<IRemoteObject> callerToken,
1346         int32_t userId = DEFAULT_INVAL_VALUE, int requestCode = DEFAULT_INVAL_VALUE) override;
1347 
1348     /**
1349      * Terminate the mission.
1350      *
1351      * @param missionId, The mission id of the UIAbility need to be terminated.
1352      * @return Returns ERR_OK on success, others on failure.
1353      */
1354     virtual int32_t TerminateMission(int32_t missionId) override;
1355 
1356     /**
1357      * update associate config list by rss.
1358      *
1359      * @param configs The rss config info.
1360      * @param exportConfigs The rss export config info.
1361      * @param flag UPDATE_CONFIG_FLAG_COVER is cover config, UPDATE_CONFIG_FLAG_APPEND is append config.
1362      */
1363     virtual int32_t UpdateAssociateConfigList(const std::map<std::string, std::list<std::string>>& configs,
1364         const std::list<std::string>& exportConfigs, int32_t flag) override;
1365 
1366     /**
1367      * Query preload uiextension record.
1368      *
1369      * @param element, The uiextension ElementName.
1370      * @param moduleName, The uiextension moduleName.
1371      * @param hostBundleName, The uiextension caller hostBundleName.
1372      * @param recordNum, The returned count of uiextension.
1373      * @param userId, The User Id.
1374      * @return Returns ERR_OK on success, others on failure.
1375      */
1376     virtual int32_t QueryPreLoadUIExtensionRecord(const AppExecFwk::ElementName &element,
1377                                                   const std::string &moduleName,
1378                                                   const std::string &hostBundleName,
1379                                                   int32_t &recordNum,
1380                                                   int32_t userId = DEFAULT_INVAL_VALUE) override;
1381 
1382 private:
1383     template <typename T>
1384     int GetParcelableInfos(MessageParcel &reply, std::vector<T> &parcelableInfos);
1385     bool WriteInterfaceToken(MessageParcel &data);
1386     // flag = true : terminate; flag = false : close
1387     int TerminateAbility(const sptr<IRemoteObject> &token, int resultCode, const Want *resultWant, bool flag);
1388     ErrCode SendRequest(AbilityManagerInterfaceCode code, MessageParcel &data, MessageParcel &reply,
1389         MessageOption& option);
1390     int CheckUISessionParams(MessageParcel &data, const sptr<IRemoteObject> &callerToken,
1391         const sptr<SessionInfo> &sessionInfo, int32_t userId, int requestCode);
1392     bool UpdateAssociateConfigInner(const std::map<std::string, std::list<std::string>>& configs,
1393         MessageParcel& data);
1394 
1395 private:
1396     static inline BrokerDelegator<AbilityManagerProxy> delegator_;
1397 };
1398 }  // namespace AAFwk
1399 }  // namespace OHOS
1400 #endif
1401