• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2023-2025 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_INTERFACE_H
17 #define OHOS_ABILITY_RUNTIME_ABILITY_MANAGER_INTERFACE_H
18 
19 #include <ipc_types.h>
20 #include <iremote_broker.h>
21 #include <list>
22 #include <vector>
23 
24 #include "aa_tools/ability_start_with_wait_observer_interface.h"
25 #include "ability_connect_callback_interface.h"
26 #include "ability_manager_ipc_interface_code.h"
27 #include "ability_running_info.h"
28 #include "ability_scheduler_interface.h"
29 #include "ability_start_setting.h"
30 #include "ability_state.h"
31 #include "ability_state_data.h"
32 #include "app_debug_listener_interface.h"
33 #include "auto_startup_info.h"
34 #include "dms_continueInfo.h"
35 #include "exit_reason.h"
36 #include "extension_running_info.h"
37 #include "free_install_observer_interface.h"
38 #include "iability_controller.h"
39 #include "iability_manager_collaborator.h"
40 #include "iacquire_share_data_callback_interface.h"
41 #include "insight_intent/insight_intent_execute_param.h"
42 #include "insight_intent/insight_intent_execute_result.h"
43 #include "insight_intent/insight_intent_info_for_query.h"
44 #include "iprepare_terminate_callback_interface.h"
45 #include "keep_alive_info.h"
46 #include "mission_info.h"
47 #include "query_erms_observer_interface.h"
48 #include "remote_mission_listener_interface.h"
49 #include "remote_on_listener_interface.h"
50 #include "running_process_info.h"
51 #include "sa_interceptor_interface.h"
52 #include "sender_info.h"
53 #include "start_options.h"
54 #include "user_callback.h"
55 #include "system_memory_attr.h"
56 #include "ui_extension/ui_extension_ability_connect_info.h"
57 #include "ui_extension/ui_extension_host_info.h"
58 #include "ui_extension/ui_extension_session_info.h"
59 #include "ui_extension_window_command.h"
60 #include "uri.h"
61 #include "want.h"
62 #include "want_receiver_interface.h"
63 #include "want_sender_info.h"
64 #include "want_sender_interface.h"
65 #include "dialog_session_info.h"
66 #include "window_config.h"
67 #include "intent_exemption_info.h"
68 #ifdef SUPPORT_SCREEN
69 #include "window_manager_service_handler.h"
70 #include "ability_first_frame_state_observer_interface.h"
71 #endif
72 #include "ihidden_start_observer.h"
73 #include "kiosk_status.h"
74 
75 namespace OHOS {
76 namespace AbilityRuntime {
77 class IStatusBarDelegate;
78 }
79 
80 namespace AAFwk {
81 class Snapshot;
82 class IMissionListener;
83 class ISnapshotHandler;
84 struct MissionSnapshot;
85 using KeepAliveInfo = AbilityRuntime::KeepAliveInfo;
86 using AutoStartupInfo = AbilityRuntime::AutoStartupInfo;
87 using InsightIntentExecuteParam = AppExecFwk::InsightIntentExecuteParam;
88 using InsightIntentExecuteResult = AppExecFwk::InsightIntentExecuteResult;
89 using UIExtensionAbilityConnectInfo = AbilityRuntime::UIExtensionAbilityConnectInfo;
90 using UIExtensionHostInfo = AbilityRuntime::UIExtensionHostInfo;
91 using UIExtensionSessionInfo = AbilityRuntime::UIExtensionSessionInfo;
92 #ifdef SUPPORT_SCREEN
93 using IAbilityFirstFrameStateObserver = AppExecFwk::IAbilityFirstFrameStateObserver;
94 #endif
95 using AtomicServiceStartupRule = AbilityRuntime::AtomicServiceStartupRule;
96 using InsightIntentInfoForQuery = AbilityRuntime::InsightIntentInfoForQuery;
97 
98 constexpr const char* ABILITY_MANAGER_SERVICE_NAME = "AbilityManagerService";
99 const int DEFAULT_INVAL_VALUE = -1;
100 const int DELAY_LOCAL_FREE_INSTALL_TIMEOUT = 40000;
101 const int DELAY_REMOTE_FREE_INSTALL_TIMEOUT = 30000 + DELAY_LOCAL_FREE_INSTALL_TIMEOUT;
102 constexpr const char* FROM_REMOTE_KEY = "freeInstallFromRemote";
103 /**
104  * @class IAbilityManager
105  * IAbilityManager interface is used to access ability manager services.
106  */
107 class IAbilityManager : public OHOS::IRemoteBroker {
108 public:
109     DECLARE_INTERFACE_DESCRIPTOR(u"ohos.aafwk.AbilityManager")
110 
111     /**
112      * StartSelfUIAbility with want, start self uiability only on 2-in-1 devices.
113      *
114      * @param want, the want of the ability to start.
115      * @return Returns ERR_OK on success, others on failure.
116      */
StartSelfUIAbility(const Want & want)117     virtual int StartSelfUIAbility(const Want &want)
118     {
119         return 0;
120     }
121 
122     /**
123      * StartSelfUIAbility with want and startOptions, start self uiability only on 2-in-1 devices.
124      *
125      * @param want, the want of the ability to start.
126      * @param options, the startOptions of the ability to start.
127      * @return Returns ERR_OK on success, others on failure.
128      */
StartSelfUIAbilityWithStartOptions(const Want & want,const StartOptions & options)129     virtual int StartSelfUIAbilityWithStartOptions(const Want &want, const StartOptions &options)
130     {
131         return 0;
132     }
133 
134     /**
135      * StartAbility with want, send want to ability manager service.
136      *
137      * @param want, the want of the ability to start.
138      * @param userId, Designation User ID.
139      * @param requestCode, Ability request code.
140      * @return Returns ERR_OK on success, others on failure.
141      */
142     virtual int StartAbility(
143         const Want &want,
144         int32_t userId = DEFAULT_INVAL_VALUE,
145         int requestCode = DEFAULT_INVAL_VALUE) = 0;
146 
147     /**
148      * StartAbility with want, send want to ability manager service.
149      *
150      * @param want, the want of the ability to start.
151      * @param callerToken, caller ability token.
152      * @param userId, Designation User ID.
153      * @param requestCode, Ability request code.
154      * @return Returns ERR_OK on success, others on failure.
155      */
156     virtual int StartAbility(
157         const Want &want,
158         const sptr<IRemoteObject> &callerToken,
159         int32_t userId = DEFAULT_INVAL_VALUE,
160         int requestCode = DEFAULT_INVAL_VALUE) = 0;
161 
162     /**
163      * StartAbilityWithSpecifyTokenId with want and specialId, send want to ability manager service.
164      *
165      * @param want, the want of the ability to start.
166      * @param callerToken, caller ability token.
167      * @param specialId the caller Id.
168      * @param userId, Designation User ID.
169      * @param requestCode, Ability request code.
170      * @return Returns ERR_OK on success, others on failure.
171      */
172     virtual int StartAbilityWithSpecifyTokenId(
173         const Want &want,
174         const sptr<IRemoteObject> &callerToken,
175         uint32_t specifyTokenId,
176         int32_t userId = DEFAULT_INVAL_VALUE,
177         int requestCode = DEFAULT_INVAL_VALUE) = 0;
178 
179     /**
180      * StartAbility by insight intent, send want to ability manager service.
181      *
182      * @param want Ability want.
183      * @param callerToken caller ability token.
184      * @param intentId insight intent id.
185      * @param userId userId of target ability.
186      * @return Returns ERR_OK on success, others on failure.
187      */
188     virtual int32_t StartAbilityByInsightIntent(
189         const Want &want,
190         const sptr<IRemoteObject> &callerToken,
191         uint64_t intentId,
192         int32_t userId = DEFAULT_INVAL_VALUE) = 0;
193 
194     /**
195      * Starts a new ability with specific start settings.
196      *
197      * @param want Indicates the ability to start.
198      * @param requestCode the resultCode of the ability to start.
199      * @param abilityStartSetting Indicates the setting ability used to start.
200      * @param userId, Designation User ID.
201      * @return Returns ERR_OK on success, others on failure.
202      */
203     virtual int StartAbility(
204         const Want &want,
205         const AbilityStartSetting &abilityStartSetting,
206         const sptr<IRemoteObject> &callerToken,
207         int32_t userId = DEFAULT_INVAL_VALUE,
208         int requestCode = DEFAULT_INVAL_VALUE) = 0;
209 
210     /**
211      * Starts a new ability with specific start options.
212      *
213      * @param want, the want of the ability to start.
214      * @param startOptions Indicates the options used to start.
215      * @param callerToken, caller ability token.
216      * @param userId, Designation User ID.
217      * @param requestCode the resultCode of the ability to start.
218      * @return Returns ERR_OK on success, others on failure.
219      */
220     virtual int StartAbility(
221         const Want &want,
222         const StartOptions &startOptions,
223         const sptr<IRemoteObject> &callerToken,
224         int32_t userId = DEFAULT_INVAL_VALUE,
225         int requestCode = DEFAULT_INVAL_VALUE) = 0;
226 
227     /**
228      * Starts a new ability using the original caller information.
229      *
230      * @param want the want of the ability to start.
231      * @param callerToken caller ability token.
232      * @param asCallerSourceToken source caller ability token.
233      * @param userId Designation User ID.
234      * @param requestCode the resultCode of the ability to start.
235      * @return Returns ERR_OK on success, others on failure.
236      */
237     virtual int StartAbilityAsCaller(
238         const Want &want,
239         const sptr<IRemoteObject> &callerToken,
240         sptr<IRemoteObject> asCallerSourceToken,
241         int32_t userId = DEFAULT_INVAL_VALUE,
242         int requestCode = DEFAULT_INVAL_VALUE)
243     {
244         return 0;
245     }
246 
247     /**
248      * Starts a new ability using the original caller information.
249      *
250      * @param want the want of the ability to start.
251      * @param startOptions Indicates the options used to start.
252      * @param callerToken caller ability token.
253      * @param asCallerSourceToken source caller ability token.
254      * @param userId Designation User ID.
255      * @param requestCode the resultCode of the ability to start.
256      * @return Returns ERR_OK on success, others on failure.
257      */
258     virtual int StartAbilityAsCaller(
259         const Want &want,
260         const StartOptions &startOptions,
261         const sptr<IRemoteObject> &callerToken,
262         sptr<IRemoteObject> asCallerSourceToken,
263         int32_t userId = DEFAULT_INVAL_VALUE,
264         int requestCode = DEFAULT_INVAL_VALUE)
265     {
266         return 0;
267     }
268 
269     /**
270      * Starts a new ability for result using the original caller information.
271      *
272      * @param want the want of the ability to start.
273      * @param callerToken current caller ability token.
274      * @param requestCode the resultCode of the ability to start.
275      * @param userId Designation User ID.
276      * @return Returns ERR_OK on success, others on failure.
277      */
278     virtual int StartAbilityForResultAsCaller(
279         const Want &want,
280         const sptr<IRemoteObject> &callerToken,
281         int requestCode = DEFAULT_INVAL_VALUE,
282         int32_t userId = DEFAULT_INVAL_VALUE)
283     {
284         return 0;
285     }
286 
287     /**
288      * Starts a new ability for result using the original caller information.
289      *
290      * @param want the want of the ability to start.
291      * @param startOptions Indicates the options used to start.
292      * @param callerToken current caller ability token.
293      * @param requestCode the resultCode of the ability to start.
294      * @param userId Designation User ID.
295      * @return Returns ERR_OK on success, others on failure.
296      */
297     virtual int StartAbilityForResultAsCaller(
298         const Want &want,
299         const StartOptions &startOptions,
300         const sptr<IRemoteObject> &callerToken,
301         int requestCode = DEFAULT_INVAL_VALUE,
302         int32_t userId = DEFAULT_INVAL_VALUE)
303     {
304         return 0;
305     }
306 
307     /**
308      * Start UI abilities simultaneously.
309      *
310      * @param wantList a list of want to start UI abilities.
311      * @param requestKey, The unique key of this StartUIAbilities request.
312      * @param callerToken current caller ability token.
313      * @return Returns ERR_OK if success.
314      */
StartUIAbilities(const std::vector<AAFwk::Want> & wantList,const std::string & requestKey,sptr<IRemoteObject> callerToken)315     virtual ErrCode StartUIAbilities(const std::vector<AAFwk::Want> &wantList,
316         const std::string &requestKey, sptr<IRemoteObject> callerToken)
317     {
318         return 0;
319     }
320 
321     /**
322      * Start ui session ability with extension session info, send session info to ability manager service.
323      *
324      * @param want, the want of the ability to start.
325      * @param callerToken, caller ability token.
326      * @param sessionInfo the information of UIExtensionContentSession.
327      * @param userId, Designation User ID.
328      * @param requestCode, Ability request code.
329      * @return Returns ERR_OK on success, others on failure.
330      */
331     virtual int StartAbilityByUIContentSession(
332         const Want &want,
333         const sptr<IRemoteObject> &callerToken,
334         const sptr<SessionInfo> &sessionInfo,
335         int32_t userId = DEFAULT_INVAL_VALUE,
336         int requestCode = DEFAULT_INVAL_VALUE)
337     {
338         return 0;
339     }
340 
341 /**
342      * Start ui session ability with extension session info, send session info to ability manager service.
343      *
344      * @param want, the want of the ability to start.
345      * @param startOptions Indicates the options used to start.
346      * @param callerToken, caller ability token.
347      * @param sessionInfo the information of UIExtensionContentSession.
348      * @param userId, Designation User ID.
349      * @param requestCode the resultCode of the ability to start.
350      * @return Returns ERR_OK on success, others on failure.
351      */
352     virtual int StartAbilityByUIContentSession(
353         const Want &want,
354         const StartOptions &startOptions,
355         const sptr<IRemoteObject> &callerToken,
356         const sptr<SessionInfo> &sessionInfo,
357         int32_t userId = DEFAULT_INVAL_VALUE,
358         int requestCode = DEFAULT_INVAL_VALUE)
359     {
360         return 0;
361     }
362 
363     /**
364      * Start ui ability
365      *
366      * @param want the want of the ability to start.
367      * @param callerToken caller ability token.
368      * @param specifyTokenId The Caller ID.
369      * @return Returns ERR_OK on success, others on failure.
370      */
StartAbilityOnlyUIAbility(const Want & want,const sptr<IRemoteObject> & callerToken,uint32_t specifyTokenId)371     virtual int StartAbilityOnlyUIAbility(
372         const Want &want,
373         const sptr<IRemoteObject> &callerToken,
374         uint32_t specifyTokenId)
375     {
376         return 0;
377     }
378 
379     /**
380      * Start extension ability with want, send want to ability manager service.
381      *
382      * @param want, the want of the ability to start.
383      * @param callerToken, caller ability token.
384      * @param userId, Designation User ID.
385      * @param extensionType If an ExtensionAbilityType is set, only extension of that type can be started.
386      * @return Returns ERR_OK on success, others on failure.
387      */
388     virtual int32_t StartExtensionAbility(
389         const Want &want,
390         const sptr<IRemoteObject> &callerToken,
391         int32_t userId = DEFAULT_INVAL_VALUE,
392         AppExecFwk::ExtensionAbilityType extensionType = AppExecFwk::ExtensionAbilityType::UNSPECIFIED)
393     {
394         return 0;
395     }
396 
397   /**
398      * Create UIExtension with want, send want to ability manager service.
399      *
400      * @param want, the want of the ability to start.
401      * @return Returns ERR_OK on success, others on failure.
402      */
RequestModalUIExtension(const Want & want)403     virtual int RequestModalUIExtension(const Want &want)
404     {
405         return 0;
406     }
407 
408     /**
409      * Preload UIExtension with want, send want to ability manager service.
410      *
411      * @param want, the want of the ability to start.
412      * @param hostBundleName, the caller application bundle name.
413      * @param userId, the extension runs in.
414      * @return Returns ERR_OK on success, others on failure.
415      */
416     virtual int PreloadUIExtensionAbility(const Want &want, std::string &hostBundleName,
417         int32_t userId = DEFAULT_INVAL_VALUE, int32_t hostPid = DEFAULT_INVAL_VALUE)
418     {
419         return 0;
420     }
421 
ChangeAbilityVisibility(sptr<IRemoteObject> token,bool isShow)422     virtual int ChangeAbilityVisibility(sptr<IRemoteObject> token, bool isShow)
423     {
424         return 0;
425     }
426 
ChangeUIAbilityVisibilityBySCB(sptr<SessionInfo> sessionInfo,bool isShow)427         virtual int ChangeUIAbilityVisibilityBySCB(sptr<SessionInfo> sessionInfo, bool isShow)
428     {
429         return 0;
430     }
431 
432     /**
433      * Start ui extension ability with extension session info, send extension session info to ability manager service.
434      *
435      * @param extensionSessionInfo the extension session info of the ability to start.
436      * @param userId, Designation User ID.
437      * @return Returns ERR_OK on success, others on failure.
438      */
439     virtual int StartUIExtensionAbility(
440         const sptr<SessionInfo> &extensionSessionInfo,
441         int32_t userId = DEFAULT_INVAL_VALUE)
442     {
443         return 0;
444     }
445 
446     /**
447      * Start ui ability with want, send want to ability manager service.
448      *
449      * @param sessionInfo the session info of the ability to start.
450      * @param isColdStart the session info of the ability is or not cold start.
451      * @return Returns ERR_OK on success, others on failure.
452      */
453     virtual int StartUIAbilityBySCB(sptr<SessionInfo> sessionInfo, bool &isColdStart, uint32_t sceneFlag = 0)
454     {
455         return 0;
456     }
457 
458     /**
459      * Stop extension ability with want, send want to ability manager service.
460      *
461      * @param want, the want of the ability to stop.
462      * @param callerToken, caller ability token.
463      * @param userId, Designation User ID.
464      * @param extensionType If an ExtensionAbilityType is set, only extension of that type can be stopped.
465      * @return Returns ERR_OK on success, others on failure.
466      */
467     virtual int StopExtensionAbility(
468         const Want& want,
469         const sptr<IRemoteObject>& callerToken,
470         int32_t userId = DEFAULT_INVAL_VALUE,
471         AppExecFwk::ExtensionAbilityType extensionType = AppExecFwk::ExtensionAbilityType::UNSPECIFIED)
472     {
473         return 0;
474     }
475 
GetAppMemorySize()476     virtual int GetAppMemorySize()
477     {
478         return 0;
479     }
480 
IsRamConstrainedDevice()481     virtual bool IsRamConstrainedDevice()
482     {
483         return false;
484     }
485 
486     virtual AppExecFwk::ElementName GetTopAbility(bool isNeedLocalDeviceId = true)
487     {
488         return {};
489     }
490 
491     virtual AppExecFwk::ElementName GetElementNameByToken(sptr<IRemoteObject> token,
492         bool isNeedLocalDeviceId = true)
493     {
494         return {};
495     }
496 
497     /**
498      * TerminateAbility, terminate the special ability.
499      *
500      * @param token, the token of the ability to terminate.
501      * @param resultCode, the resultCode of the ability to terminate.
502      * @param resultWant, the Want of the ability to return.
503      * @return Returns ERR_OK on success, others on failure.
504      */
505     virtual int TerminateAbility(
506         const sptr<IRemoteObject> &token, int resultCode, const Want *resultWant = nullptr) = 0;
507 
508     /**
509      * BackToCallerAbilityWithResult, return to the caller ability.
510      *
511      * @param token, the token of the ability to terminate.
512      * @param resultCode, the resultCode of the ability to terminate.
513      * @param resultWant, the Want of the ability to return.
514      * @param callerRequestCode, the requestCode of caller ability.·
515      * @return Returns ERR_OK on success, others on failure.
516      */
BackToCallerAbilityWithResult(const sptr<IRemoteObject> & token,int resultCode,const Want * resultWant,int64_t callerRequestCode)517     virtual int BackToCallerAbilityWithResult(const sptr<IRemoteObject> &token, int resultCode,
518         const Want *resultWant, int64_t callerRequestCode)
519     {
520         return 0;
521     };
522 
523     /**
524      * TerminateUIServiceExtensionAbility, terminate the UIServiceExtensionAbility.
525      *
526      * @param token, the token of the ability to terminate.
527      * @return Returns ERR_OK on success, others on failure.
528      */
TerminateUIServiceExtensionAbility(const sptr<IRemoteObject> & token)529     virtual int32_t TerminateUIServiceExtensionAbility(const sptr<IRemoteObject> &token)
530     {
531         return 0;
532     }
533 
534     /**
535      * TerminateUIExtensionAbility, terminate the special ui extension ability.
536      *
537      * @param extensionSessionInfo the extension session info of the ability to terminate.
538      * @param resultCode, the resultCode of the ui extension ability to terminate.
539      * @param resultWant, the Want of the ui extension ability to return.
540      * @return Returns ERR_OK on success, others on failure.
541      */
542     virtual int TerminateUIExtensionAbility(const sptr<SessionInfo> &extensionSessionInfo,
543         int resultCode, const Want *resultWant = nullptr)
544     {
545         return 0;
546     }
547 
548     /**
549      * CloseUIExtensionAbilityBySCB, terminate the specified ui extension ability by SCB.
550      *
551      * @param token the ability token.
552      * @return Returns ERR_OK on success, others on failure.
553      */
CloseUIExtensionAbilityBySCB(const sptr<IRemoteObject> token)554     virtual int CloseUIExtensionAbilityBySCB(const sptr<IRemoteObject> token)
555     {
556         return 0;
557     }
558 
559     /**
560      *  CloseUIAbilityBySCB, close the special ability by scb.
561      *
562      * @param sessionInfo the session info of the ability to terminate.
563      * @param sceneFlag the reason info of the ability to terminate.
564      * @return Returns ERR_OK on success, others on failure.
565      */
566     virtual int CloseUIAbilityBySCB(const sptr<SessionInfo> &sessionInfo, bool isUserRequestedExit,
567         uint32_t sceneFlag = 0)
568     {
569         return 0;
570     }
571 
572     /**
573      * SendResultToAbility, send the result to ability.
574      *
575      * @param requestCode, the requestCode of the ability to terminate.
576      * @param resultCode, the resultCode of the ability to terminate.
577      * @param resultWant, the Want of the ability to return.
578      * @return Returns ERR_OK on success, others on failure.
579      */
SendResultToAbility(int requestCode,int resultCode,Want & resultWant)580     virtual int SendResultToAbility(int requestCode, int resultCode, Want &resultWant)
581     {
582         return 0;
583     }
584 
585     /**
586      * MoveAbilityToBackground.
587      *
588      * @param token, the token of the ability to move.
589      * @return Returns ERR_OK on success, others on failure.
590      */
MoveAbilityToBackground(const sptr<IRemoteObject> & token)591     virtual int MoveAbilityToBackground(const sptr<IRemoteObject> &token)
592     {
593         return 0;
594     };
595 
596     /**
597      * Move the UIAbility to background, called by app self.
598      *
599      * @param token the token of the ability to move.
600      * @return Returns ERR_OK on success, others on failure.
601      */
MoveUIAbilityToBackground(const sptr<IRemoteObject> token)602     virtual int32_t MoveUIAbilityToBackground(const sptr<IRemoteObject> token)
603     {
604         return 0;
605     };
606 
607     /**
608      * CloseAbility, close the special ability.
609      *
610      * @param token, the token of the ability to terminate.
611      * @param resultCode, the resultCode of the ability to terminate.
612      * @param resultWant, the Want of the ability to return.
613      * @return Returns ERR_OK on success, others on failure.
614      */
615     virtual int CloseAbility(const sptr<IRemoteObject> &token, int resultCode = DEFAULT_INVAL_VALUE,
616         const Want *resultWant = nullptr) = 0;
617 
618     /**
619      * MinimizeAbility, minimize the special ability.
620      *
621      * @param token, the token of the ability to minimize.
622      * @param fromUser mark the minimize operation source.
623      * @return Returns ERR_OK on success, others on failure.
624      */
625     virtual int MinimizeAbility(const sptr<IRemoteObject> &token, bool fromUser = false) = 0;
626 
627     /**
628      * MinimizeUIExtensionAbility, minimize the special ui extension ability.
629      *
630      * @param extensionSessionInfo the extension session info of the ability to minimize.
631      * @param fromUser mark the minimize operation source.
632      * @return Returns ERR_OK on success, others on failure.
633      */
634     virtual int MinimizeUIExtensionAbility(const sptr<SessionInfo> &extensionSessionInfo,
635         bool fromUser = false)
636     {
637         return 0;
638     };
639 
640     /**
641      * MinimizeUIAbilityBySCB, minimize the special ui ability by scb.
642      *
643      * @param sessionInfo the session info of the ability to minimize.
644      * @param fromUser, Whether form user.
645      * @return Returns ERR_OK on success, others on failure.
646      */
647     virtual int MinimizeUIAbilityBySCB(const sptr<SessionInfo> &sessionInfo, bool fromUser = false,
648         uint32_t sceneFlag = 0)
649     {
650         return 0;
651     };
652 
653     /**
654      * ConnectAbility, connect session with service ability.
655      *
656      * @param want, Special want for service type's ability.
657      * @param connect, Callback used to notify caller the result of connecting or disconnecting.
658      * @param callerToken, caller ability token.
659      * @param userId, Designation User ID.
660      * @return Returns ERR_OK on success, others on failure.
661      */
662     virtual int32_t ConnectAbility(
663         const Want &want,
664         const sptr<IAbilityConnection> &connect,
665         const sptr<IRemoteObject> &callerToken,
666         int32_t userId = DEFAULT_INVAL_VALUE) = 0;
667 
668     /**
669      * Connect ability common method.
670      *
671      * @param want, special want for service type's ability.
672      * @param connect, callback used to notify caller the result of connecting or disconnecting.
673      * @param callerToken, caller ability token.
674      * @param extensionType, type of the extension.
675      * @param userId, the service user ID.
676      * @return Returns ERR_OK on success, others on failure.
677      */
678     virtual int32_t ConnectAbilityCommon(
679         const Want &want,
680         const sptr<IAbilityConnection> &connect,
681         const sptr<IRemoteObject> &callerToken,
682         AppExecFwk::ExtensionAbilityType extensionType,
683         int32_t userId = DEFAULT_INVAL_VALUE,
684         bool isQueryExtensionOnly = false)
685     {
686         return 0;
687     }
688 
689     /**
690      * Connect ui extension ability.
691      *
692      * @param want, special want for the ui extension ability.
693      * @param connect, callback used to notify caller the result of connecting or disconnecting.
694      * @param sessionInfo the extension session info of the ability to connect.
695      * @param userId, the extension runs in.
696      * @param connectInfo the connect info.
697      * @return Returns ERR_OK on success, others on failure.
698      */
699     virtual int ConnectUIExtensionAbility(const Want &want, const sptr<IAbilityConnection> &connect,
700         const sptr<SessionInfo> &sessionInfo, int32_t userId = DEFAULT_INVAL_VALUE,
701         sptr<UIExtensionAbilityConnectInfo> connectInfo = nullptr)
702     {
703         return 0;
704     }
705 
706     /**
707      * DisconnectAbility, disconnect session with service ability.
708      *
709      * @param connect, Callback used to notify caller the result of connecting or disconnecting.
710      * @return Returns ERR_OK on success, others on failure.
711      */
712     virtual int DisconnectAbility(sptr<IAbilityConnection> connect) = 0;
713 
714     /**
715      * SuspendExtensionAbility, suspend session with service ability.
716      *
717      * @param connect, Callback used to notify caller the result of suspend.
718      * @return Returns ERR_OK on success, others on failure.
719      */
SuspendExtensionAbility(sptr<IAbilityConnection> connect)720     virtual int32_t SuspendExtensionAbility(sptr<IAbilityConnection> connect)
721     {
722         return 0;
723     }
724 
725     /**
726      * ResumeExtensionAbility, resume session with service ability.
727      *
728      * @param connect, Callback used to notify caller the result of resume.
729      * @return Returns ERR_OK on success, others on failure.
730      */
ResumeExtensionAbility(sptr<IAbilityConnection> connect)731     virtual int32_t ResumeExtensionAbility(sptr<IAbilityConnection> connect)
732     {
733         return 0;
734     }
735 
736     /**
737      * AcquireDataAbility, acquire a data ability by its authority, if it not existed,
738      * AMS loads it synchronously.
739      *
740      * @param authority, a string to identify a data ability, decoded from uri.
741      * @param tryBind, true: when a data ability is died, ams will kill this client, or do nothing.
742      * @param callerToken, specifies the caller ability token.
743      * @return returns the data ability ipc object, or nullptr for failed.
744      */
745     virtual sptr<IAbilityScheduler> AcquireDataAbility(
746         const Uri &uri, bool tryBind, const sptr<IRemoteObject> &callerToken) = 0;
747 
748     /**
749      * ReleaseDataAbility, release the data ability that referenced by 'dataAbilityToken'.
750      *
751      * @param dataAbilityScheduler, specifies the data ability that will be released.
752      * @param callerToken, specifies the caller ability token.
753      * @return returns ERR_OK if succeeded, or error codes for failed.
754      */
755     virtual int ReleaseDataAbility(
756         sptr<IAbilityScheduler> dataAbilityScheduler, const sptr<IRemoteObject> &callerToken) = 0;
757 
758     /**
759      * AttachAbilityThread, ability call this interface after loaded.
760      *
761      * @param scheduler,.the interface handler of kit ability.
762      * @param token,.ability's token.
763      * @return Returns ERR_OK on success, others on failure.
764      */
765     virtual int AttachAbilityThread(const sptr<IAbilityScheduler> &scheduler, const sptr<IRemoteObject> &token) = 0;
766 
767     /**
768      * AbilityTransitionDone, ability call this interface after life cycle was changed.
769      *
770      * @param token,.ability's token.
771      * @param state,.the state of ability life cycle.
772      * @return Returns ERR_OK on success, others on failure.
773      */
774     virtual int AbilityTransitionDone(const sptr<IRemoteObject> &token, int state, const PacMap &saveData) = 0;
775 
776     /**
777      * AbilityWindowConfigTransitionDone, ability call this interface after life cycle was changed.
778      *
779      * @param token,.ability's token.
780      * @return Returns ERR_OK on success, others on failure.
781      */
AbilityWindowConfigTransitionDone(const sptr<IRemoteObject> & token,const WindowConfig & windowConfig)782     virtual int AbilityWindowConfigTransitionDone(
783         const sptr<IRemoteObject> &token, const WindowConfig &windowConfig)
784         {
785             return 0;
786         }
787 
788     /**
789      * ScheduleConnectAbilityDone, service ability call this interface while session was connected.
790      *
791      * @param token,.service ability's token.
792      * @param remoteObject,.the session proxy of service ability.
793      * @return Returns ERR_OK on success, others on failure.
794      */
795     virtual int ScheduleConnectAbilityDone(
796         const sptr<IRemoteObject> &token, const sptr<IRemoteObject> &remoteObject) = 0;
797 
798     /**
799      * ScheduleDisconnectAbilityDone, service ability call this interface while session was disconnected.
800      *
801      * @param token,.service ability's token.
802      * @return Returns ERR_OK on success, others on failure.
803      */
804     virtual int ScheduleDisconnectAbilityDone(const sptr<IRemoteObject> &token) = 0;
805 
806     /**
807      * ScheduleCommandAbilityDone, service ability call this interface while session was commanded.
808      *
809      * @param token,.service ability's token.
810      * @return Returns ERR_OK on success, others on failure.
811      */
812     virtual int ScheduleCommandAbilityDone(const sptr<IRemoteObject> &token) = 0;
813 
814     virtual int ScheduleCommandAbilityWindowDone(
815         const sptr<IRemoteObject> &token,
816         const sptr<AAFwk::SessionInfo> &sessionInfo,
817         AAFwk::WindowCommand winCmd,
818         AAFwk::AbilityCommand abilityCmd) = 0;
819 
820     /**
821      * dump ability stack info, about userID, mission stack info,
822      * mission record info and ability info.
823      *
824      * @param state Ability stack info.
825      * @return Returns ERR_OK on success, others on failure.
826      */
827     virtual void DumpState(const std::string &args, std::vector<std::string> &state) = 0;
828     virtual void DumpSysState(
829         const std::string& args, std::vector<std::string>& state, bool isClient, bool isUserID, int UserID) = 0;
830 
831     /**
832      * Destroys this Service ability by Want.
833      *
834      * @param want, Special want for service type's ability.
835      * @param token ability's token.
836      * @return Returns true if this Service ability will be destroyed; returns false otherwise.
837      */
838     virtual int StopServiceAbility(const Want &want, int32_t userId = DEFAULT_INVAL_VALUE,
839         const sptr<IRemoteObject> &token = nullptr) = 0;
840 
841     /**
842      * Kill the process immediately.
843      *
844      * @param bundleName.
845      * @return Returns ERR_OK on success, others on failure.
846      */
847     virtual int KillProcess(const std::string &bundleName, bool clearPageStack = false, int32_t appIndex = 0) = 0;
848 
849     #ifdef ABILITY_COMMAND_FOR_TEST
850     /**
851      * force timeout ability.
852      *
853      * @param abilityName.
854      * @param state.
855      * @return Returns ERR_OK on success, others on failure.
856      */
857     virtual int ForceTimeoutForTest(const std::string &abilityName, const std::string &state) = 0;
858     #endif
859 
860     /**
861      * Uninstall app
862      *
863      * @param bundleName bundle name of uninstalling app.
864      * @param uid uid of bundle.
865      * @return Returns ERR_OK on success, others on failure.
866      */
UninstallApp(const std::string & bundleName,int32_t uid)867     virtual int UninstallApp(const std::string &bundleName, int32_t uid)
868     {
869         return 0;
870     }
871 
872     /**
873      * Uninstall app
874      *
875      * @param bundleName bundle name of uninstalling app.
876      * @param uid uid of bundle.
877      * @param appIndex the app index of app clone.
878      * @return Returns ERR_OK on success, others on failure.
879      */
UninstallApp(const std::string & bundleName,int32_t uid,int32_t appIndex)880     virtual int32_t UninstallApp(const std::string &bundleName, int32_t uid, int32_t appIndex)
881     {
882         return 0;
883     }
884 
885     /**
886      * Upgrade app, record exit reason and kill application
887      *
888      * @param bundleName bundle name of upgrading app.
889      * @param uid uid of bundle.
890      * @param exitMsg the exit reason message.
891      * @param appIndex the app index of app clone.
892      * @return Returns ERR_OK on success, others on failure.
893      */
894     virtual int32_t UpgradeApp(const std::string &bundleName, const int32_t uid, const std::string &exitMsg,
895         int32_t appIndex = 0)
896     {
897         return 0;
898     }
899 
900     virtual sptr<IWantSender> GetWantSender(
901         const WantSenderInfo &wantSenderInfo, const sptr<IRemoteObject> &callerToken, int32_t uid = -1) = 0;
902 
903     virtual int SendWantSender(sptr<IWantSender> target, SenderInfo &senderInfo) = 0;
904 
SendLocalWantSender(const SenderInfo & senderInfo)905     virtual int SendLocalWantSender(const SenderInfo &senderInfo)
906     {
907         return 0;
908     }
909 
910     virtual void CancelWantSender(const sptr<IWantSender> &sender) = 0;
911 
912     virtual int GetPendingWantUid(const sptr<IWantSender> &target) = 0;
913 
914     virtual int GetPendingWantUserId(const sptr<IWantSender> &target) = 0;
915 
916     virtual std::string GetPendingWantBundleName(const sptr<IWantSender> &target) = 0;
917 
918     virtual int GetPendingWantCode(const sptr<IWantSender> &target) = 0;
919 
920     virtual int GetPendingWantType(const sptr<IWantSender> &target) = 0;
921 
922     virtual void RegisterCancelListener(const sptr<IWantSender> &sender, const sptr<IWantReceiver> &receiver) = 0;
923 
924     virtual void UnregisterCancelListener(const sptr<IWantSender> &sender, const sptr<IWantReceiver> &receiver) = 0;
925 
926     virtual int GetPendingRequestWant(const sptr<IWantSender> &target, std::shared_ptr<Want> &want) = 0;
927 
928     virtual int GetWantSenderInfo(const sptr<IWantSender> &target, std::shared_ptr<WantSenderInfo> &info) = 0;
929 
930     virtual int ContinueMission(const std::string &srcDeviceId, const std::string &dstDeviceId, int32_t missionId,
931         const sptr<IRemoteObject> &callBack, AAFwk::WantParams &wantParams) = 0;
932 
ContinueMission(AAFwk::ContinueMissionInfo continueMissionInfo,const sptr<IRemoteObject> & callback)933     virtual int ContinueMission(AAFwk::ContinueMissionInfo continueMissionInfo, const sptr<IRemoteObject> &callback)
934     {
935         return 0;
936     }
937 
938     virtual int ContinueAbility(const std::string &deviceId, int32_t missionId, uint32_t versionCode) = 0;
939 
940     virtual int StartContinuation(const Want &want, const sptr<IRemoteObject> &abilityToken, int32_t status) = 0;
941 
942     virtual void NotifyCompleteContinuation(const std::string &deviceId, int32_t sessionId, bool isSuccess) = 0;
943 
944     virtual int NotifyContinuationResult(int32_t missionId, int32_t result) = 0;
945 
946     virtual int LockMissionForCleanup(int32_t missionId) = 0;
947 
948     virtual int UnlockMissionForCleanup(int32_t missionId) = 0;
949 
SetLockedState(int32_t sessionId,bool lockedState)950     virtual void SetLockedState(int32_t sessionId, bool lockedState)
951     {
952         return;
953     }
954 
955     /**
956      * @brief Register mission listener to ability mgr.
957      * @param listener The handler of listener.
958      *
959      * @return Returns ERR_OK on success, others on failure.
960      */
961     virtual int RegisterMissionListener(const sptr<IMissionListener> &listener) = 0;
962 
963     /**
964      * @brief UnRegister mission listener from ability mgr.
965      * @param listener The handler of listener.
966      *
967      * @return Returns ERR_OK on success, others on failure.
968      */
969     virtual int UnRegisterMissionListener(const sptr<IMissionListener> &listener) = 0;
970 
971     /**
972      * @brief Get mission infos from ability mgr.
973      * @param deviceId local or remote deviceId.
974      * @param numMax max number of missions.
975      * @param missionInfos mission info result.
976      *
977      * @return Returns ERR_OK on success, others on failure.
978      */
979     virtual int GetMissionInfos(
980         const std::string &deviceId, int32_t numMax, std::vector<MissionInfo> &missionInfos) = 0;
981 
982     /**
983      * @brief Get mission info by id.
984      * @param deviceId local or remote deviceId.
985      * @param missionId Id of target mission.
986      * @param missionInfo mission info of target mission.
987      *
988      * @return Returns ERR_OK on success, others on failure.
989      */
990     virtual int GetMissionInfo(const std::string &deviceId, int32_t missionId, MissionInfo &missionInfo) = 0;
991 
992     /**
993      * @brief Get the Mission Snapshot Info object
994      * @param deviceId local or remote deviceId.
995      * @param missionId Id of target mission.
996      * @param snapshot snapshot of target mission.
997      * @param isLowResolution get low resolution snapshot.
998      * @return Returns ERR_OK on success, others on failure.
999      */
1000     virtual int GetMissionSnapshot(const std::string& deviceId, int32_t missionId,
1001         MissionSnapshot& snapshot, bool isLowResolution) = 0;
1002 
1003     /**
1004      * @brief Clean mission by id.
1005      * @param missionId Id of target mission.
1006      *
1007      * @return Returns ERR_OK on success, others on failure.
1008      */
1009     virtual int CleanMission(int32_t missionId) = 0;
1010 
1011     /**
1012      * @brief Clean all missions in system.
1013      *
1014      * @return Returns ERR_OK on success, others on failure.
1015      */
1016     virtual int CleanAllMissions() = 0;
1017 
1018     virtual int MoveMissionToFront(int32_t missionId) = 0;
1019 
1020     /**
1021      * @brief Move a mission to front.
1022      * @param missionId Id of target mission.
1023      * @param startOptions Special startOptions for target mission.
1024      *
1025      * @return Returns ERR_OK on success, others on failure.
1026      */
1027     virtual int MoveMissionToFront(int32_t missionId, const StartOptions &startOptions) = 0;
1028 
1029     /**
1030      * Move missions to front
1031      * @param missionIds Ids of target missions
1032      * @param topMissionId Indicate which mission will be moved to top, if set to -1, missions' order won't change
1033      * @return Returns ERR_OK on success, others on failure.
1034      */
MoveMissionsToForeground(const std::vector<int32_t> & missionIds,int32_t topMissionId)1035     virtual int MoveMissionsToForeground(const std::vector<int32_t>& missionIds, int32_t topMissionId)
1036     {
1037         return 0;
1038     }
1039 
1040     /**
1041      * Move missions to background
1042      * @param missionIds Ids of target missions
1043      * @param result The result of move missions to background, and the array is sorted by zOrder
1044      * @return Returns ERR_OK on success, others on failure.
1045      */
MoveMissionsToBackground(const std::vector<int32_t> & missionIds,std::vector<int32_t> & result)1046     virtual int MoveMissionsToBackground(const std::vector<int32_t>& missionIds, std::vector<int32_t>& result)
1047     {
1048         return 0;
1049     }
1050 
1051     /**
1052      * @brief Register session handler.
1053      * @param object The handler.
1054      *
1055      * @return Returns ERR_OK on success, others on failure.
1056     */
RegisterSessionHandler(const sptr<IRemoteObject> & object)1057     virtual int RegisterSessionHandler(const sptr<IRemoteObject> &object)
1058     {
1059         return 0;
1060     }
1061 
1062     /**
1063      * Start Ability, connect session with common ability.
1064      *
1065      * @param want, Special want for service type's ability.
1066      * @param connect, Callback used to notify caller the result of connecting or disconnecting.
1067      * @param accountId Indicates the account to start.
1068      * @return Returns ERR_OK on success, others on failure.
1069      */
1070     virtual int StartAbilityByCall(const Want &want, const sptr<IAbilityConnection> &connect,
1071         const sptr<IRemoteObject> &callerToken, int32_t accountId = DEFAULT_INVAL_VALUE, bool isSilent = false) = 0;
1072 
1073     virtual int StartAbilityByCallWithErrMsg(const Want &want, const sptr<IAbilityConnection> &connect,
1074         const sptr<IRemoteObject> &callerToken, int32_t accountId, std::string &errMsg, bool isSilent = false)
1075     {
1076         return 0;
1077     };
1078 
1079     /**
1080      * CallRequestDone, after invoke callRequest, ability will call this interface to return callee.
1081      *
1082      * @param token, ability's token.
1083      * @param callStub, ability's callee.
1084      */
CallRequestDone(const sptr<IRemoteObject> & token,const sptr<IRemoteObject> & callStub)1085     virtual void CallRequestDone(const sptr<IRemoteObject> &token, const sptr<IRemoteObject> &callStub) {};
1086 
1087     /**
1088      * Release the call between Ability, disconnect session with common ability.
1089      *
1090      * @param connect, Callback used to notify caller the result of connecting or disconnecting.
1091      * @return Returns ERR_OK on success, others on failure.
1092      */
1093     virtual int ReleaseCall(const sptr<IAbilityConnection> &connect, const AppExecFwk::ElementName &element) = 0;
1094 
1095     /**
1096      * @brief start user.
1097      * @param accountId accountId.
1098      * @param isAppRecovery is appRecovery or not.
1099      * @return Returns ERR_OK on success, others on failure.
1100      */
1101     virtual int StartUser(int userId, sptr<IUserCallback> callback, bool isAppRecovery = false) = 0;
1102 
1103     /**
1104      * @brief stop user.
1105      * @param accountId accountId.
1106      * @param callback callback.
1107      *
1108      * @return Returns ERR_OK on success, others on failure.
1109      */
1110     virtual int StopUser(int userId, const sptr<IUserCallback> &callback) = 0;
1111 
1112     /**
1113      * @brief logout user.
1114      * @param accountId accountId.
1115      *
1116      * @return Returns ERR_OK on success, others on failure.
1117      */
1118     virtual int LogoutUser(int32_t userId, sptr<IUserCallback> callback = nullptr)
1119     {
1120         return 0;
1121     }
1122 
SetMissionContinueState(const sptr<IRemoteObject> & token,const AAFwk::ContinueState & state)1123     virtual int SetMissionContinueState(const sptr<IRemoteObject> &token, const AAFwk::ContinueState &state)
1124     {
1125         return 0;
1126     };
1127 
1128 #ifdef SUPPORT_SCREEN
1129     virtual int SetMissionLabel(const sptr<IRemoteObject> &abilityToken, const std::string &label) = 0;
1130 
1131     virtual int SetMissionIcon(const sptr<IRemoteObject> &token,
1132         const std::shared_ptr<OHOS::Media::PixelMap> &icon) = 0;
1133 
1134     /**
1135      * Called to update mission snapshot.
1136      * @param token The target ability.
1137      * @param pixelMap The snapshot.
1138      */
UpdateMissionSnapShot(const sptr<IRemoteObject> & token,const std::shared_ptr<OHOS::Media::PixelMap> & pixelMap)1139     virtual void UpdateMissionSnapShot(const sptr<IRemoteObject> &token,
1140         const std::shared_ptr<OHOS::Media::PixelMap> &pixelMap) {};
1141 
1142     /**
1143      * Register the WindowManagerService handler
1144      *
1145      * @param handler Indicate handler of WindowManagerService.
1146      * @return ErrCode Returns ERR_OK on success, others on failure.
1147      */
RegisterWindowManagerServiceHandler(const sptr<IWindowManagerServiceHandler> & handler,bool animationEnabled)1148     virtual int RegisterWindowManagerServiceHandler(const sptr<IWindowManagerServiceHandler>& handler,
1149         bool animationEnabled)
1150     {
1151         return 0;
1152     }
1153 
1154     /**
1155      * WindowManager notification AbilityManager after the first frame is drawn.
1156      *
1157      * @param abilityToken Indicate token of ability.
1158      */
1159     virtual void CompleteFirstFrameDrawing(const sptr<IRemoteObject> &abilityToken) = 0;
1160 
1161     /**
1162      * WindowManager notification AbilityManager after the first frame is drawn.
1163      *
1164      * @param sessionId Indicate session id.
1165      */
CompleteFirstFrameDrawing(int32_t sessionId)1166     virtual void CompleteFirstFrameDrawing(int32_t sessionId)
1167     {}
1168 
1169     /**
1170      * PrepareTerminateAbility, prepare terminate the special ability.
1171      *
1172      * @param token, the token of the ability to terminate.
1173      * @param callback callback.
1174      * @return Returns ERR_OK on success, others on failure.
1175      */
PrepareTerminateAbility(const sptr<IRemoteObject> & token,sptr<IPrepareTerminateCallback> & callback)1176     virtual int PrepareTerminateAbility(const sptr<IRemoteObject> &token, sptr<IPrepareTerminateCallback> &callback)
1177     {
1178         return 0;
1179     }
1180 
GetDialogSessionInfo(const std::string & dialogSessionId,sptr<DialogSessionInfo> & dialogSessionInfo)1181     virtual int GetDialogSessionInfo(const std::string &dialogSessionId, sptr<DialogSessionInfo> &dialogSessionInfo)
1182     {
1183         return 0;
1184     }
1185 
SendDialogResult(const Want & want,const std::string & dialogSessionId,bool isAllow)1186     virtual int SendDialogResult(const Want &want, const std::string &dialogSessionId, bool isAllow)
1187     {
1188         return 0;
1189     }
1190 
1191     /**
1192      * Register ability first frame state observer.
1193      * @param observer Is ability first frame state observer.
1194      * @param bundleName Is bundleName of the app to observe.
1195      * @return Returns ERR_OK on success, others on failure.
1196      */
RegisterAbilityFirstFrameStateObserver(const sptr<IAbilityFirstFrameStateObserver> & observer,const std::string & targetBundleName)1197     virtual int32_t RegisterAbilityFirstFrameStateObserver(const sptr<IAbilityFirstFrameStateObserver> &observer,
1198         const std::string &targetBundleName)
1199     {
1200         return 0;
1201     }
1202 
1203     /**
1204      * Unregister ability first frame state observer.
1205      * @param observer Is ability first frame state observer.
1206      * @return Returns ERR_OK on success, others on failure.
1207      */
UnregisterAbilityFirstFrameStateObserver(const sptr<IAbilityFirstFrameStateObserver> & observer)1208     virtual int32_t UnregisterAbilityFirstFrameStateObserver(const sptr<IAbilityFirstFrameStateObserver> &observer)
1209     {
1210         return 0;
1211     }
1212 
1213 #endif
1214     /**
1215      * @brief Get the ability running information.
1216      *
1217      * @param info Ability running information.
1218      * @return Returns ERR_OK on success, others on failure.
1219      */
1220     virtual int GetAbilityRunningInfos(std::vector<AbilityRunningInfo> &info) = 0;
1221 
1222     /**
1223      * @brief Get the extension running information.
1224      *
1225      * @param upperLimit The maximum limit of information wish to get.
1226      * @param info Extension running information.
1227      * @return Returns ERR_OK on success, others on failure.
1228      */
1229     virtual int GetExtensionRunningInfos(int upperLimit, std::vector<ExtensionRunningInfo> &info) = 0;
1230 
1231     /**
1232      * @brief Get running process information.
1233      *
1234      * @param info Running process information.
1235      * @return Returns ERR_OK on success, others on failure.
1236      */
1237     virtual int GetProcessRunningInfos(std::vector<AppExecFwk::RunningProcessInfo> &info) = 0;
1238 
1239     /**
1240      * Start synchronizing remote device mission
1241      * @param devId, deviceId.
1242      * @param fixConflict, resolve synchronizing conflicts flag.
1243      * @param tag, call tag.
1244      * @return Returns ERR_OK on success, others on failure.
1245      */
1246     virtual int StartSyncRemoteMissions(const std::string &devId, bool fixConflict, int64_t tag) = 0;
1247 
1248     /**
1249      * Stop synchronizing remote device mission
1250      * @param devId, deviceId.
1251      * @return Returns ERR_OK on success, others on failure.
1252      */
1253     virtual int StopSyncRemoteMissions(const std::string &devId) = 0;
1254 
1255     /**
1256      * @brief Register mission listener to ability manager service.
1257      * @param deviceId The remote device Id.
1258      * @param listener The handler of listener.
1259      *
1260      * @return Returns ERR_OK on success, others on failure.
1261      */
1262     virtual int RegisterMissionListener(const std::string &deviceId, const sptr<IRemoteMissionListener> &listener) = 0;
1263 
RegisterOnListener(const std::string & type,const sptr<IRemoteOnListener> & listener)1264     virtual int RegisterOnListener(const std::string &type, const sptr<IRemoteOnListener> &listener)
1265     {
1266         return 0;
1267     }
1268 
RegisterOffListener(const std::string & type,const sptr<IRemoteOnListener> & listener)1269     virtual int RegisterOffListener(const std::string &type, const sptr<IRemoteOnListener> &listener)
1270     {
1271         return 0;
1272     }
1273 
1274     virtual int UnRegisterMissionListener(const std::string &deviceId,
1275         const sptr<IRemoteMissionListener> &listener) = 0;
1276 
1277     /**
1278      * Set ability controller.
1279      *
1280      * @param abilityController, The ability controller.
1281      * @return Returns ERR_OK on success, others on failure.
1282      */
1283     virtual int SetAbilityController(const sptr<AppExecFwk::IAbilityController> &abilityController,
1284         bool imAStabilityTest) = 0;
1285 
1286     /**
1287      * Is user a stability test.
1288      *
1289      * @return Returns true if user is a stability test.
1290      */
1291     virtual bool IsRunningInStabilityTest() = 0;
1292 
1293     /**
1294      * @brief Register the snapshot handler
1295      * @param handler snapshot handler
1296      * @return int Returns ERR_OK on success, others on failure.
1297      */
1298     virtual int RegisterSnapshotHandler(const sptr<ISnapshotHandler>& handler) = 0;
1299 
1300     /**
1301      * @brief start user test.
1302      * @param want the want of the ability user test to start.
1303      * @param observer test observer callback.
1304      *
1305      * @return Returns ERR_OK on success, others on failure.
1306      */
1307     virtual int StartUserTest(const Want &want, const sptr<IRemoteObject> &observer) = 0;
1308 
1309     /**
1310      * @brief Finish user test.
1311      * @param msg user test message.
1312      * @param resultCode user test result Code.
1313      * @param bundleName user test bundleName.
1314      *
1315      * @return Returns ERR_OK on success, others on failure.
1316      */
1317     virtual int FinishUserTest(const std::string &msg, const int64_t &resultCode, const std::string &bundleName) = 0;
1318 
1319     /**
1320      * GetTopAbility, get the token of top ability.
1321      *
1322      * @param token, the token of top ability.
1323      * @return Returns ERR_OK on success, others on failure.
1324      */
1325     virtual int GetTopAbility(sptr<IRemoteObject> &token) = 0;
1326 
CheckUIExtensionIsFocused(uint32_t uiExtensionTokenId,bool & isFocused)1327     virtual int CheckUIExtensionIsFocused(uint32_t uiExtensionTokenId, bool& isFocused)
1328     {
1329         return 0;
1330     }
1331 
1332     /**
1333      * The delegator calls this interface to move the ability to the foreground.
1334      *
1335      * @param token, ability's token.
1336      * @return Returns ERR_OK on success, others on failure.
1337      */
1338     virtual int DelegatorDoAbilityForeground(const sptr<IRemoteObject> &token) = 0;
1339 
1340     /**
1341      * The delegator calls this interface to move the ability to the background.
1342      *
1343      * @param token, ability's token.
1344      * @return Returns ERR_OK on success, others on failure.
1345      */
1346     virtual int DelegatorDoAbilityBackground(const sptr<IRemoteObject> &token) = 0;
1347 
1348     /**
1349      * Calls this interface to move the ability to the foreground.
1350      *
1351      * @param token, ability's token.
1352      * @param flag, use for lock or unlock flag and so on.
1353      * @return Returns ERR_OK on success, others on failure.
1354      */
1355     virtual int DoAbilityForeground(const sptr<IRemoteObject> &token, uint32_t flag) = 0;
1356 
1357     /**
1358      * Calls this interface to move the ability to the background.
1359      *
1360      * @param token, ability's token.
1361      * @param flag, use for lock or unlock flag and so on.
1362      * @return Returns ERR_OK on success, others on failure.
1363      */
1364     virtual int DoAbilityBackground(const sptr<IRemoteObject> &token, uint32_t flag) = 0;
1365 
1366     /**
1367      * Get mission id by ability token.
1368      *
1369      * @param token The token of ability.
1370      * @return Returns -1 if do not find mission, otherwise return mission id.
1371      */
1372     virtual int32_t GetMissionIdByToken(const sptr<IRemoteObject> &token) = 0;
1373 
1374     /**
1375      * Get ability token by connect.
1376      *
1377      * @param token The token of ability.
1378      * @param callStub The callee object.
1379      */
1380     virtual void GetAbilityTokenByCalleeObj(const sptr<IRemoteObject> &callStub, sptr<IRemoteObject> &token) = 0;
1381 
1382     /**
1383      * Called when client complete dump.
1384      *
1385      * @param infos The dump info.
1386      * @return Returns ERR_OK on success, others on failure.
1387      */
DumpAbilityInfoDone(std::vector<std::string> & infos,const sptr<IRemoteObject> & callerToken)1388     virtual int DumpAbilityInfoDone(std::vector<std::string> &infos, const sptr<IRemoteObject> &callerToken)
1389     {
1390         return 0;
1391     }
1392 
1393     /**
1394      * Call free install from remote.
1395      *
1396      * @param want, the want of the ability to start.
1397      * @param callback, Callback from remote.
1398      * @param userId, Designation User ID.
1399      * @param requestCode Ability request code.
1400      * @return Returns ERR_OK on success, others on failure.
1401      */
1402     virtual int FreeInstallAbilityFromRemote(const Want &want, const sptr<IRemoteObject> &callback,
1403         int32_t userId, int requestCode = DEFAULT_INVAL_VALUE)
1404     {
1405         return 0;
1406     }
1407 
1408     /**
1409      * Add free install observer.
1410      *
1411      * @param callerToken, The caller ability token.
1412      * @param observer, The observer of the ability to free install start.
1413      * @return Returns ERR_OK on success, others on failure.
1414      */
AddFreeInstallObserver(const sptr<IRemoteObject> & callerToken,const sptr<AbilityRuntime::IFreeInstallObserver> & observer)1415     virtual int AddFreeInstallObserver(const sptr<IRemoteObject> &callerToken,
1416         const sptr<AbilityRuntime::IFreeInstallObserver> &observer)
1417     {
1418         return 0;
1419     }
1420 
EnableRecoverAbility(const sptr<IRemoteObject> & token)1421     virtual void EnableRecoverAbility(const sptr<IRemoteObject>& token) {};
SubmitSaveRecoveryInfo(const sptr<IRemoteObject> & token)1422     virtual void SubmitSaveRecoveryInfo(const sptr<IRemoteObject>& token) {};
1423     virtual void ScheduleRecoverAbility(const sptr<IRemoteObject> &token, int32_t reason,
1424         const Want *want = nullptr) {};
1425 
1426     /**
1427      * @brief Schedule clear recovery page stack.
1428      *
1429      * @param bundleName application bundleName.
1430      */
ScheduleClearRecoveryPageStack()1431     virtual void ScheduleClearRecoveryPageStack() {};
1432 
1433     /**
1434      * Called to verify that the MissionId is valid.
1435      * @param missionIds Query mission list.
1436      * @param results Output parameters, return results up to 20 query results.
1437      * @return Returns ERR_OK on success, others on failure.
1438      */
1439     virtual int32_t IsValidMissionIds(
1440         const std::vector<int32_t> &missionIds, std::vector<MissionValidResult> &results) = 0;
1441 
1442     /**
1443      * Query whether the application of the specified PID and UID has been granted a certain permission
1444      * @param permission
1445      * @param pid Process id
1446      * @param uid
1447      * @return Returns ERR_OK if the current process has the permission, others on failure.
1448      */
VerifyPermission(const std::string & permission,int pid,int uid)1449     virtual int VerifyPermission(const std::string &permission, int pid, int uid)
1450     {
1451         return 0;
1452     }
1453 
1454     /**
1455      * Request dialog service with want, send want to ability manager service.
1456      *
1457      * @param want, the want of the dialog service to start.
1458      * @param callerToken, caller ability token.
1459      * @return Returns ERR_OK on success, others on failure.
1460      */
RequestDialogService(const Want & want,const sptr<IRemoteObject> & callerToken)1461     virtual int32_t RequestDialogService(const Want &want, const sptr<IRemoteObject> &callerToken)
1462     {
1463         return 0;
1464     }
1465 
1466     /**
1467      * Report drawn completed.
1468      *
1469      * @return Returns ERR_OK on success, others on failure.
1470      */
1471     virtual int32_t ReportDrawnCompleted(const sptr<IRemoteObject> &callerToken) = 0;
1472 
1473     /**
1474      * Acquire the shared data.
1475      * @param missionId The missionId of Target ability.
1476      * @param shareData The IAcquireShareData object.
1477      * @return Returns ERR_OK on success, others on failure.
1478      */
AcquireShareData(const int32_t & missionId,const sptr<IAcquireShareDataCallback> & shareData)1479     virtual int32_t AcquireShareData(const int32_t &missionId, const sptr<IAcquireShareDataCallback> &shareData)
1480     {
1481         return 0;
1482     }
1483 
1484     /**
1485      * Notify sharing data finished.
1486      * @param token The token of ability.
1487      * @param resultCode The result of sharing data.
1488      * @param uniqueId The uniqueId from request object.
1489      * @param wantParam The params of acquiring sharing data from target ability.
1490      * @return Returns ERR_OK on success, others on failure.
1491      */
ShareDataDone(const sptr<IRemoteObject> & token,const int32_t & resultCode,const int32_t & uniqueId,WantParams & wantParam)1492     virtual int32_t ShareDataDone(const sptr<IRemoteObject>& token,
1493         const int32_t &resultCode, const int32_t &uniqueId, WantParams &wantParam)
1494     {
1495         return 0;
1496     }
1497 
1498     /**
1499      * Force app exit and record exit reason.
1500      * @param pid Process id .
1501      * @param exitReason The reason of app exit.
1502      * @return Returns ERR_OK on success, others on failure.
1503      */
ForceExitApp(const int32_t pid,const ExitReason & exitReason)1504     virtual int32_t ForceExitApp(const int32_t pid, const ExitReason &exitReason)
1505     {
1506         return 0;
1507     }
1508 
1509     /**
1510      * Record app exit reason.
1511      * @param exitReason The reason of app exit.
1512      * @return Returns ERR_OK on success, others on failure.
1513      */
RecordAppExitReason(const ExitReason & exitReason)1514     virtual int32_t RecordAppExitReason(const ExitReason &exitReason)
1515     {
1516         return 0;
1517     }
1518 
1519     /**
1520      * Record the process exit reason before the process being killed.
1521      * @param pid The process id.
1522      * @param exitReason The reason of process exit.
1523      * @return Returns ERR_OK on success, others on failure.
1524      */
RecordProcessExitReason(const int32_t pid,const ExitReason & exitReason)1525     virtual int32_t RecordProcessExitReason(const int32_t pid, const ExitReason &exitReason)
1526     {
1527         return 0;
1528     }
1529 
1530     /**
1531      * Record the exit reason of a killed process.
1532      * @param pid The process id.
1533      * @param uid The process uid.
1534      * @param exitReason The reason of process exit.
1535      * @return Returns ERR_OK on success, others on failure.
1536      */
RecordProcessExitReason(int32_t pid,int32_t uid,const ExitReason & exitReason)1537     virtual int32_t RecordProcessExitReason(int32_t pid, int32_t uid, const ExitReason &exitReason)
1538     {
1539         return 0;
1540     }
1541 
1542     /**
1543      * Set rootSceneSession by SCB.
1544      *
1545      * @param rootSceneSession Indicates root scene session of SCB.
1546      */
SetRootSceneSession(const sptr<IRemoteObject> & rootSceneSession)1547     virtual void SetRootSceneSession(const sptr<IRemoteObject> &rootSceneSession) {}
1548 
1549     /**
1550      * Call UIAbility by SCB.
1551      *
1552      * @param sessionInfo the session info of the ability to be called.
1553      * @param isColdStart the session of the ability is or not cold start.
1554      */
CallUIAbilityBySCB(const sptr<SessionInfo> & sessionInfo,bool & isColdStart)1555     virtual void CallUIAbilityBySCB(const sptr<SessionInfo> &sessionInfo, bool &isColdStart) {}
1556 
1557     /**
1558      * Start specified ability by SCB.
1559      *
1560      * @param want Want information.
1561      * @return Returns ERR_OK on success, others on failure.
1562      */
StartSpecifiedAbilityBySCB(const Want & want)1563     virtual int32_t StartSpecifiedAbilityBySCB(const Want &want)
1564     {
1565         return 0;
1566     }
1567 
1568     /**
1569      * Notify sandbox app the result of saving file.
1570      * @param want Result of saving file, which contains the file's uri if success.
1571      * @param resultCode Indicates the action's result.
1572      * @param requestCode Pass the requestCode to match request.
1573      * @return Returns ERR_OK on success, others on failure.
1574      */
NotifySaveAsResult(const Want & want,int resultCode,int requestCode)1575     virtual int32_t NotifySaveAsResult(const Want &want, int resultCode, int requestCode)
1576     {
1577         return 0;
1578     }
1579 
1580     /**
1581      * Set sessionManagerService
1582      * @param sessionManagerService the point of sessionManagerService.
1583      *
1584      * @return Returns ERR_OK on success, others on failure.
1585      */
SetSessionManagerService(const sptr<IRemoteObject> & sessionManagerService)1586     virtual int32_t SetSessionManagerService(const sptr<IRemoteObject> &sessionManagerService)
1587     {
1588         return 0;
1589     }
1590 
1591     /**
1592      * @brief Register collaborator.
1593      * @param type collaborator type.
1594      * @param impl collaborator.
1595      * @return 0 or else.
1596     */
RegisterIAbilityManagerCollaborator(int32_t type,const sptr<IAbilityManagerCollaborator> & impl)1597     virtual int32_t RegisterIAbilityManagerCollaborator(int32_t type, const sptr<IAbilityManagerCollaborator> &impl)
1598     {
1599         return 0;
1600     }
1601 
1602     /**
1603      * @brief Unregister collaborator.
1604      * @param type collaborator type.
1605      * @return 0 or else.
1606     */
UnregisterIAbilityManagerCollaborator(int32_t type)1607     virtual int32_t UnregisterIAbilityManagerCollaborator(int32_t type)
1608     {
1609         return 0;
1610     }
1611 
1612     /**
1613      * @brief get ability manager collaborator.
1614      * @return Returns object pointer on success, others on null.
1615      */
GetAbilityManagerCollaborator()1616     virtual sptr<IAbilityManagerCollaborator> GetAbilityManagerCollaborator()
1617     {
1618         return nullptr;
1619     }
1620 
RegisterStatusBarDelegate(sptr<AbilityRuntime::IStatusBarDelegate> delegate)1621     virtual int32_t RegisterStatusBarDelegate(sptr<AbilityRuntime::IStatusBarDelegate> delegate)
1622     {
1623         return 0;
1624     }
1625 
KillProcessWithPrepareTerminate(const std::vector<int32_t> & pids)1626     virtual int32_t KillProcessWithPrepareTerminate(const std::vector<int32_t>& pids)
1627     {
1628         return 0;
1629     }
1630 
KillProcessWithReason(int32_t pid,const ExitReason & reason)1631     virtual int32_t KillProcessWithReason(int32_t pid, const ExitReason &reason)
1632     {
1633         return 0;
1634     }
1635 
1636     /**
1637      * @brief Register auto start up callback for system api.
1638      * @param callback The point of JsAbilityAutoStartupCallBack.
1639      * @return Returns ERR_OK on success, others on failure.
1640      */
RegisterAutoStartupSystemCallback(const sptr<IRemoteObject> & callback)1641     virtual int32_t RegisterAutoStartupSystemCallback(const sptr<IRemoteObject> &callback)
1642     {
1643         return 0;
1644     }
1645 
1646     /**
1647      * @brief Unregister auto start up callback for system api.
1648      * @param callback The point of JsAbilityAutoStartupCallBack.
1649      * @return Returns ERR_OK on success, others on failure.
1650      */
UnregisterAutoStartupSystemCallback(const sptr<IRemoteObject> & callback)1651     virtual int32_t UnregisterAutoStartupSystemCallback(const sptr<IRemoteObject> &callback)
1652     {
1653         return 0;
1654     }
1655 
1656     /**
1657      * @brief Set every application auto start up state.
1658      * @param info The auto startup info,include bundle name, module name, ability name.
1659      * @return Returns ERR_OK on success, others on failure.
1660      */
SetApplicationAutoStartup(const AutoStartupInfo & info)1661     virtual int32_t SetApplicationAutoStartup(const AutoStartupInfo &info)
1662     {
1663         return 0;
1664     }
1665 
1666     /**
1667      * @brief Cancel every application auto start up .
1668      * @param info The auto startup info,include bundle name, module name, ability name.
1669      * @return Returns ERR_OK on success, others on failure.
1670      */
CancelApplicationAutoStartup(const AutoStartupInfo & info)1671     virtual int32_t CancelApplicationAutoStartup(const AutoStartupInfo &info)
1672     {
1673         return 0;
1674     }
1675 
1676     /**
1677      * @brief Query auto startup state all application.
1678      * @param infoList Output parameters, return auto startup info list.
1679      * @return Returns ERR_OK on success, others on failure.
1680      */
QueryAllAutoStartupApplications(std::vector<AutoStartupInfo> & infoList)1681     virtual int32_t QueryAllAutoStartupApplications(std::vector<AutoStartupInfo> &infoList)
1682     {
1683         return 0;
1684     }
1685 
1686     /**
1687      * PrepareTerminateAbilityBySCB, prepare to terminate ability by scb.
1688      *
1689      * @param sessionInfo the session info of the ability to start.
1690      * @param isPrepareTerminate the result of ability onPrepareToTerminate
1691      * @return Returns ERR_OK on success, others on failure.
1692      */
PrepareTerminateAbilityBySCB(const sptr<SessionInfo> & sessionInfo,bool & isPrepareTerminate)1693     virtual int PrepareTerminateAbilityBySCB(const sptr<SessionInfo> &sessionInfo, bool &isPrepareTerminate)
1694     {
1695         return 0;
1696     }
1697 
1698     /**
1699      * @brief Register app debug listener.
1700      * @param listener App debug listener.
1701      * @return Returns ERR_OK on success, others on failure.
1702      */
1703     virtual int32_t RegisterAppDebugListener(sptr<AppExecFwk::IAppDebugListener> listener) = 0;
1704 
1705     /**
1706      * @brief Unregister app debug listener.
1707      * @param listener App debug listener.
1708      * @return Returns ERR_OK on success, others on failure.
1709      */
1710     virtual int32_t UnregisterAppDebugListener(sptr<AppExecFwk::IAppDebugListener> listener) = 0;
1711 
1712     /**
1713      * @brief Attach app debug.
1714      * @param bundleName The application bundle name.
1715      * @return Returns ERR_OK on success, others on failure.
1716      */
1717     virtual int32_t AttachAppDebug(const std::string &bundleName, bool isDebugFromLocal) = 0;
1718 
1719     /**
1720      * @brief Detach app debug.
1721      * @param bundleName The application bundle name.
1722      * @return Returns ERR_OK on success, others on failure.
1723      */
1724     virtual int32_t DetachAppDebug(const std::string &bundleName, bool isDebugFromLocal) = 0;
1725 
1726     /**
1727      * @brief Execute intent.
1728      * @param key The key of intent executing client.
1729      * @param callerToken Caller ability token.
1730      * @param param The Intent execute param.
1731      * @return Returns ERR_OK on success, others on failure.
1732      */
1733     virtual int32_t ExecuteIntent(uint64_t key, const sptr<IRemoteObject> &callerToken,
1734         const InsightIntentExecuteParam &param) = 0;
1735 
1736     /**
1737      * @brief Check if ability controller can start.
1738      * @param want The want of ability to start.
1739      * @return Return true to allow ability to start, or false to reject.
1740      */
IsAbilityControllerStart(const Want & want)1741     virtual bool IsAbilityControllerStart(const Want &want)
1742     {
1743         return true;
1744     }
1745 
1746     /**
1747      * @brief Called when insight intent execute finished.
1748      *
1749      * @param token ability's token.
1750      * @param intentId insight intent id.
1751      * @param result insight intent execute result.
1752      * @return Returns ERR_OK on success, others on failure.
1753      */
1754     virtual int32_t ExecuteInsightIntentDone(const sptr<IRemoteObject> &token, uint64_t intentId,
1755         const InsightIntentExecuteResult &result) = 0;
1756 
1757     /**
1758      * @brief Set application auto start up state by EDM.
1759      * @param info The auto startup info, include bundle name, module name, ability name.
1760      * @param flag Indicate whether the application is prohibited from changing the auto start up state.
1761      * @return Returns ERR_OK on success, others on failure.
1762      */
1763     virtual int32_t SetApplicationAutoStartupByEDM(const AutoStartupInfo &info, bool flag) = 0;
1764 
1765     /**
1766      * @brief Cancel application auto start up state by EDM.
1767      * @param info The auto startup info, include bundle name, module name, ability name.
1768      * @param flag Indicate whether the application is prohibited from changing the auto start up state.
1769      * @return Returns ERR_OK on success, others on failure.
1770      */
1771     virtual int32_t CancelApplicationAutoStartupByEDM(const AutoStartupInfo &info, bool flag) = 0;
1772 
1773     /**
1774      * @brief Get foreground ui abilities.
1775      * @param list Foreground ui abilities.
1776      * @return Returns ERR_OK on success, others on failure.
1777      */
1778     virtual int32_t GetForegroundUIAbilities(std::vector<AppExecFwk::AbilityStateData> &list) = 0;
1779 
1780     /**
1781      * @brief Open file by uri.
1782      * @param uri The file uri.
1783      * @param flag Want::FLAG_AUTH_READ_URI_PERMISSION or Want::FLAG_AUTH_WRITE_URI_PERMISSION.
1784      * @return int The file descriptor.
1785      */
OpenFile(const Uri & uri,uint32_t flag)1786     virtual int32_t OpenFile(const Uri& uri, uint32_t flag)
1787     {
1788         return 0;
1789     }
1790 
1791     /**
1792      * @brief Update session info.
1793      * @param sessionInfos The vector of session info.
1794      */
UpdateSessionInfoBySCB(std::list<SessionInfo> & sessionInfos,int32_t userId,std::vector<int32_t> & sessionIds)1795     virtual int32_t UpdateSessionInfoBySCB(std::list<SessionInfo> &sessionInfos, int32_t userId,
1796         std::vector<int32_t> &sessionIds)
1797     {
1798         return 0;
1799     }
1800 
1801     /**
1802      * @brief Restart app self.
1803      * @param want The ability type must be UIAbility.
1804      * @param isAppRecovery True indicates that the app is restarted because of recovery.
1805      * @return Returns ERR_OK on success, others on failure.
1806      */
1807     virtual int32_t RestartApp(const AAFwk::Want &want, bool isAppRecovery = false)
1808     {
1809         return 0;
1810     }
1811 
1812     /**
1813      * @brief Get host info of root caller.
1814      *
1815      * @param token The ability token.
1816      * @param hostInfo The host info of root caller.
1817      * @param userId The user id.
1818      * @return int32_t Returns 0 on success, others on failure.
1819      */
1820     virtual int32_t GetUIExtensionRootHostInfo(const sptr<IRemoteObject> token, UIExtensionHostInfo &hostInfo,
1821         int32_t userId = DEFAULT_INVAL_VALUE)
1822     {
1823         return 0;
1824     }
1825 
1826     /**
1827      * @brief Get ui extension session info
1828      *
1829      * @param token The ability token.
1830      * @param uiExtensionSessionInfo The ui extension session info.
1831      * @param userId The user id.
1832      * @return int32_t Returns ERR_OK on success, others on failure.
1833      */
1834     virtual int32_t GetUIExtensionSessionInfo(const sptr<IRemoteObject> token,
1835         UIExtensionSessionInfo &uiExtensionSessionInfo, int32_t userId = DEFAULT_INVAL_VALUE)
1836     {
1837         return 0;
1838     }
1839 
1840     /**
1841      * Open link of ability and atomic service.
1842      *
1843      * @param want Ability want.
1844      * @param callerToken Caller ability token.
1845      * @param userId User ID.
1846      * @param requestCode Ability request code.
1847      * @return Returns ERR_OK on success, others on failure.
1848     */
1849     virtual int32_t OpenLink(const Want& want, sptr<IRemoteObject> callerToken,
1850         int32_t userId = DEFAULT_INVAL_VALUE, int requestCode = DEFAULT_INVAL_VALUE)
1851     {
1852         return 0;
1853     }
1854 
1855     /**
1856      * @brief Pop-up launch of full-screen atomic service.
1857      * @param want The want with parameters.
1858      * @param callerToken caller ability token.
1859      * @param requestCode Ability request code.
1860      * @param userId The User ID.
1861      * @return Returns ERR_OK on success, others on failure.
1862      */
1863     virtual int32_t OpenAtomicService(Want& want, const StartOptions &options, sptr<IRemoteObject> callerToken,
1864         int32_t requestCode = DEFAULT_INVAL_VALUE, int32_t userId = DEFAULT_INVAL_VALUE)
1865     {
1866         return 0;
1867     }
1868 
1869     /*
1870      * Set the enable status for starting and stopping resident processes.
1871      * The caller application can only set the resident status of the configured process.
1872      * @param bundleName The bundle name of the resident process.
1873      * @param enable Set resident process enable status.
1874      * @return Returns ERR_OK on success, others on failure.
1875      */
SetResidentProcessEnabled(const std::string & bundleName,bool enable)1876     virtual int32_t SetResidentProcessEnabled(const std::string &bundleName, bool enable)
1877     {
1878         return 0;
1879     }
1880 
1881     /**
1882      * @brief Querying whether to allow embedded startup of atomic service.
1883      *
1884      * @param token The caller UIAbility token.
1885      * @param appId The ID of the application to which this bundle belongs.
1886      * @return Returns true to allow ability to start, or false to reject.
1887      */
IsEmbeddedOpenAllowed(sptr<IRemoteObject> callerToken,const std::string & appId)1888     virtual bool IsEmbeddedOpenAllowed(sptr<IRemoteObject> callerToken, const std::string &appId)
1889     {
1890         return true;
1891     }
1892 
1893     /**
1894      * @brief Request to display assert fault dialog.
1895      * @param callback Listen for user operation callbacks.
1896      * @param wantParams Assert dialog box display information.
1897      * @return Returns ERR_OK on success, others on failure.
1898      */
RequestAssertFaultDialog(const sptr<IRemoteObject> & callback,const AAFwk::WantParams & wantParams)1899     virtual int32_t RequestAssertFaultDialog(const sptr<IRemoteObject> &callback, const AAFwk::WantParams &wantParams)
1900     {
1901         return -1;
1902     }
1903 
1904     /**
1905      * @brief Notify the operation status of the user.
1906      * @param assertFaultSessionId Indicates the request ID of AssertFault.
1907      * @param userStatus Operation status of the user.
1908      * @return Returns ERR_OK on success, others on failure.
1909      */
NotifyDebugAssertResult(uint64_t assertFaultSessionId,AAFwk::UserStatus userStatus)1910     virtual int32_t NotifyDebugAssertResult(uint64_t assertFaultSessionId, AAFwk::UserStatus userStatus)
1911     {
1912         return -1;
1913     }
1914 
1915     /**
1916      * Starts a new ability with specific start options.
1917      *
1918      * @param want, the want of the ability to start.
1919      * @param startOptions Indicates the options used to start.
1920      * @return Returns ERR_OK on success, others on failure.
1921      */
StartShortcut(const Want & want,const StartOptions & startOptions)1922     virtual int32_t StartShortcut(const Want &want, const StartOptions &startOptions)
1923     {
1924         return 0;
1925     }
1926 
1927     /**
1928      * Get ability state by persistent id.
1929      *
1930      * @param persistentId, the persistentId of the session.
1931      * @param state Indicates the ability state.
1932      * @return Returns ERR_OK on success, others on failure.
1933      */
GetAbilityStateByPersistentId(int32_t persistentId,bool & state)1934     virtual int32_t GetAbilityStateByPersistentId(int32_t persistentId, bool &state)
1935     {
1936         return 0;
1937     }
1938 
1939     /**
1940      * Transfer resultCode & want to ability manager service.
1941      *
1942      * @param resultCode, the resultCode of the ability to terminate.
1943      * @param resultWant, the Want of the ability to return.
1944      * @return Returns ERR_OK on success, others on failure.
1945      */
TransferAbilityResultForExtension(const sptr<IRemoteObject> & callerToken,int32_t resultCode,const Want & want)1946     virtual int32_t TransferAbilityResultForExtension(const sptr<IRemoteObject> &callerToken, int32_t resultCode,
1947         const Want &want)
1948     {
1949         return 0;
1950     }
1951 
1952     /**
1953      * Notify ability manager service frozen process.
1954      *
1955      * @param pidList, the pid list of the frozen process.
1956      * @param uid, the uid of the frozen process.
1957      */
NotifyFrozenProcessByRSS(const std::vector<int32_t> & pidList,int32_t uid)1958     virtual void NotifyFrozenProcessByRSS(const std::vector<int32_t> &pidList, int32_t uid)
1959     {
1960         return;
1961     }
1962 
1963     /**
1964      *  Request to clean UIAbility from user.
1965      *
1966      * @param sessionInfo the session info of the ability to clean.
1967      * @param sceneFlag the reason info of the ability to terminate.
1968      * @return Returns ERR_OK on success, others on failure.
1969      */
1970     virtual int32_t CleanUIAbilityBySCB(const sptr<SessionInfo> &sessionInfo, bool isUserRequestedExit,
1971         uint32_t sceneFlag = 0)
1972     {
1973         return 0;
1974     }
1975 
1976     /**
1977      * Open atomic service window prior to finishing free install.
1978      *
1979      * @param bundleName, the bundle name of the atomic service.
1980      * @param moduleName, the module name of the atomic service.
1981      * @param abilityName, the ability name of the atomic service.
1982      * @param startTime, the starting time of the free install task.
1983      * @return Returns ERR_OK on success, others on failure.
1984      */
PreStartMission(const std::string & bundleName,const std::string & moduleName,const std::string & abilityName,const std::string & startTime)1985     virtual int32_t PreStartMission(const std::string& bundleName, const std::string& moduleName,
1986         const std::string& abilityName, const std::string& startTime)
1987     {
1988         return 0;
1989     }
1990 
1991     /**
1992      * Terminate the mission.
1993      *
1994      * @param missionId, The mission id of the UIAbility need to be terminated.
1995      * @return Returns ERR_OK on success, others on failure.
1996      */
TerminateMission(int32_t missionId)1997     virtual int32_t TerminateMission(int32_t missionId)
1998     {
1999         return 0;
2000     }
2001 
2002     /**
2003      * Notify ability manager to set the flag to block all apps from starting.
2004      * Needs to apply for ohos.permission.BLOCK_ALL_APP_START.
2005      * @param flag, The flag to block all apps from starting
2006      * @return Returns ERR_OK on success, others on failure.
2007      */
BlockAllAppStart(bool flag)2008     virtual int32_t BlockAllAppStart(bool flag)
2009     {
2010         return 0;
2011     }
2012 
2013     /**
2014      * update associate config list by rss.
2015      *
2016      * @param configs The rss config info.
2017      * @param exportConfigs The rss export config info.
2018      * @param flag UPDATE_CONFIG_FLAG_COVER is cover config, UPDATE_CONFIG_FLAG_APPEND is append config.
2019      */
UpdateAssociateConfigList(const std::map<std::string,std::list<std::string>> & configs,const std::list<std::string> & exportConfigs,int32_t flag)2020     virtual int32_t UpdateAssociateConfigList(const std::map<std::string, std::list<std::string>>& configs,
2021         const std::list<std::string>& exportConfigs, int32_t flag)
2022     {
2023         return 0;
2024     }
2025 
2026     /**
2027      * Set keep-alive flag for application under a specific user.
2028      * @param bundleName Bundle name.
2029      * @param userId User Id.
2030      * @param flag Keep-alive flag.
2031      * @return Returns ERR_OK on success, others on failure.
2032      */
SetApplicationKeepAlive(const std::string & bundleName,int32_t userId,bool flag)2033     virtual int32_t SetApplicationKeepAlive(const std::string &bundleName, int32_t userId, bool flag)
2034     {
2035         return 0;
2036     }
2037 
2038     /**
2039      * Get keep-alive applications.
2040      * @param appType Application type.
2041      * @param userId User Id.
2042      * @param list List of Keep-alive information.
2043      * @return Returns ERR_OK on success, others on failure.
2044      */
QueryKeepAliveApplications(int32_t appType,int32_t userId,std::vector<KeepAliveInfo> & list)2045     virtual int32_t QueryKeepAliveApplications(int32_t appType, int32_t userId, std::vector<KeepAliveInfo> &list)
2046     {
2047         return 0;
2048     }
2049 
2050     /**
2051      * Set keep-alive flag for application under a specific user by EDM.
2052      * @param bundleName Bundle name.
2053      * @param userId User Id.
2054      * @param flag Keep-alive flag.
2055      * @return Returns ERR_OK on success, others on failure.
2056      */
2057     virtual int32_t SetApplicationKeepAliveByEDM(const std::string &bundleName, int32_t userId,
2058         bool flag, bool isAllowUserToCancel = false)
2059     {
2060         return 0;
2061     }
2062 
2063     /**
2064      * Get keep-alive applications by EDM.
2065      * @param appType Application type.
2066      * @param userId User Id.
2067      * @param list List of Keep-alive information.
2068      * @return Returns ERR_OK on success, others on failure.
2069      */
QueryKeepAliveApplicationsByEDM(int32_t appType,int32_t userId,std::vector<KeepAliveInfo> & list)2070     virtual int32_t QueryKeepAliveApplicationsByEDM(int32_t appType, int32_t userId, std::vector<KeepAliveInfo> &list)
2071     {
2072         return 0;
2073     }
2074 
GetAllIntentExemptionInfo(std::vector<AppExecFwk::IntentExemptionInfo> & info)2075     virtual int32_t GetAllIntentExemptionInfo(std::vector<AppExecFwk::IntentExemptionInfo> &info)
2076     {
2077         return 0;
2078     }
2079 
2080     /**
2081      * Add query ERMS observer.
2082      *
2083      * @param callerToken, The caller ability token.
2084      * @param observer, The observer of the ability to query ERMS.
2085      * @return Returns ERR_OK on success, others on failure.
2086      */
AddQueryERMSObserver(sptr<IRemoteObject> callerToken,sptr<AbilityRuntime::IQueryERMSObserver> observer)2087     virtual int32_t AddQueryERMSObserver(sptr<IRemoteObject> callerToken,
2088         sptr<AbilityRuntime::IQueryERMSObserver> observer)
2089     {
2090         return 0;
2091     }
2092 
2093     /**
2094      * Restart atomic service.
2095      *
2096      * @param callerToken, The caller ability token.
2097      * @return Returns ERR_OK on success, others on failure.
2098      */
RestartSelfAtomicService(sptr<IRemoteObject> callerToken)2099     virtual int32_t RestartSelfAtomicService(sptr<IRemoteObject> callerToken)
2100     {
2101         return 0;
2102     }
2103 
2104     /**
2105      * Query atomic service ERMS rule.
2106      *
2107      * @param callerToken, The caller ability token.
2108      * @param appId, The appId of the atomic service.
2109      * @param startTime, The startTime of the query.
2110      * @param rule, The returned ERMS rule.
2111      * @return Returns ERR_OK on success, others on failure.
2112      */
QueryAtomicServiceStartupRule(sptr<IRemoteObject> callerToken,const std::string & appId,const std::string & startTime,AtomicServiceStartupRule & rule)2113     virtual int32_t QueryAtomicServiceStartupRule(sptr<IRemoteObject> callerToken,
2114         const std::string &appId, const std::string &startTime, AtomicServiceStartupRule &rule)
2115     {
2116         return 0;
2117     }
2118 
2119     /**
2120      * PrepareTerminateAbilityDone, called when PrepareTerminateAbility call is done.
2121      *
2122      * @param token, the token of the ability to terminate.
2123      * @param isTerminate, indicates whether the ability should be terminated.
2124      */
PrepareTerminateAbilityDone(const sptr<IRemoteObject> & token,bool isTerminate)2125     virtual void PrepareTerminateAbilityDone(const sptr<IRemoteObject> &token, bool isTerminate)
2126     {}
2127 
2128     /**
2129      * KillProcessWithPrepareTerminateDone, called when KillProcessWithPrepareTerminate call is done.
2130      *
2131      * @param moduleName, the module name of the application.
2132      * @param prepareTermination, the result of prepareTermination call of the module.
2133      * @param isExist, whether the prepareTerminate functions are implemented.
2134      */
KillProcessWithPrepareTerminateDone(const std::string & moduleName,int32_t prepareTermination,bool isExist)2135     virtual void KillProcessWithPrepareTerminateDone(const std::string &moduleName,
2136         int32_t prepareTermination, bool isExist)
2137     {}
2138 
2139     /**
2140      * KillProcessForPermissionUpdate, call KillProcessForPermissionUpdate() through proxy object,
2141      * force kill the application by accessTokenId, notify exception to SCB.
2142      *
2143      * @param  accessTokenId, accessTokenId.
2144      * @return ERR_OK, return back success, others fail.
2145      */
KillProcessForPermissionUpdate(uint32_t accessTokenId)2146     virtual int32_t KillProcessForPermissionUpdate(uint32_t accessTokenId)
2147     {
2148         return 0;
2149     }
2150 
2151     /**
2152      * Register hidden start observer.
2153      * @param observer, ability token.
2154      * @return Returns ERR_OK on success, others on failure.
2155      */
RegisterHiddenStartObserver(const sptr<IHiddenStartObserver> & observer)2156     virtual int32_t RegisterHiddenStartObserver(const sptr<IHiddenStartObserver> &observer)
2157     {
2158         return 0;
2159     }
2160 
2161     /**
2162      * Unregister hidden start observer.
2163      * @param observer, ability token.
2164      * @return Returns ERR_OK on success, others on failure.
2165      */
UnregisterHiddenStartObserver(const sptr<IHiddenStartObserver> & observer)2166     virtual int32_t UnregisterHiddenStartObserver(const sptr<IHiddenStartObserver> &observer)
2167     {
2168         return 0;
2169     }
2170     /**
2171      * Query preload uiextension record.
2172      *
2173      * @param element, The uiextension ElementName.
2174      * @param moduleName, The uiextension moduleName.
2175      * @param hostBundleName, The uiextension caller hostBundleName.
2176      * @param recordNum, The returned count of uiextension.
2177      * @param userId, The User Id.
2178      * @return Returns ERR_OK on success, others on failure.
2179      */
2180     virtual int32_t QueryPreLoadUIExtensionRecord(const AppExecFwk::ElementName &element,
2181                                                   const std::string &moduleName,
2182                                                   const std::string &hostBundleName,
2183                                                   int32_t &recordNum,
2184                                                   int32_t userId = DEFAULT_INVAL_VALUE)
2185     {
2186         return 0;
2187     }
2188 
2189     /**
2190      * Revoke delegator.
2191      *
2192      * @param token, ability token.
2193      * @return Returns ERR_OK on success, others on failure.
2194      */
RevokeDelegator(sptr<IRemoteObject> token)2195     virtual int32_t RevokeDelegator(sptr<IRemoteObject> token)
2196     {
2197         return 0;
2198     }
2199 
StartAbilityWithWait(Want & want,sptr<IAbilityStartWithWaitObserver> & observer)2200     virtual int32_t StartAbilityWithWait(Want &want, sptr<IAbilityStartWithWaitObserver> &observer)
2201     {
2202         return 0;
2203     }
2204 
2205     /**
2206      * Get all insight intent infos.
2207      * @param flag, the get type.
2208      * @param infos, the insight intent infos.
2209      * @return Returns ERR_OK on success, others on failure.
2210      */
GetAllInsightIntentInfo(AbilityRuntime::GetInsightIntentFlag flag,std::vector<InsightIntentInfoForQuery> & infos)2211     virtual int32_t GetAllInsightIntentInfo(
2212         AbilityRuntime::GetInsightIntentFlag flag,
2213         std::vector<InsightIntentInfoForQuery> &infos)
2214     {
2215         return 0;
2216     }
2217 
2218     /**
2219      * Get specified bundleName insight intent infos.
2220      * @param flag, the get type.
2221      * @param infos, the insight intent infos.
2222      * @param bundleName, The get insightIntent bundleName.
2223      * @return Returns ERR_OK on success, others on failure.
2224      */
GetInsightIntentInfoByBundleName(AbilityRuntime::GetInsightIntentFlag flag,const std::string & bundleName,std::vector<InsightIntentInfoForQuery> & infos)2225     virtual int32_t GetInsightIntentInfoByBundleName(
2226         AbilityRuntime::GetInsightIntentFlag flag,
2227         const std::string &bundleName,
2228         std::vector<InsightIntentInfoForQuery> &infos)
2229     {
2230         return 0;
2231     }
2232 
2233     /**
2234      * Get specified intentName insight intent infos.
2235      * @param flag, the get type.
2236      * @param infos, the insight intent infos.
2237      * @param bundleName, The get insightIntent bundleName.
2238      * @param moduleName, The get insightIntent moduleName.
2239      * @param intentName, The get intent name.
2240      * @return Returns ERR_OK on success, others on failure.
2241      */
GetInsightIntentInfoByIntentName(AbilityRuntime::GetInsightIntentFlag flag,const std::string & bundleName,const std::string & moduleName,const std::string & intentName,InsightIntentInfoForQuery & info)2242     virtual int32_t GetInsightIntentInfoByIntentName(
2243         AbilityRuntime::GetInsightIntentFlag flag,
2244         const std::string &bundleName,
2245         const std::string &moduleName,
2246         const std::string &intentName,
2247         InsightIntentInfoForQuery &info)
2248     {
2249         return 0;
2250     }
2251 
UpdateKioskApplicationList(const std::vector<std::string> & appList)2252     virtual int32_t UpdateKioskApplicationList(const std::vector<std::string> &appList)
2253     {
2254         return 0;
2255     }
2256 
EnterKioskMode(sptr<IRemoteObject> callerToken)2257     virtual int32_t EnterKioskMode(sptr<IRemoteObject> callerToken)
2258     {
2259         return 0;
2260     }
2261 
ExitKioskMode(sptr<IRemoteObject> callerToken)2262     virtual int32_t ExitKioskMode(sptr<IRemoteObject> callerToken)
2263     {
2264         return 0;
2265     }
2266 
GetKioskStatus(AAFwk::KioskStatus & kioskStatus)2267     virtual int32_t GetKioskStatus(AAFwk::KioskStatus &kioskStatus)
2268     {
2269         return 0;
2270     }
2271 
2272     /**
2273      * Register sa interceptor.
2274      * @param interceptor, The sa interceptor.
2275      * @return Returns ERR_OK on success, others on failure.
2276      */
RegisterSAInterceptor(sptr<AbilityRuntime::ISAInterceptor> interceptor)2277     virtual int32_t RegisterSAInterceptor(sptr<AbilityRuntime::ISAInterceptor> interceptor)
2278     {
2279         return 0;
2280     }
2281 
2282     /**
2283      * Set keep-alive flag for app service extension under u1 user.
2284      * @param bundleName Bundle name.
2285      * @param flag Keep-alive flag.
2286      * @return Returns ERR_OK on success, others on failure.
2287      */
SetAppServiceExtensionKeepAlive(const std::string & bundleName,bool flag)2288     virtual int32_t SetAppServiceExtensionKeepAlive(const std::string &bundleName, bool flag)
2289     {
2290         return 0;
2291     }
2292 
2293     /**
2294      * Get keep-alive app service extensions.
2295      * @param list List of Keep-alive information.
2296      * @return Returns ERR_OK on success, others on failure.
2297      */
QueryKeepAliveAppServiceExtensions(std::vector<KeepAliveInfo> & list)2298     virtual int32_t QueryKeepAliveAppServiceExtensions(std::vector<KeepAliveInfo> &list)
2299     {
2300         return 0;
2301     }
2302 
SetOnNewWantSkipScenarios(sptr<IRemoteObject> callerToken,int32_t scenarios)2303     virtual int32_t SetOnNewWantSkipScenarios(sptr<IRemoteObject> callerToken, int32_t scenarios)
2304     {
2305         return 0;
2306     }
2307 
2308     /**
2309      * SCB notifies AbilityManagerService that UIAbility startup was intercepted.
2310      *
2311      * @param requestId The request id.
2312      * @return Returns ERR_OK on success, others on failure.
2313      */
NotifyStartupExceptionBySCB(int32_t requestId)2314     virtual int32_t NotifyStartupExceptionBySCB(int32_t requestId)
2315     {
2316         return 0;
2317     }
2318 
2319     /**
2320      * Preload application.
2321      * @param bundleName Name of the application.
2322      * @param userId user id.
2323      * @param appIndex app clone index. Reserved field, only appIndex=0 is supported.
2324      * @return Returns ERR_OK on success, others on failure.
2325      */
PreloadApplication(const std::string & bundleName,int32_t userId,int32_t appIndex)2326     virtual int32_t PreloadApplication(const std::string &bundleName, int32_t userId, int32_t appIndex)
2327     {
2328         return 0;
2329     }
2330 };
2331 }  // namespace AAFwk
2332 }  // namespace OHOS
2333 #endif  // OHOS_ABILITY_RUNTIME_ABILITY_MANAGER_INTERFACE_H
2334