• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2023-2024 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef OHOS_ABILITY_RUNTIME_ABILITY_MANAGER_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 "ability_connect_callback_interface.h"
25 #include "ability_manager_ipc_interface_code.h"
26 #include "ability_running_info.h"
27 #include "ability_scheduler_interface.h"
28 #include "ability_start_setting.h"
29 #include "ability_state.h"
30 #include "ability_state_data.h"
31 #include "app_debug_listener_interface.h"
32 #include "auto_startup_info.h"
33 #include "dms_continueInfo.h"
34 #include "exit_reason.h"
35 #include "extension_running_info.h"
36 #include "free_install_observer_interface.h"
37 #include "iability_controller.h"
38 #include "iability_manager_collaborator.h"
39 #include "iacquire_share_data_callback_interface.h"
40 #include "insight_intent_execute_param.h"
41 #include "insight_intent_execute_result.h"
42 #include "iprepare_terminate_callback_interface.h"
43 #include "mission_info.h"
44 #include "mission_listener_interface.h"
45 #include "mission_snapshot.h"
46 #include "remote_mission_listener_interface.h"
47 #include "remote_on_listener_interface.h"
48 #include "running_process_info.h"
49 #include "sender_info.h"
50 #include "snapshot.h"
51 #include "start_options.h"
52 #include "user_callback.h"
53 #include "system_memory_attr.h"
54 #include "ui_extension_ability_connect_info.h"
55 #include "ui_extension_host_info.h"
56 #include "ui_extension_session_info.h"
57 #include "ui_extension_window_command.h"
58 #include "uri.h"
59 #include "want.h"
60 #include "want_receiver_interface.h"
61 #include "want_sender_info.h"
62 #include "want_sender_interface.h"
63 #include "dialog_session_info.h"
64 #ifdef SUPPORT_GRAPHICS
65 #include "window_manager_service_handler.h"
66 #include "ability_first_frame_state_observer_interface.h"
67 #endif
68 
69 namespace OHOS {
70 namespace AbilityRuntime {
71 class IStatusBarDelegate;
72 }
73 
74 namespace AAFwk {
75 using AutoStartupInfo = AbilityRuntime::AutoStartupInfo;
76 using InsightIntentExecuteParam = AppExecFwk::InsightIntentExecuteParam;
77 using InsightIntentExecuteResult = AppExecFwk::InsightIntentExecuteResult;
78 using UIExtensionAbilityConnectInfo = AbilityRuntime::UIExtensionAbilityConnectInfo;
79 using UIExtensionHostInfo = AbilityRuntime::UIExtensionHostInfo;
80 using UIExtensionSessionInfo = AbilityRuntime::UIExtensionSessionInfo;
81 #ifdef SUPPORT_GRAPHICS
82 using IAbilityFirstFrameStateObserver = AppExecFwk::IAbilityFirstFrameStateObserver;
83 #endif
84 
85 constexpr const char* ABILITY_MANAGER_SERVICE_NAME = "AbilityManagerService";
86 const int DEFAULT_INVAL_VALUE = -1;
87 const int DELAY_LOCAL_FREE_INSTALL_TIMEOUT = 40000;
88 const int DELAY_REMOTE_FREE_INSTALL_TIMEOUT = 30000 + DELAY_LOCAL_FREE_INSTALL_TIMEOUT;
89 constexpr const char* FROM_REMOTE_KEY = "freeInstallFromRemote";
90 /**
91  * @class IAbilityManager
92  * IAbilityManager interface is used to access ability manager services.
93  */
94 class IAbilityManager : public OHOS::IRemoteBroker {
95 public:
96     DECLARE_INTERFACE_DESCRIPTOR(u"ohos.aafwk.AbilityManager")
97 
98     /**
99      * StartAbility with want, send want to ability manager service.
100      *
101      * @param want, the want of the ability to start.
102      * @param userId, Designation User ID.
103      * @param requestCode, Ability request code.
104      * @return Returns ERR_OK on success, others on failure.
105      */
106     virtual int StartAbility(
107         const Want &want,
108         int32_t userId = DEFAULT_INVAL_VALUE,
109         int requestCode = DEFAULT_INVAL_VALUE) = 0;
110 
111     /**
112      * StartAbility with want, send want to ability manager service.
113      *
114      * @param want, the want of the ability to start.
115      * @param callerToken, caller ability token.
116      * @param userId, Designation User ID.
117      * @param requestCode, Ability request code.
118      * @return Returns ERR_OK on success, others on failure.
119      */
120     virtual int StartAbility(
121         const Want &want,
122         const sptr<IRemoteObject> &callerToken,
123         int32_t userId = DEFAULT_INVAL_VALUE,
124         int requestCode = DEFAULT_INVAL_VALUE) = 0;
125 
126     /**
127      * StartAbilityWithSpecifyTokenId with want and specialId, send want to ability manager service.
128      *
129      * @param want, the want of the ability to start.
130      * @param callerToken, caller ability token.
131      * @param specialId the caller Id.
132      * @param userId, Designation User ID.
133      * @param requestCode, Ability request code.
134      * @return Returns ERR_OK on success, others on failure.
135      */
136     virtual int StartAbilityWithSpecifyTokenId(
137         const Want &want,
138         const sptr<IRemoteObject> &callerToken,
139         uint32_t specifyTokenId,
140         int32_t userId = DEFAULT_INVAL_VALUE,
141         int requestCode = DEFAULT_INVAL_VALUE) = 0;
142 
143     /**
144      * StartAbility by insight intent, send want to ability manager service.
145      *
146      * @param want Ability want.
147      * @param callerToken caller ability token.
148      * @param intentId insight intent id.
149      * @param userId userId of target ability.
150      * @return Returns ERR_OK on success, others on failure.
151      */
152     virtual int32_t StartAbilityByInsightIntent(
153         const Want &want,
154         const sptr<IRemoteObject> &callerToken,
155         uint64_t intentId,
156         int32_t userId = DEFAULT_INVAL_VALUE) = 0;
157 
158     /**
159      * Starts a new ability with specific start settings.
160      *
161      * @param want Indicates the ability to start.
162      * @param requestCode the resultCode of the ability to start.
163      * @param abilityStartSetting Indicates the setting ability used to start.
164      * @param userId, Designation User ID.
165      * @return Returns ERR_OK on success, others on failure.
166      */
167     virtual int StartAbility(
168         const Want &want,
169         const AbilityStartSetting &abilityStartSetting,
170         const sptr<IRemoteObject> &callerToken,
171         int32_t userId = DEFAULT_INVAL_VALUE,
172         int requestCode = DEFAULT_INVAL_VALUE) = 0;
173 
174     /**
175      * Starts a new ability with specific start options.
176      *
177      * @param want, the want of the ability to start.
178      * @param startOptions Indicates the options used to start.
179      * @param callerToken, caller ability token.
180      * @param userId, Designation User ID.
181      * @param requestCode the resultCode of the ability to start.
182      * @return Returns ERR_OK on success, others on failure.
183      */
184     virtual int StartAbility(
185         const Want &want,
186         const StartOptions &startOptions,
187         const sptr<IRemoteObject> &callerToken,
188         int32_t userId = DEFAULT_INVAL_VALUE,
189         int requestCode = DEFAULT_INVAL_VALUE) = 0;
190 
191     /**
192      * Starts a new ability using the original caller information.
193      *
194      * @param want the want of the ability to start.
195      * @param callerToken caller ability token.
196      * @param asCallerSourceToken source caller ability token.
197      * @param userId Designation User ID.
198      * @param requestCode the resultCode of the ability to start.
199      * @return Returns ERR_OK on success, others on failure.
200      */
201     virtual int StartAbilityAsCaller(
202         const Want &want,
203         const sptr<IRemoteObject> &callerToken,
204         sptr<IRemoteObject> asCallerSourceToken,
205         int32_t userId = DEFAULT_INVAL_VALUE,
206         int requestCode = DEFAULT_INVAL_VALUE)
207     {
208         return 0;
209     }
210 
211     /**
212      * Starts a new ability using the original caller information.
213      *
214      * @param want the want of the ability to start.
215      * @param startOptions Indicates the options used to start.
216      * @param callerToken caller ability token.
217      * @param asCallerSourceToken source caller ability token.
218      * @param userId Designation User ID.
219      * @param requestCode the resultCode of the ability to start.
220      * @return Returns ERR_OK on success, others on failure.
221      */
222     virtual int StartAbilityAsCaller(
223         const Want &want,
224         const StartOptions &startOptions,
225         const sptr<IRemoteObject> &callerToken,
226         sptr<IRemoteObject> asCallerSourceToken,
227         int32_t userId = DEFAULT_INVAL_VALUE,
228         int requestCode = DEFAULT_INVAL_VALUE)
229     {
230         return 0;
231     }
232 
233     /**
234      * Starts a new ability for result using the original caller information.
235      *
236      * @param want the want of the ability to start.
237      * @param callerToken current caller ability token.
238      * @param requestCode the resultCode of the ability to start.
239      * @param userId Designation User ID.
240      * @return Returns ERR_OK on success, others on failure.
241      */
242     virtual int StartAbilityForResultAsCaller(
243         const Want &want,
244         const sptr<IRemoteObject> &callerToken,
245         int requestCode = DEFAULT_INVAL_VALUE,
246         int32_t userId = DEFAULT_INVAL_VALUE)
247     {
248         return 0;
249     }
250 
251     /**
252      * Starts a new ability for result using the original caller information.
253      *
254      * @param want the want of the ability to start.
255      * @param startOptions Indicates the options used to start.
256      * @param callerToken current caller ability token.
257      * @param requestCode the resultCode of the ability to start.
258      * @param userId Designation User ID.
259      * @return Returns ERR_OK on success, others on failure.
260      */
261     virtual int StartAbilityForResultAsCaller(
262         const Want &want,
263         const StartOptions &startOptions,
264         const sptr<IRemoteObject> &callerToken,
265         int requestCode = DEFAULT_INVAL_VALUE,
266         int32_t userId = DEFAULT_INVAL_VALUE)
267     {
268         return 0;
269     }
270 
271     /**
272      * Start ui session ability with extension session info, send session info to ability manager service.
273      *
274      * @param want, the want of the ability to start.
275      * @param callerToken, caller ability token.
276      * @param sessionInfo the information of UIExtensionContentSession.
277      * @param userId, Designation User ID.
278      * @param requestCode, Ability request code.
279      * @return Returns ERR_OK on success, others on failure.
280      */
281     virtual int StartAbilityByUIContentSession(
282         const Want &want,
283         const sptr<IRemoteObject> &callerToken,
284         const sptr<SessionInfo> &sessionInfo,
285         int32_t userId = DEFAULT_INVAL_VALUE,
286         int requestCode = DEFAULT_INVAL_VALUE)
287     {
288         return 0;
289     }
290 
291 /**
292      * Start ui session ability with extension session info, send session info to ability manager service.
293      *
294      * @param want, the want of the ability to start.
295      * @param startOptions Indicates the options used to start.
296      * @param callerToken, caller ability token.
297      * @param sessionInfo the information of UIExtensionContentSession.
298      * @param userId, Designation User ID.
299      * @param requestCode the resultCode of the ability to start.
300      * @return Returns ERR_OK on success, others on failure.
301      */
302     virtual int StartAbilityByUIContentSession(
303         const Want &want,
304         const StartOptions &startOptions,
305         const sptr<IRemoteObject> &callerToken,
306         const sptr<SessionInfo> &sessionInfo,
307         int32_t userId = DEFAULT_INVAL_VALUE,
308         int requestCode = DEFAULT_INVAL_VALUE)
309     {
310         return 0;
311     }
312 
313     /**
314      * Start ui ability
315      *
316      * @param want the want of the ability to start.
317      * @param callerToken caller ability token.
318      * @param specifyTokenId The Caller ID.
319      * @return Returns ERR_OK on success, others on failure.
320      */
StartAbilityOnlyUIAbility(const Want & want,const sptr<IRemoteObject> & callerToken,uint32_t specifyTokenId)321     virtual int StartAbilityOnlyUIAbility(
322         const Want &want,
323         const sptr<IRemoteObject> &callerToken,
324         uint32_t specifyTokenId)
325     {
326         return 0;
327     }
328 
329     /**
330      * Start extension ability with want, send want to ability manager service.
331      *
332      * @param want, the want of the ability to start.
333      * @param callerToken, caller ability token.
334      * @param userId, Designation User ID.
335      * @param extensionType If an ExtensionAbilityType is set, only extension of that type can be started.
336      * @return Returns ERR_OK on success, others on failure.
337      */
338     virtual int StartExtensionAbility(
339         const Want &want,
340         const sptr<IRemoteObject> &callerToken,
341         int32_t userId = DEFAULT_INVAL_VALUE,
342         AppExecFwk::ExtensionAbilityType extensionType = AppExecFwk::ExtensionAbilityType::UNSPECIFIED)
343     {
344         return 0;
345     }
346 
347   /**
348      * Create UIExtension with want, send want to ability manager service.
349      *
350      * @param want, the want of the ability to start.
351      * @return Returns ERR_OK on success, others on failure.
352      */
RequestModalUIExtension(const Want & want)353     virtual int RequestModalUIExtension(const Want &want)
354     {
355         return 0;
356     }
357 
358     /**
359      * Preload UIExtension with want, send want to ability manager service.
360      *
361      * @param want, the want of the ability to start.
362      * @param hostBundleName, the caller application bundle name.
363      * @param userId, the extension runs in.
364      * @return Returns ERR_OK on success, others on failure.
365      */
366     virtual int PreloadUIExtensionAbility(const Want &want, std::string &hostBundleName,
367         int32_t userId = DEFAULT_INVAL_VALUE)
368     {
369         return 0;
370     }
371 
ChangeAbilityVisibility(sptr<IRemoteObject> token,bool isShow)372     virtual int ChangeAbilityVisibility(sptr<IRemoteObject> token, bool isShow)
373     {
374         return 0;
375     }
376 
ChangeUIAbilityVisibilityBySCB(sptr<SessionInfo> sessionInfo,bool isShow)377         virtual int ChangeUIAbilityVisibilityBySCB(sptr<SessionInfo> sessionInfo, bool isShow)
378     {
379         return 0;
380     }
381 
382     /**
383      * Start ui extension ability with extension session info, send extension session info to ability manager service.
384      *
385      * @param extensionSessionInfo the extension session info of the ability to start.
386      * @param userId, Designation User ID.
387      * @return Returns ERR_OK on success, others on failure.
388      */
389     virtual int StartUIExtensionAbility(
390         const sptr<SessionInfo> &extensionSessionInfo,
391         int32_t userId = DEFAULT_INVAL_VALUE)
392     {
393         return 0;
394     }
395 
396     /**
397      * Start ui ability with want, send want to ability manager service.
398      *
399      * @param sessionInfo the session info of the ability to start.
400      * @param isColdStart the session info of the ability is or not cold start.
401      * @return Returns ERR_OK on success, others on failure.
402      */
403     virtual int StartUIAbilityBySCB(sptr<SessionInfo> sessionInfo, bool &isColdStart, uint32_t sceneFlag = 0)
404     {
405         return 0;
406     }
407 
408     /**
409      * Stop extension ability with want, send want to ability manager service.
410      *
411      * @param want, the want of the ability to stop.
412      * @param callerToken, caller ability token.
413      * @param userId, Designation User ID.
414      * @param extensionType If an ExtensionAbilityType is set, only extension of that type can be stopped.
415      * @return Returns ERR_OK on success, others on failure.
416      */
417     virtual int StopExtensionAbility(
418         const Want& want,
419         const sptr<IRemoteObject>& callerToken,
420         int32_t userId = DEFAULT_INVAL_VALUE,
421         AppExecFwk::ExtensionAbilityType extensionType = AppExecFwk::ExtensionAbilityType::UNSPECIFIED)
422     {
423         return 0;
424     }
425 
GetAppMemorySize()426     virtual int GetAppMemorySize()
427     {
428         return 0;
429     }
430 
IsRamConstrainedDevice()431     virtual bool IsRamConstrainedDevice()
432     {
433         return false;
434     }
435 
436     virtual AppExecFwk::ElementName GetTopAbility(bool isNeedLocalDeviceId = true)
437     {
438         return {};
439     }
440 
441     virtual AppExecFwk::ElementName GetElementNameByToken(sptr<IRemoteObject> token,
442         bool isNeedLocalDeviceId = true)
443     {
444         return {};
445     }
446 
447     /**
448      * TerminateAbility, terminate the special ability.
449      *
450      * @param token, the token of the ability to terminate.
451      * @param resultCode, the resultCode of the ability to terminate.
452      * @param resultWant, the Want of the ability to return.
453      * @return Returns ERR_OK on success, others on failure.
454      */
455     virtual int TerminateAbility(
456         const sptr<IRemoteObject> &token, int resultCode, const Want *resultWant = nullptr) = 0;
457 
458     /**
459      * BackToCallerAbilityWithResult, return to the caller ability.
460      *
461      * @param token, the token of the ability to terminate.
462      * @param resultCode, the resultCode of the ability to terminate.
463      * @param resultWant, the Want of the ability to return.
464      * @param callerRequestCode, the requestCode of caller ability.·
465      * @return Returns ERR_OK on success, others on failure.
466      */
BackToCallerAbilityWithResult(const sptr<IRemoteObject> & token,int resultCode,const Want * resultWant,int64_t callerRequestCode)467     virtual int BackToCallerAbilityWithResult(const sptr<IRemoteObject> &token, int resultCode,
468         const Want *resultWant, int64_t callerRequestCode)
469     {
470         return 0;
471     };
472 
473     /**
474      * TerminateUIExtensionAbility, terminate the special ui extension ability.
475      *
476      * @param extensionSessionInfo the extension session info of the ability to terminate.
477      * @param resultCode, the resultCode of the ui extension ability to terminate.
478      * @param resultWant, the Want of the ui extension ability to return.
479      * @return Returns ERR_OK on success, others on failure.
480      */
481     virtual int TerminateUIExtensionAbility(const sptr<SessionInfo> &extensionSessionInfo,
482         int resultCode, const Want *resultWant = nullptr)
483     {
484         return 0;
485     }
486 
487     /**
488      *  CloseUIAbilityBySCB, close the special ability by scb.
489      *
490      * @param sessionInfo the session info of the ability to terminate.
491      * @return Returns ERR_OK on success, others on failure.
492      */
CloseUIAbilityBySCB(const sptr<SessionInfo> & sessionInfo)493     virtual int CloseUIAbilityBySCB(const sptr<SessionInfo> &sessionInfo)
494     {
495         return 0;
496     }
497 
498     /**
499      * SendResultToAbility, send the result to ability.
500      *
501      * @param requestCode, the requestCode of the ability to terminate.
502      * @param resultCode, the resultCode of the ability to terminate.
503      * @param resultWant, the Want of the ability to return.
504      * @return Returns ERR_OK on success, others on failure.
505      */
SendResultToAbility(int requestCode,int resultCode,Want & resultWant)506     virtual int SendResultToAbility(int requestCode, int resultCode, Want &resultWant)
507     {
508         return 0;
509     }
510 
511     /**
512      * MoveAbilityToBackground.
513      *
514      * @param token, the token of the ability to move.
515      * @return Returns ERR_OK on success, others on failure.
516      */
MoveAbilityToBackground(const sptr<IRemoteObject> & token)517     virtual int MoveAbilityToBackground(const sptr<IRemoteObject> &token)
518     {
519         return 0;
520     };
521 
522     /**
523      * Move the UIAbility to background, called by app self.
524      *
525      * @param token the token of the ability to move.
526      * @return Returns ERR_OK on success, others on failure.
527      */
MoveUIAbilityToBackground(const sptr<IRemoteObject> token)528     virtual int32_t MoveUIAbilityToBackground(const sptr<IRemoteObject> token)
529     {
530         return 0;
531     };
532 
533     /**
534      * CloseAbility, close the special ability.
535      *
536      * @param token, the token of the ability to terminate.
537      * @param resultCode, the resultCode of the ability to terminate.
538      * @param resultWant, the Want of the ability to return.
539      * @return Returns ERR_OK on success, others on failure.
540      */
541     virtual int CloseAbility(const sptr<IRemoteObject> &token, int resultCode = DEFAULT_INVAL_VALUE,
542         const Want *resultWant = nullptr) = 0;
543 
544     /**
545      * MinimizeAbility, minimize the special ability.
546      *
547      * @param token, the token of the ability to minimize.
548      * @param fromUser mark the minimize operation source.
549      * @return Returns ERR_OK on success, others on failure.
550      */
551     virtual int MinimizeAbility(const sptr<IRemoteObject> &token, bool fromUser = false) = 0;
552 
553     /**
554      * MinimizeUIExtensionAbility, minimize the special ui extension ability.
555      *
556      * @param extensionSessionInfo the extension session info of the ability to minimize.
557      * @param fromUser mark the minimize operation source.
558      * @return Returns ERR_OK on success, others on failure.
559      */
560     virtual int MinimizeUIExtensionAbility(const sptr<SessionInfo> &extensionSessionInfo,
561         bool fromUser = false)
562     {
563         return 0;
564     };
565 
566     /**
567      * MinimizeUIAbilityBySCB, minimize the special ui ability by scb.
568      *
569      * @param sessionInfo the session info of the ability to minimize.
570      * @param fromUser, Whether form user.
571      * @return Returns ERR_OK on success, others on failure.
572      */
573     virtual int MinimizeUIAbilityBySCB(const sptr<SessionInfo> &sessionInfo, bool fromUser = false,
574         uint32_t sceneFlag = 0)
575     {
576         return 0;
577     };
578 
579     /**
580      * ConnectAbility, connect session with service ability.
581      *
582      * @param want, Special want for service type's ability.
583      * @param connect, Callback used to notify caller the result of connecting or disconnecting.
584      * @param callerToken, caller ability token.
585      * @param userId, Designation User ID.
586      * @return Returns ERR_OK on success, others on failure.
587      */
588     virtual int ConnectAbility(
589         const Want &want,
590         const sptr<IAbilityConnection> &connect,
591         const sptr<IRemoteObject> &callerToken,
592         int32_t userId = DEFAULT_INVAL_VALUE) = 0;
593 
594     /**
595      * Connect ability common method.
596      *
597      * @param want, special want for service type's ability.
598      * @param connect, callback used to notify caller the result of connecting or disconnecting.
599      * @param callerToken, caller ability token.
600      * @param extensionType, type of the extension.
601      * @param userId, the service user ID.
602      * @return Returns ERR_OK on success, others on failure.
603      */
604     virtual int ConnectAbilityCommon(
605         const Want &want,
606         const sptr<IAbilityConnection> &connect,
607         const sptr<IRemoteObject> &callerToken,
608         AppExecFwk::ExtensionAbilityType extensionType,
609         int32_t userId = DEFAULT_INVAL_VALUE,
610         bool isQueryExtensionOnly = false)
611     {
612         return 0;
613     }
614 
615     /**
616      * Connect ui extension ability.
617      *
618      * @param want, special want for the ui extension ability.
619      * @param connect, callback used to notify caller the result of connecting or disconnecting.
620      * @param sessionInfo the extension session info of the ability to connect.
621      * @param userId, the extension runs in.
622      * @param connectInfo the connect info.
623      * @return Returns ERR_OK on success, others on failure.
624      */
625     virtual int ConnectUIExtensionAbility(const Want &want, const sptr<IAbilityConnection> &connect,
626         const sptr<SessionInfo> &sessionInfo, int32_t userId = DEFAULT_INVAL_VALUE,
627         sptr<UIExtensionAbilityConnectInfo> connectInfo = nullptr)
628     {
629         return 0;
630     }
631 
632     /**
633      * DisconnectAbility, disconnect session with service ability.
634      *
635      * @param connect, Callback used to notify caller the result of connecting or disconnecting.
636      * @return Returns ERR_OK on success, others on failure.
637      */
638     virtual int DisconnectAbility(sptr<IAbilityConnection> connect) = 0;
639 
640     /**
641      * AcquireDataAbility, acquire a data ability by its authority, if it not existed,
642      * AMS loads it synchronously.
643      *
644      * @param authority, a string to identify a data ability, decoded from uri.
645      * @param tryBind, true: when a data ability is died, ams will kill this client, or do nothing.
646      * @param callerToken, specifies the caller ability token.
647      * @return returns the data ability ipc object, or nullptr for failed.
648      */
649     virtual sptr<IAbilityScheduler> AcquireDataAbility(
650         const Uri &uri, bool tryBind, const sptr<IRemoteObject> &callerToken) = 0;
651 
652     /**
653      * ReleaseDataAbility, release the data ability that referenced by 'dataAbilityToken'.
654      *
655      * @param dataAbilityScheduler, specifies the data ability that will be released.
656      * @param callerToken, specifies the caller ability token.
657      * @return returns ERR_OK if succeeded, or error codes for failed.
658      */
659     virtual int ReleaseDataAbility(
660         sptr<IAbilityScheduler> dataAbilityScheduler, const sptr<IRemoteObject> &callerToken) = 0;
661 
662     /**
663      * AttachAbilityThread, ability call this interface after loaded.
664      *
665      * @param scheduler,.the interface handler of kit ability.
666      * @param token,.ability's token.
667      * @return Returns ERR_OK on success, others on failure.
668      */
669     virtual int AttachAbilityThread(const sptr<IAbilityScheduler> &scheduler, const sptr<IRemoteObject> &token) = 0;
670 
671     /**
672      * AbilityTransitionDone, ability call this interface after life cycle was changed.
673      *
674      * @param token,.ability's token.
675      * @param state,.the state of ability life cycle.
676      * @return Returns ERR_OK on success, others on failure.
677      */
678     virtual int AbilityTransitionDone(const sptr<IRemoteObject> &token, int state, const PacMap &saveData) = 0;
679 
680     /**
681      * ScheduleConnectAbilityDone, service ability call this interface while session was connected.
682      *
683      * @param token,.service ability's token.
684      * @param remoteObject,.the session proxy of service ability.
685      * @return Returns ERR_OK on success, others on failure.
686      */
687     virtual int ScheduleConnectAbilityDone(
688         const sptr<IRemoteObject> &token, const sptr<IRemoteObject> &remoteObject) = 0;
689 
690     /**
691      * ScheduleDisconnectAbilityDone, service ability call this interface while session was disconnected.
692      *
693      * @param token,.service ability's token.
694      * @return Returns ERR_OK on success, others on failure.
695      */
696     virtual int ScheduleDisconnectAbilityDone(const sptr<IRemoteObject> &token) = 0;
697 
698     /**
699      * ScheduleCommandAbilityDone, service ability call this interface while session was commanded.
700      *
701      * @param token,.service ability's token.
702      * @return Returns ERR_OK on success, others on failure.
703      */
704     virtual int ScheduleCommandAbilityDone(const sptr<IRemoteObject> &token) = 0;
705 
706     virtual int ScheduleCommandAbilityWindowDone(
707         const sptr<IRemoteObject> &token,
708         const sptr<AAFwk::SessionInfo> &sessionInfo,
709         AAFwk::WindowCommand winCmd,
710         AAFwk::AbilityCommand abilityCmd) = 0;
711 
712     /**
713      * dump ability stack info, about userID, mission stack info,
714      * mission record info and ability info.
715      *
716      * @param state Ability stack info.
717      * @return Returns ERR_OK on success, others on failure.
718      */
719     virtual void DumpState(const std::string &args, std::vector<std::string> &state) = 0;
720     virtual void DumpSysState(
721         const std::string& args, std::vector<std::string>& state, bool isClient, bool isUserID, int UserID) = 0;
722 
723     /**
724      * Destroys this Service ability by Want.
725      *
726      * @param want, Special want for service type's ability.
727      * @param token ability's token.
728      * @return Returns true if this Service ability will be destroyed; returns false otherwise.
729      */
730     virtual int StopServiceAbility(const Want &want, int32_t userId = DEFAULT_INVAL_VALUE,
731         const sptr<IRemoteObject> &token = nullptr) = 0;
732 
733     /**
734      * Kill the process immediately.
735      *
736      * @param bundleName.
737      * @return Returns ERR_OK on success, others on failure.
738      */
739     virtual int KillProcess(const std::string &bundleName) = 0;
740 
741     #ifdef ABILITY_COMMAND_FOR_TEST
742     /**
743      * force timeout ability.
744      *
745      * @param abilityName.
746      * @param state.
747      * @return Returns ERR_OK on success, others on failure.
748      */
749     virtual int ForceTimeoutForTest(const std::string &abilityName, const std::string &state) = 0;
750     #endif
751 
752     /**
753      * Uninstall app
754      *
755      * @param bundleName bundle name of uninstalling app.
756      * @param uid uid of bundle.
757      * @return Returns ERR_OK on success, others on failure.
758      */
UninstallApp(const std::string & bundleName,int32_t uid)759     virtual int UninstallApp(const std::string &bundleName, int32_t uid)
760     {
761         return 0;
762     }
763 
764     /**
765      * Uninstall app
766      *
767      * @param bundleName bundle name of uninstalling app.
768      * @param uid uid of bundle.
769      * @param appIndex the app index of app clone.
770      * @return Returns ERR_OK on success, others on failure.
771      */
UninstallApp(const std::string & bundleName,int32_t uid,int32_t appIndex)772     virtual int32_t UninstallApp(const std::string &bundleName, int32_t uid, int32_t appIndex)
773     {
774         return 0;
775     }
776 
777     /**
778      * Upgrade app, record exit reason and kill application
779      *
780      * @param bundleName bundle name of upgrading app.
781      * @param uid uid of bundle.
782      * @param exitMsg the exit reason message.
783      * @param appIndex the app index of app clone.
784      * @return Returns ERR_OK on success, others on failure.
785      */
786     virtual int32_t UpgradeApp(const std::string &bundleName, const int32_t uid, const std::string &exitMsg,
787         int32_t appIndex = 0)
788     {
789         return 0;
790     }
791 
792     virtual sptr<IWantSender> GetWantSender(
793         const WantSenderInfo &wantSenderInfo, const sptr<IRemoteObject> &callerToken, int32_t uid = -1) = 0;
794 
795     virtual int SendWantSender(sptr<IWantSender> target, const SenderInfo &senderInfo) = 0;
796 
797     virtual void CancelWantSender(const sptr<IWantSender> &sender) = 0;
798 
799     virtual int GetPendingWantUid(const sptr<IWantSender> &target) = 0;
800 
801     virtual int GetPendingWantUserId(const sptr<IWantSender> &target) = 0;
802 
803     virtual std::string GetPendingWantBundleName(const sptr<IWantSender> &target) = 0;
804 
805     virtual int GetPendingWantCode(const sptr<IWantSender> &target) = 0;
806 
807     virtual int GetPendingWantType(const sptr<IWantSender> &target) = 0;
808 
809     virtual void RegisterCancelListener(const sptr<IWantSender> &sender, const sptr<IWantReceiver> &receiver) = 0;
810 
811     virtual void UnregisterCancelListener(const sptr<IWantSender> &sender, const sptr<IWantReceiver> &receiver) = 0;
812 
813     virtual int GetPendingRequestWant(const sptr<IWantSender> &target, std::shared_ptr<Want> &want) = 0;
814 
815     virtual int GetWantSenderInfo(const sptr<IWantSender> &target, std::shared_ptr<WantSenderInfo> &info) = 0;
816 
817     virtual int ContinueMission(const std::string &srcDeviceId, const std::string &dstDeviceId, int32_t missionId,
818         const sptr<IRemoteObject> &callBack, AAFwk::WantParams &wantParams) = 0;
819 
ContinueMission(AAFwk::ContinueMissionInfo continueMissionInfo,const sptr<IRemoteObject> & callback)820     virtual int ContinueMission(AAFwk::ContinueMissionInfo continueMissionInfo, const sptr<IRemoteObject> &callback)
821     {
822         return 0;
823     }
824 
825     virtual int ContinueAbility(const std::string &deviceId, int32_t missionId, uint32_t versionCode) = 0;
826 
827     virtual int StartContinuation(const Want &want, const sptr<IRemoteObject> &abilityToken, int32_t status) = 0;
828 
829     virtual void NotifyCompleteContinuation(const std::string &deviceId, int32_t sessionId, bool isSuccess) = 0;
830 
831     virtual int NotifyContinuationResult(int32_t missionId, int32_t result) = 0;
832 
833     virtual int LockMissionForCleanup(int32_t missionId) = 0;
834 
835     virtual int UnlockMissionForCleanup(int32_t missionId) = 0;
836 
SetLockedState(int32_t sessionId,bool lockedState)837     virtual void SetLockedState(int32_t sessionId, bool lockedState)
838     {
839         return;
840     }
841 
842     virtual int RegisterMissionListener(const sptr<IMissionListener> &listener) = 0;
843 
844     virtual int UnRegisterMissionListener(const sptr<IMissionListener> &listener) = 0;
845 
846     virtual int GetMissionInfos(
847         const std::string &deviceId, int32_t numMax, std::vector<MissionInfo> &missionInfos) = 0;
848 
849     virtual int GetMissionInfo(const std::string &deviceId, int32_t missionId, MissionInfo &missionInfo) = 0;
850 
851     virtual int GetMissionSnapshot(const std::string& deviceId, int32_t missionId,
852         MissionSnapshot& snapshot, bool isLowResolution) = 0;
853 
854     virtual int CleanMission(int32_t missionId) = 0;
855 
856     virtual int CleanAllMissions() = 0;
857 
858     virtual int MoveMissionToFront(int32_t missionId) = 0;
859 
860     virtual int MoveMissionToFront(int32_t missionId, const StartOptions &startOptions) = 0;
861 
MoveMissionsToForeground(const std::vector<int32_t> & missionIds,int32_t topMissionId)862     virtual int MoveMissionsToForeground(const std::vector<int32_t>& missionIds, int32_t topMissionId)
863     {
864         return 0;
865     }
866 
MoveMissionsToBackground(const std::vector<int32_t> & missionIds,std::vector<int32_t> & result)867     virtual int MoveMissionsToBackground(const std::vector<int32_t>& missionIds, std::vector<int32_t>& result)
868     {
869         return 0;
870     }
871 
RegisterSessionHandler(const sptr<IRemoteObject> & object)872     virtual int RegisterSessionHandler(const sptr<IRemoteObject> &object)
873     {
874         return 0;
875     }
876 
877     /**
878      * Start Ability, connect session with common ability.
879      *
880      * @param want, Special want for service type's ability.
881      * @param connect, Callback used to notify caller the result of connecting or disconnecting.
882      * @param accountId Indicates the account to start.
883      * @return Returns ERR_OK on success, others on failure.
884      */
885     virtual int StartAbilityByCall(const Want &want, const sptr<IAbilityConnection> &connect,
886         const sptr<IRemoteObject> &callerToken, int32_t accountId = DEFAULT_INVAL_VALUE) = 0;
887 
888     /**
889      * CallRequestDone, after invoke callRequest, ability will call this interface to return callee.
890      *
891      * @param token, ability's token.
892      * @param callStub, ability's callee.
893      */
CallRequestDone(const sptr<IRemoteObject> & token,const sptr<IRemoteObject> & callStub)894     virtual void CallRequestDone(const sptr<IRemoteObject> &token, const sptr<IRemoteObject> &callStub) {};
895 
896     /**
897      * Release the call between Ability, disconnect session with common ability.
898      *
899      * @param connect, Callback used to notify caller the result of connecting or disconnecting.
900      * @return Returns ERR_OK on success, others on failure.
901      */
902     virtual int ReleaseCall(const sptr<IAbilityConnection> &connect, const AppExecFwk::ElementName &element) = 0;
903 
904     virtual int StartUser(int userId, sptr<IUserCallback> callback) = 0;
905 
906     virtual int StopUser(int userId, const sptr<IUserCallback> &callback) = 0;
907 
LogoutUser(int32_t userId)908     virtual int LogoutUser(int32_t userId)
909     {
910         return 0;
911     }
912 
SetMissionContinueState(const sptr<IRemoteObject> & token,const AAFwk::ContinueState & state)913     virtual int SetMissionContinueState(const sptr<IRemoteObject> &token, const AAFwk::ContinueState &state)
914     {
915         return 0;
916     };
917 
918 #ifdef SUPPORT_GRAPHICS
919     virtual int SetMissionLabel(const sptr<IRemoteObject> &abilityToken, const std::string &label) = 0;
920 
921     virtual int SetMissionIcon(const sptr<IRemoteObject> &token,
922         const std::shared_ptr<OHOS::Media::PixelMap> &icon) = 0;
923 
924     /**
925      * Called to update mission snapshot.
926      * @param token The target ability.
927      * @param pixelMap The snapshot.
928      */
UpdateMissionSnapShot(const sptr<IRemoteObject> & token,const std::shared_ptr<OHOS::Media::PixelMap> & pixelMap)929     virtual void UpdateMissionSnapShot(const sptr<IRemoteObject> &token,
930         const std::shared_ptr<OHOS::Media::PixelMap> &pixelMap) {};
931 
932     /**
933      * Register the WindowManagerService handler
934      *
935      * @param handler Indidate handler of WindowManagerService.
936      * @return ErrCode Returns ERR_OK on success, others on failure.
937      */
RegisterWindowManagerServiceHandler(const sptr<IWindowManagerServiceHandler> & handler,bool animationEnabled)938     virtual int RegisterWindowManagerServiceHandler(const sptr<IWindowManagerServiceHandler>& handler,
939         bool animationEnabled)
940     {
941         return 0;
942     }
943 
944     /**
945      * WindowManager notification AbilityManager after the first frame is drawn.
946      *
947      * @param abilityToken Indidate token of ability.
948      */
949     virtual void CompleteFirstFrameDrawing(const sptr<IRemoteObject> &abilityToken) = 0;
950 
951     /**
952      * WindowManager notification AbilityManager after the first frame is drawn.
953      *
954      * @param sessionId Indidate session id.
955      */
CompleteFirstFrameDrawing(int32_t sessionId)956     virtual void CompleteFirstFrameDrawing(int32_t sessionId)
957     {}
958 
959     /**
960      * PrepareTerminateAbility, prepare terminate the special ability.
961      *
962      * @param token, the token of the ability to terminate.
963      * @param callback callback.
964      * @return Returns ERR_OK on success, others on failure.
965      */
PrepareTerminateAbility(const sptr<IRemoteObject> & token,sptr<IPrepareTerminateCallback> & callback)966     virtual int PrepareTerminateAbility(const sptr<IRemoteObject> &token, sptr<IPrepareTerminateCallback> &callback)
967     {
968         return 0;
969     }
970 
GetDialogSessionInfo(const std::string & dialogSessionId,sptr<DialogSessionInfo> & dialogSessionInfo)971     virtual int GetDialogSessionInfo(const std::string &dialogSessionId, sptr<DialogSessionInfo> &dialogSessionInfo)
972     {
973         return 0;
974     }
975 
SendDialogResult(const Want & want,const std::string & dialogSessionId,bool isAllow)976     virtual int SendDialogResult(const Want &want, const std::string &dialogSessionId, bool isAllow)
977     {
978         return 0;
979     }
980 
981     /**
982      * Register ability first frame state observer.
983      * @param observer Is ability first frame state observer.
984      * @param bundleName Is bundleName of the app to observe.
985      * @return Returns ERR_OK on success, others on failure.
986      */
RegisterAbilityFirstFrameStateObserver(const sptr<IAbilityFirstFrameStateObserver> & observer,const std::string & targetBundleName)987     virtual int32_t RegisterAbilityFirstFrameStateObserver(const sptr<IAbilityFirstFrameStateObserver> &observer,
988         const std::string &targetBundleName)
989     {
990         return 0;
991     }
992 
993     /**
994      * Unregister ability first frame state observer.
995      * @param observer Is ability first frame state observer.
996      * @return Returns ERR_OK on success, others on failure.
997      */
UnregisterAbilityFirstFrameStateObserver(const sptr<IAbilityFirstFrameStateObserver> & observer)998     virtual int32_t UnregisterAbilityFirstFrameStateObserver(const sptr<IAbilityFirstFrameStateObserver> &observer)
999     {
1000         return 0;
1001     }
1002 
1003 #endif
1004 
1005     virtual int GetAbilityRunningInfos(std::vector<AbilityRunningInfo> &info) = 0;
1006 
1007     virtual int GetExtensionRunningInfos(int upperLimit, std::vector<ExtensionRunningInfo> &info) = 0;
1008 
1009     virtual int GetProcessRunningInfos(std::vector<AppExecFwk::RunningProcessInfo> &info) = 0;
1010 
1011     /**
1012      * Start synchronizing remote device mission
1013      * @param devId, deviceId.
1014      * @param fixConflict, resolve synchronizing conflicts flag.
1015      * @param tag, call tag.
1016      * @return Returns ERR_OK on success, others on failure.
1017      */
1018     virtual int StartSyncRemoteMissions(const std::string &devId, bool fixConflict, int64_t tag) = 0;
1019 
1020     /**
1021      * Stop synchronizing remote device mission
1022      * @param devId, deviceId.
1023      * @return Returns ERR_OK on success, others on failure.
1024      */
1025     virtual int StopSyncRemoteMissions(const std::string &devId) = 0;
1026 
1027     virtual int RegisterMissionListener(const std::string &deviceId, const sptr<IRemoteMissionListener> &listener) = 0;
1028 
RegisterOnListener(const std::string & type,const sptr<IRemoteOnListener> & listener)1029     virtual int RegisterOnListener(const std::string &type, const sptr<IRemoteOnListener> &listener)
1030     {
1031         return 0;
1032     }
1033 
RegisterOffListener(const std::string & type,const sptr<IRemoteOnListener> & listener)1034     virtual int RegisterOffListener(const std::string &type, const sptr<IRemoteOnListener> &listener)
1035     {
1036         return 0;
1037     }
1038 
1039     virtual int UnRegisterMissionListener(const std::string &deviceId,
1040         const sptr<IRemoteMissionListener> &listener) = 0;
1041 
1042     /**
1043      * Set ability controller.
1044      *
1045      * @param abilityController, The ability controller.
1046      * @return Returns ERR_OK on success, others on failure.
1047      */
1048     virtual int SetAbilityController(const sptr<AppExecFwk::IAbilityController> &abilityController,
1049         bool imAStabilityTest) = 0;
1050 
1051     /**
1052      * Is user a stability test.
1053      *
1054      * @return Returns true if user is a stability test.
1055      */
1056     virtual bool IsRunningInStabilityTest() = 0;
1057 
1058     /**
1059      * @brief Register the snapshot handler
1060      * @param handler snapshot handler
1061      * @return int Returns ERR_OK on success, others on failure.
1062      */
1063     virtual int RegisterSnapshotHandler(const sptr<ISnapshotHandler>& handler) = 0;
1064 
1065     virtual int StartUserTest(const Want &want, const sptr<IRemoteObject> &observer) = 0;
1066 
1067     virtual int FinishUserTest(const std::string &msg, const int64_t &resultCode, const std::string &bundleName) = 0;
1068 
1069     /**
1070      * GetTopAbility, get the token of top ability.
1071      *
1072      * @param token, the token of top ability.
1073      * @return Returns ERR_OK on success, others on failure.
1074      */
1075     virtual int GetTopAbility(sptr<IRemoteObject> &token) = 0;
1076 
CheckUIExtensionIsFocused(uint32_t uiExtensionTokenId,bool & isFocused)1077     virtual int CheckUIExtensionIsFocused(uint32_t uiExtensionTokenId, bool& isFocused)
1078     {
1079         return 0;
1080     }
1081 
1082     /**
1083      * The delegator calls this interface to move the ability to the foreground.
1084      *
1085      * @param token, ability's token.
1086      * @return Returns ERR_OK on success, others on failure.
1087      */
1088     virtual int DelegatorDoAbilityForeground(const sptr<IRemoteObject> &token) = 0;
1089 
1090     /**
1091      * The delegator calls this interface to move the ability to the background.
1092      *
1093      * @param token, ability's token.
1094      * @return Returns ERR_OK on success, others on failure.
1095      */
1096     virtual int DelegatorDoAbilityBackground(const sptr<IRemoteObject> &token) = 0;
1097 
1098     /**
1099      * Calls this interface to move the ability to the foreground.
1100      *
1101      * @param token, ability's token.
1102      * @param flag, use for lock or unlock flag and so on.
1103      * @return Returns ERR_OK on success, others on failure.
1104      */
1105     virtual int DoAbilityForeground(const sptr<IRemoteObject> &token, uint32_t flag) = 0;
1106 
1107     /**
1108      * Calls this interface to move the ability to the background.
1109      *
1110      * @param token, ability's token.
1111      * @param flag, use for lock or unlock flag and so on.
1112      * @return Returns ERR_OK on success, others on failure.
1113      */
1114     virtual int DoAbilityBackground(const sptr<IRemoteObject> &token, uint32_t flag) = 0;
1115 
1116     /**
1117      * Get mission id by ability token.
1118      *
1119      * @param token The token of ability.
1120      * @return Returns -1 if do not find mission, otherwise return mission id.
1121      */
1122     virtual int32_t GetMissionIdByToken(const sptr<IRemoteObject> &token) = 0;
1123 
1124     /**
1125      * Get ability token by connect.
1126      *
1127      * @param token The token of ability.
1128      * @param callStub The callee object.
1129      */
1130     virtual void GetAbilityTokenByCalleeObj(const sptr<IRemoteObject> &callStub, sptr<IRemoteObject> &token) = 0;
1131 
1132     /**
1133      * Called when client complete dump.
1134      *
1135      * @param infos The dump info.
1136      * @return Returns ERR_OK on success, others on failure.
1137      */
DumpAbilityInfoDone(std::vector<std::string> & infos,const sptr<IRemoteObject> & callerToken)1138     virtual int DumpAbilityInfoDone(std::vector<std::string> &infos, const sptr<IRemoteObject> &callerToken)
1139     {
1140         return 0;
1141     }
1142 
1143     /**
1144      * Call free install from remote.
1145      *
1146      * @param want, the want of the ability to start.
1147      * @param callback, Callback from remote.
1148      * @param userId, Designation User ID.
1149      * @param requestCode Ability request code.
1150      * @return Returns ERR_OK on success, others on failure.
1151      */
1152     virtual int FreeInstallAbilityFromRemote(const Want &want, const sptr<IRemoteObject> &callback,
1153         int32_t userId, int requestCode = DEFAULT_INVAL_VALUE)
1154     {
1155         return 0;
1156     }
1157 
1158     /**
1159      * Add free install observer.
1160      *
1161      * @param callerToken, The caller ability token.
1162      * @param observer, The observer of the ability to free install start.
1163      * @return Returns ERR_OK on success, others on failure.
1164      */
AddFreeInstallObserver(const sptr<IRemoteObject> & callerToken,const sptr<AbilityRuntime::IFreeInstallObserver> & observer)1165     virtual int AddFreeInstallObserver(const sptr<IRemoteObject> &callerToken,
1166         const sptr<AbilityRuntime::IFreeInstallObserver> &observer)
1167     {
1168         return 0;
1169     }
1170 
EnableRecoverAbility(const sptr<IRemoteObject> & token)1171     virtual void EnableRecoverAbility(const sptr<IRemoteObject>& token) {};
1172     virtual void ScheduleRecoverAbility(const sptr<IRemoteObject> &token, int32_t reason,
1173         const Want *want = nullptr) {};
1174 
1175     /**
1176      * Called to verify that the MissionId is valid.
1177      * @param missionIds Query mission list.
1178      * @param results Output parameters, return results up to 20 query results.
1179      * @return Returns ERR_OK on success, others on failure.
1180      */
1181     virtual int32_t IsValidMissionIds(
1182         const std::vector<int32_t> &missionIds, std::vector<MissionValidResult> &results) = 0;
1183 
1184     /**
1185      * Query whether the application of the specified PID and UID has been granted a certain permission
1186      * @param permission
1187      * @param pid Process id
1188      * @param uid
1189      * @return Returns ERR_OK if the current process has the permission, others on failure.
1190      */
VerifyPermission(const std::string & permission,int pid,int uid)1191     virtual int VerifyPermission(const std::string &permission, int pid, int uid)
1192     {
1193         return 0;
1194     }
1195 
1196     /**
1197      * Request dialog service with want, send want to ability manager service.
1198      *
1199      * @param want, the want of the dialog service to start.
1200      * @param callerToken, caller ability token.
1201      * @return Returns ERR_OK on success, others on failure.
1202      */
RequestDialogService(const Want & want,const sptr<IRemoteObject> & callerToken)1203     virtual int32_t RequestDialogService(const Want &want, const sptr<IRemoteObject> &callerToken)
1204     {
1205         return 0;
1206     }
1207 
1208     /**
1209      * Report drawn completed.
1210      *
1211      * @return Returns ERR_OK on success, others on failure.
1212      */
1213     virtual int32_t ReportDrawnCompleted(const sptr<IRemoteObject> &callerToken) = 0;
1214 
1215     /**
1216      * Acquire the shared data.
1217      * @param missionId The missionId of Target ability.
1218      * @param shareData The IAcquireShareData object.
1219      * @return Returns ERR_OK on success, others on failure.
1220      */
AcquireShareData(const int32_t & missionId,const sptr<IAcquireShareDataCallback> & shareData)1221     virtual int32_t AcquireShareData(const int32_t &missionId, const sptr<IAcquireShareDataCallback> &shareData)
1222     {
1223         return 0;
1224     }
1225 
1226     /**
1227      * Notify sharing data finished.
1228      * @param token The token of ability.
1229      * @param resultCode The result of sharing data.
1230      * @param uniqueId The uniqueId from request object.
1231      * @param wantParam The params of acquiring sharing data from target ability.
1232      * @return Returns ERR_OK on success, others on failure.
1233      */
ShareDataDone(const sptr<IRemoteObject> & token,const int32_t & resultCode,const int32_t & uniqueId,WantParams & wantParam)1234     virtual int32_t ShareDataDone(const sptr<IRemoteObject>& token,
1235         const int32_t &resultCode, const int32_t &uniqueId, WantParams &wantParam)
1236     {
1237         return 0;
1238     }
1239 
1240     /**
1241      * Force app exit and record exit reason.
1242      * @param pid Process id .
1243      * @param exitReason The reason of app exit.
1244      * @return Returns ERR_OK on success, others on failure.
1245      */
ForceExitApp(const int32_t pid,const ExitReason & exitReason)1246     virtual int32_t ForceExitApp(const int32_t pid, const ExitReason &exitReason)
1247     {
1248         return 0;
1249     }
1250 
1251     /**
1252      * Record app exit reason.
1253      * @param exitReason The reason of app exit.
1254      * @return Returns ERR_OK on success, others on failure.
1255      */
RecordAppExitReason(const ExitReason & exitReason)1256     virtual int32_t RecordAppExitReason(const ExitReason &exitReason)
1257     {
1258         return 0;
1259     }
1260 
1261     /**
1262      * Record the process exit reason before the process being killed.
1263      * @param pid The process id.
1264      * @param exitReason The reason of process exit.
1265      * @return Returns ERR_OK on success, others on failure.
1266      */
RecordProcessExitReason(const int32_t pid,const ExitReason & exitReason)1267     virtual int32_t RecordProcessExitReason(const int32_t pid, const ExitReason &exitReason)
1268     {
1269         return 0;
1270     }
1271 
1272     /**
1273      * Set rootSceneSession by SCB.
1274      *
1275      * @param rootSceneSession Indicates root scene session of SCB.
1276      */
SetRootSceneSession(const sptr<IRemoteObject> & rootSceneSession)1277     virtual void SetRootSceneSession(const sptr<IRemoteObject> &rootSceneSession) {}
1278 
1279     /**
1280      * Call UIAbility by SCB.
1281      *
1282      * @param sessionInfo the session info of the ability to be called.
1283      * @param isColdStart the session of the ability is or not cold start.
1284      */
CallUIAbilityBySCB(const sptr<SessionInfo> & sessionInfo,bool & isColdStart)1285     virtual void CallUIAbilityBySCB(const sptr<SessionInfo> &sessionInfo, bool &isColdStart) {}
1286 
1287     /**
1288      * Start specified ability by SCB.
1289      *
1290      * @param want Want information.
1291      */
StartSpecifiedAbilityBySCB(const Want & want)1292     virtual void StartSpecifiedAbilityBySCB(const Want &want) {};
1293 
1294     /**
1295      * Notify sandbox app the result of saving file.
1296      * @param want Result of saving file, which contains the file's uri if success.
1297      * @param resultCode Indicates the action's result.
1298      * @param requestCode Pass the requestCode to match request.
1299      * @return Returns ERR_OK on success, others on failure.
1300      */
NotifySaveAsResult(const Want & want,int resultCode,int requestCode)1301     virtual int32_t NotifySaveAsResult(const Want &want, int resultCode, int requestCode)
1302     {
1303         return 0;
1304     }
1305 
1306     /**
1307      * Set sessionManagerService
1308      * @param sessionManagerService the point of sessionManagerService.
1309      *
1310      * @return Returns ERR_OK on success, others on failure.
1311      */
SetSessionManagerService(const sptr<IRemoteObject> & sessionManagerService)1312     virtual int32_t SetSessionManagerService(const sptr<IRemoteObject> &sessionManagerService)
1313     {
1314         return 0;
1315     }
1316 
1317     /**
1318      * @brief Register collaborator.
1319      * @param type collaborator type.
1320      * @param impl collaborator.
1321      * @return 0 or else.
1322     */
RegisterIAbilityManagerCollaborator(int32_t type,const sptr<IAbilityManagerCollaborator> & impl)1323     virtual int32_t RegisterIAbilityManagerCollaborator(int32_t type, const sptr<IAbilityManagerCollaborator> &impl)
1324     {
1325         return 0;
1326     }
1327 
1328     /**
1329      * @brief Unregister collaborator.
1330      * @param type collaborator type.
1331      * @return 0 or else.
1332     */
UnregisterIAbilityManagerCollaborator(int32_t type)1333     virtual int32_t UnregisterIAbilityManagerCollaborator(int32_t type)
1334     {
1335         return 0;
1336     }
1337 
RegisterStatusBarDelegate(sptr<AbilityRuntime::IStatusBarDelegate> delegate)1338     virtual int32_t RegisterStatusBarDelegate(sptr<AbilityRuntime::IStatusBarDelegate> delegate)
1339     {
1340         return 0;
1341     }
1342 
KillProcessWithPrepareTerminate(const std::vector<int32_t> & pids)1343     virtual int32_t KillProcessWithPrepareTerminate(const std::vector<int32_t>& pids)
1344     {
1345         return 0;
1346     }
1347 
1348     /**
1349      * @brief Register auto start up callback for system api.
1350      * @param callback The point of JsAbilityAutoStartupCallBack.
1351      * @return Returns ERR_OK on success, others on failure.
1352      */
RegisterAutoStartupSystemCallback(const sptr<IRemoteObject> & callback)1353     virtual int32_t RegisterAutoStartupSystemCallback(const sptr<IRemoteObject> &callback)
1354     {
1355         return 0;
1356     }
1357 
1358     /**
1359      * @brief Unregister auto start up callback for system api.
1360      * @param callback The point of JsAbilityAutoStartupCallBack.
1361      * @return Returns ERR_OK on success, others on failure.
1362      */
UnregisterAutoStartupSystemCallback(const sptr<IRemoteObject> & callback)1363     virtual int32_t UnregisterAutoStartupSystemCallback(const sptr<IRemoteObject> &callback)
1364     {
1365         return 0;
1366     }
1367 
1368     /**
1369      * @brief Set every application auto start up state.
1370      * @param info The auto startup info,include bundle name, module name, ability name.
1371      * @return Returns ERR_OK on success, others on failure.
1372      */
SetApplicationAutoStartup(const AutoStartupInfo & info)1373     virtual int32_t SetApplicationAutoStartup(const AutoStartupInfo &info)
1374     {
1375         return 0;
1376     }
1377 
1378     /**
1379      * @brief Cancel every application auto start up .
1380      * @param info The auto startup info,include bundle name, module name, ability name.
1381      * @return Returns ERR_OK on success, others on failure.
1382      */
CancelApplicationAutoStartup(const AutoStartupInfo & info)1383     virtual int32_t CancelApplicationAutoStartup(const AutoStartupInfo &info)
1384     {
1385         return 0;
1386     }
1387 
1388     /**
1389      * @brief Query auto startup state all application.
1390      * @param infoList Output parameters, return auto startup info list.
1391      * @return Returns ERR_OK on success, others on failure.
1392      */
QueryAllAutoStartupApplications(std::vector<AutoStartupInfo> & infoList)1393     virtual int32_t QueryAllAutoStartupApplications(std::vector<AutoStartupInfo> &infoList)
1394     {
1395         return 0;
1396     }
1397 
1398     /**
1399      * PrepareTerminateAbilityBySCB, prepare to terminate ability by scb.
1400      *
1401      * @param sessionInfo the session info of the ability to start.
1402      * @param isPrepareTerminate the result of ability onPrepareToTerminate
1403      * @return Returns ERR_OK on success, others on failure.
1404      */
PrepareTerminateAbilityBySCB(const sptr<SessionInfo> & sessionInfo,bool & isPrepareTerminate)1405     virtual int PrepareTerminateAbilityBySCB(const sptr<SessionInfo> &sessionInfo, bool &isPrepareTerminate)
1406     {
1407         return 0;
1408     }
1409 
1410     /**
1411      * @brief Register app debug listener.
1412      * @param listener App debug listener.
1413      * @return Returns ERR_OK on success, others on failure.
1414      */
1415     virtual int32_t RegisterAppDebugListener(sptr<AppExecFwk::IAppDebugListener> listener) = 0;
1416 
1417     /**
1418      * @brief Unregister app debug listener.
1419      * @param listener App debug listener.
1420      * @return Returns ERR_OK on success, others on failure.
1421      */
1422     virtual int32_t UnregisterAppDebugListener(sptr<AppExecFwk::IAppDebugListener> listener) = 0;
1423 
1424     /**
1425      * @brief Attach app debug.
1426      * @param bundleName The application bundle name.
1427      * @return Returns ERR_OK on success, others on failure.
1428      */
1429     virtual int32_t AttachAppDebug(const std::string &bundleName) = 0;
1430 
1431     /**
1432      * @brief Detach app debug.
1433      * @param bundleName The application bundle name.
1434      * @return Returns ERR_OK on success, others on failure.
1435      */
1436     virtual int32_t DetachAppDebug(const std::string &bundleName) = 0;
1437 
1438     /**
1439      * @brief Execute intent.
1440      * @param key The key of intent executing client.
1441      * @param callerToken Caller ability token.
1442      * @param param The Intent execute param.
1443      * @return Returns ERR_OK on success, others on failure.
1444      */
1445     virtual int32_t ExecuteIntent(uint64_t key, const sptr<IRemoteObject> &callerToken,
1446         const InsightIntentExecuteParam &param) = 0;
1447 
1448     /**
1449      * @brief Check if ability controller can start.
1450      * @param want The want of ability to start.
1451      * @return Return true to allow ability to start, or false to reject.
1452      */
IsAbilityControllerStart(const Want & want)1453     virtual bool IsAbilityControllerStart(const Want &want)
1454     {
1455         return true;
1456     }
1457 
1458     /**
1459      * @brief Called when insight intent execute finished.
1460      *
1461      * @param token ability's token.
1462      * @param intentId insight intent id.
1463      * @param result insight intent execute result.
1464      * @return Returns ERR_OK on success, others on failure.
1465      */
1466     virtual int32_t ExecuteInsightIntentDone(const sptr<IRemoteObject> &token, uint64_t intentId,
1467         const InsightIntentExecuteResult &result) = 0;
1468 
1469     /**
1470      * @brief Set application auto start up state by EDM.
1471      * @param info The auto startup info, include bundle name, module name, ability name.
1472      * @param flag Indicate whether to allow the application to change the auto start up state.
1473      * @return Returns ERR_OK on success, others on failure.
1474      */
1475     virtual int32_t SetApplicationAutoStartupByEDM(const AutoStartupInfo &info, bool flag) = 0;
1476 
1477     /**
1478      * @brief Cancel application auto start up state by EDM.
1479      * @param info The auto startup info, include bundle name, module name, ability name.
1480      * @param flag Indicate whether to allow the application to change the auto start up state.
1481      * @return Returns ERR_OK on success, others on failure.
1482      */
1483     virtual int32_t CancelApplicationAutoStartupByEDM(const AutoStartupInfo &info, bool flag) = 0;
1484 
1485     /**
1486      * @brief Get foreground ui abilities.
1487      * @param list Foreground ui abilities.
1488      * @return Returns ERR_OK on success, others on failure.
1489      */
1490     virtual int32_t GetForegroundUIAbilities(std::vector<AppExecFwk::AbilityStateData> &list) = 0;
1491 
1492     /**
1493      * @brief Open file by uri.
1494      * @param uri The file uri.
1495      * @param flag Want::FLAG_AUTH_READ_URI_PERMISSION or Want::FLAG_AUTH_WRITE_URI_PERMISSION.
1496      * @return int The file descriptor.
1497      */
OpenFile(const Uri & uri,uint32_t flag)1498     virtual int32_t OpenFile(const Uri& uri, uint32_t flag)
1499     {
1500         return 0;
1501     }
1502 
1503     /**
1504      * @brief Update session info.
1505      * @param sessionInfos The vector of session info.
1506      */
UpdateSessionInfoBySCB(std::list<SessionInfo> & sessionInfos,int32_t userId,std::vector<int32_t> & sessionIds)1507     virtual int32_t UpdateSessionInfoBySCB(std::list<SessionInfo> &sessionInfos, int32_t userId,
1508         std::vector<int32_t> &sessionIds)
1509     {
1510         return 0;
1511     }
1512 
1513     /**
1514      * @brief Restart app self.
1515      * @param want The ability type must be UIAbility.
1516      * @param isAppRecovery True indicates that the app is restarted because of recovery.
1517      * @return Returns ERR_OK on success, others on failure.
1518      */
1519     virtual int32_t RestartApp(const AAFwk::Want &want, bool isAppRecovery = false)
1520     {
1521         return 0;
1522     }
1523 
1524     /**
1525      * @brief Get host info of root caller.
1526      *
1527      * @param token The ability token.
1528      * @param hostInfo The host info of root caller.
1529      * @param userId The user id.
1530      * @return int32_t Returns 0 on success, others on failure.
1531      */
1532     virtual int32_t GetUIExtensionRootHostInfo(const sptr<IRemoteObject> token, UIExtensionHostInfo &hostInfo,
1533         int32_t userId = DEFAULT_INVAL_VALUE)
1534     {
1535         return 0;
1536     }
1537 
1538     /**
1539      * @brief Get ui extension session info
1540      *
1541      * @param token The ability token.
1542      * @param uiExtensionSessionInfo The ui extension session info.
1543      * @param userId The user id.
1544      * @return int32_t Returns ERR_OK on success, others on failure.
1545      */
1546     virtual int32_t GetUIExtensionSessionInfo(const sptr<IRemoteObject> token,
1547         UIExtensionSessionInfo &uiExtensionSessionInfo, int32_t userId = DEFAULT_INVAL_VALUE)
1548     {
1549         return 0;
1550     }
1551 
1552     /**
1553      * Open link of ability and atomic service.
1554      *
1555      * @param want Ability want.
1556      * @param callerToken Caller ability token.
1557      * @param userId User ID.
1558      * @param requestCode Ability request code.
1559      * @return Returns ERR_OK on success, others on failure.
1560     */
1561     virtual int32_t OpenLink(const Want& want, sptr<IRemoteObject> callerToken,
1562         int32_t userId = DEFAULT_INVAL_VALUE, int requestCode = DEFAULT_INVAL_VALUE)
1563     {
1564         return 0;
1565     }
1566 
1567     /**
1568      * @brief Pop-up launch of full-screen atomic service.
1569      * @param want The want with parameters.
1570      * @param callerToken caller ability token.
1571      * @param requestCode Ability request code.
1572      * @param userId The User ID.
1573      * @return Returns ERR_OK on success, others on failure.
1574      */
1575     virtual int32_t OpenAtomicService(Want& want, const StartOptions &options, sptr<IRemoteObject> callerToken,
1576         int32_t requestCode = DEFAULT_INVAL_VALUE, int32_t userId = DEFAULT_INVAL_VALUE)
1577     {
1578         return 0;
1579     }
1580 
1581     /*
1582      * Set the enable status for starting and stopping resident processes.
1583      * The caller application can only set the resident status of the configured process.
1584      * @param bundleName The bundle name of the resident process.
1585      * @param enable Set resident process enable status.
1586      * @return Returns ERR_OK on success, others on failure.
1587      */
SetResidentProcessEnabled(const std::string & bundleName,bool enable)1588     virtual int32_t SetResidentProcessEnabled(const std::string &bundleName, bool enable)
1589     {
1590         return 0;
1591     }
1592 
1593     /**
1594      * @brief Querying whether to allow embedded startup of atomic service.
1595      *
1596      * @param token The caller UIAbility token.
1597      * @param appId The ID of the application to which this bundle belongs.
1598      * @return Returns true to allow ability to start, or false to reject.
1599      */
IsEmbeddedOpenAllowed(sptr<IRemoteObject> callerToken,const std::string & appId)1600     virtual bool IsEmbeddedOpenAllowed(sptr<IRemoteObject> callerToken, const std::string &appId)
1601     {
1602         return true;
1603     }
1604 
1605     /**
1606      * @brief Request to display assert fault dialog.
1607      * @param callback Listen for user operation callbacks.
1608      * @param wantParams Assert dialog box display information.
1609      * @return Returns ERR_OK on success, others on failure.
1610      */
RequestAssertFaultDialog(const sptr<IRemoteObject> & callback,const AAFwk::WantParams & wantParams)1611     virtual int32_t RequestAssertFaultDialog(const sptr<IRemoteObject> &callback, const AAFwk::WantParams &wantParams)
1612     {
1613         return -1;
1614     }
1615 
1616     /**
1617      * @brief Notify the operation status of the user.
1618      * @param assertFaultSessionId Indicates the request ID of AssertFault.
1619      * @param userStatus Operation status of the user.
1620      * @return Returns ERR_OK on success, others on failure.
1621      */
NotifyDebugAssertResult(uint64_t assertFaultSessionId,AAFwk::UserStatus userStatus)1622     virtual int32_t NotifyDebugAssertResult(uint64_t assertFaultSessionId, AAFwk::UserStatus userStatus)
1623     {
1624         return -1;
1625     }
1626 
1627     /**
1628      * Starts a new ability with specific start options.
1629      *
1630      * @param want, the want of the ability to start.
1631      * @param startOptions Indicates the options used to start.
1632      * @return Returns ERR_OK on success, others on failure.
1633      */
StartShortcut(const Want & want,const StartOptions & startOptions)1634     virtual int32_t StartShortcut(const Want &want, const StartOptions &startOptions)
1635     {
1636         return 0;
1637     }
1638 
1639     /**
1640      * Get ability state by persistent id.
1641      *
1642      * @param persistentId, the persistentId of the session.
1643      * @param state Indicates the ability state.
1644      * @return Returns ERR_OK on success, others on failure.
1645      */
GetAbilityStateByPersistentId(int32_t persistentId,bool & state)1646     virtual int32_t GetAbilityStateByPersistentId(int32_t persistentId, bool &state)
1647     {
1648         return 0;
1649     }
1650 
1651     /**
1652      * Transfer resultCode & want to ability manager service.
1653      *
1654      * @param resultCode, the resultCode of the ability to terminate.
1655      * @param resultWant, the Want of the ability to return.
1656      * @return Returns ERR_OK on success, others on failure.
1657      */
TransferAbilityResultForExtension(const sptr<IRemoteObject> & callerToken,int32_t resultCode,const Want & want)1658     virtual int32_t TransferAbilityResultForExtension(const sptr<IRemoteObject> &callerToken, int32_t resultCode,
1659         const Want &want)
1660     {
1661         return 0;
1662     }
1663 
1664     /**
1665      * Notify ability manager service frozen process.
1666      *
1667      * @param pidList, the pid list of the frozen process.
1668      * @param uid, the uid of the frozen process.
1669      */
NotifyFrozenProcessByRSS(const std::vector<int32_t> & pidList,int32_t uid)1670     virtual void NotifyFrozenProcessByRSS(const std::vector<int32_t> &pidList, int32_t uid)
1671     {
1672         return;
1673     }
1674 
1675     /**
1676      *  Request to clean UIAbility from user.
1677      *
1678      * @param sessionInfo the session info of the ability to clean.
1679      * @return Returns ERR_OK on success, others on failure.
1680      */
CleanUIAbilityBySCB(const sptr<SessionInfo> & sessionInfo)1681     virtual int32_t CleanUIAbilityBySCB(const sptr<SessionInfo> &sessionInfo)
1682     {
1683         return 0;
1684     }
1685 
1686     /**
1687      * Open atomic service window prior to finishing free install.
1688      *
1689      * @param bundleName, the bundle name of the atomic service.
1690      * @param moduleName, the module name of the atomic service.
1691      * @param abilityName, the ability name of the atomic service.
1692      * @param startTime, the starting time of the free install task.
1693      * @return Returns ERR_OK on success, others on failure.
1694      */
PreStartMission(const std::string & bundleName,const std::string & moduleName,const std::string & abilityName,const std::string & startTime)1695     virtual int32_t PreStartMission(const std::string& bundleName, const std::string& moduleName,
1696         const std::string& abilityName, const std::string& startTime)
1697     {
1698         return 0;
1699     }
1700 
1701     /**
1702      * Terminate the mission.
1703      *
1704      * @param missionId, The mission id of the UIAbility need to be terminated.
1705      * @return Returns ERR_OK on success, others on failure.
1706      */
TerminateMission(int32_t missionId)1707     virtual int32_t TerminateMission(int32_t missionId)
1708     {
1709         return 0;
1710     }
1711 
1712     /**
1713      * update associate config list by rss.
1714      *
1715      * @param configs The rss config info.
1716      * @param exportConfigs The rss export config info.
1717      * @param flag UPDATE_CONFIG_FLAG_COVER is cover config, UPDATE_CONFIG_FLAG_APPEND is append config.
1718      */
UpdateAssociateConfigList(const std::map<std::string,std::list<std::string>> & configs,const std::list<std::string> & exportConfigs,int32_t flag)1719     virtual int32_t UpdateAssociateConfigList(const std::map<std::string, std::list<std::string>>& configs,
1720         const std::list<std::string>& exportConfigs, int32_t flag)
1721     {
1722         return 0;
1723     }
1724 };
1725 }  // namespace AAFwk
1726 }  // namespace OHOS
1727 #endif  // OHOS_ABILITY_RUNTIME_ABILITY_MANAGER_INTERFACE_H
1728