• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021-2023 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef OHOS_ABILITY_RUNTIME_APP_MGR_SERVICE_INNER_H
17 #define OHOS_ABILITY_RUNTIME_APP_MGR_SERVICE_INNER_H
18 
19 #include <list>
20 #include <map>
21 #include <regex>
22 #include <unordered_map>
23 #include <unordered_set>
24 #include <vector>
25 
26 #include "ability_debug_response_interface.h"
27 #include "ability_foreground_state_observer_interface.h"
28 #include "ability_info.h"
29 #include "app_death_recipient.h"
30 #include "app_debug_listener_interface.h"
31 #include "app_debug_manager.h"
32 #include "app_foreground_state_observer_interface.h"
33 #include "app_malloc_info.h"
34 #include "app_mgr_constants.h"
35 #include "app_process_manager.h"
36 #include "app_record_id.h"
37 #include "app_running_manager.h"
38 #include "app_running_record.h"
39 #include "app_running_status_listener_interface.h"
40 #include "app_running_status_module.h"
41 #include "app_scheduler_interface.h"
42 #include "app_spawn_client.h"
43 #include "app_task_info.h"
44 #include "appexecfwk_errors.h"
45 #include "bundle_info.h"
46 #include "bundle_mgr_helper.h"
47 #include "child_process_info.h"
48 #include "cpp/mutex.h"
49 #include "event_report.h"
50 #include "fault_data.h"
51 #include "hisysevent.h"
52 #include "iapp_state_callback.h"
53 #include "iapplication_state_observer.h"
54 #include "iconfiguration_observer.h"
55 #include "iremote_object.h"
56 #include "istart_specified_ability_response.h"
57 #include "record_query_result.h"
58 #include "refbase.h"
59 #include "remote_client_manager.h"
60 #include "render_process_info.h"
61 #include "running_process_info.h"
62 #include "shared/base_shared_bundle_info.h"
63 #include "task_handler_wrap.h"
64 #include "want.h"
65 #include "window_focus_changed_listener.h"
66 #include "window_visibility_changed_listener.h"
67 
68 namespace OHOS {
69 namespace AppExecFwk {
70 using OHOS::AAFwk::Want;
71 class AppMgrServiceInner : public std::enable_shared_from_this<AppMgrServiceInner> {
72 public:
73     AppMgrServiceInner();
74     virtual ~AppMgrServiceInner();
75 
76     /**
77      * Initialize the object.
78      */
79     void Init();
80     /**
81      * LoadAbility, load the ability that needed to be started.
82      *
83      * @param token, the unique identification to start the ability.
84      * @param preToken, the unique identification to call the ability.
85      * @param abilityInfo, the ability information.
86      * @param appInfo, the app information.
87      * @param want the ability want.
88      *
89      * @return
90      */
91     virtual void LoadAbility(const sptr<IRemoteObject> &token, const sptr<IRemoteObject> &preToken,
92         const std::shared_ptr<AbilityInfo> &abilityInfo, const std::shared_ptr<ApplicationInfo> &appInfo,
93         const std::shared_ptr<AAFwk::Want> &want);
94 
95     /**
96      * TerminateAbility, terminate the token ability.
97      *
98      * @param token, he unique identification to terminate the ability.
99      * @param clearMissionFlag, indicates whether terminate the ability when clearMission.
100      * @return
101      */
102     virtual void TerminateAbility(const sptr<IRemoteObject> &token, bool clearMissionFlag);
103 
104     /**
105      * UpdateAbilityState, update the ability status.
106      *
107      * @param token, the unique identification to update the ability.
108      * @param state, ability status that needs to be updated.
109      *
110      * @return
111      */
112     virtual void UpdateAbilityState(const sptr<IRemoteObject> &token, const AbilityState state);
113 
114     /**
115      * UpdateExtensionState, call UpdateExtensionState() through the proxy object, update the extension status.
116      *
117      * @param token, the unique identification to update the extension.
118      * @param state, extension status that needs to be updated.
119      */
120     virtual void UpdateExtensionState(const sptr<IRemoteObject> &token, const ExtensionState state);
121 
122     /**
123      * StateChangedNotifyObserver, Call ability state change.
124      *
125      * @param ability, the ability info.
126      * @param state, the ability state.
127      *
128      * @return
129      */
130     void StateChangedNotifyObserver(
131         const AbilityStateData abilityStateData, bool isAbility, bool isFromWindowFocusChanged);
132 
133     /**
134      * RegisterAppStateCallback, register the callback.
135      *
136      * @param callback, Ams register the callback.
137      *
138      * @return
139      */
140     virtual void RegisterAppStateCallback(const sptr<IAppStateCallback> &callback);
141 
142     /**
143      * AbilityBehaviorAnalysis, ability behavior analysis assistant process optimization.
144      *
145      * @param token, the unique identification to start the ability.
146      * @param preToken, the unique identification to call the ability.
147      * @param visibility, the visibility information about windows info.
148      * @param perceptibility, the Perceptibility information about windows info.
149      * @param connectionState, the service ability connection state.
150      * @return
151      */
152     virtual void AbilityBehaviorAnalysis(const sptr<IRemoteObject> &token, const sptr<IRemoteObject> &preToken,
153         const int32_t visibility, const int32_t perceptibility, const int32_t connectionState);
154 
155     /**
156      * KillProcessByAbilityToken, kill the process by ability token.
157      *
158      * @param token, the unique identification to the ability.
159      * @return
160      */
161     virtual void KillProcessByAbilityToken(const sptr<IRemoteObject> &token);
162 
163     /**
164      * KillProcessesByUserId, kill the processes by userId.
165      *
166      * @param userId, the user id.
167      * @return
168      */
169     virtual void KillProcessesByUserId(int32_t userId);
170 
171     /**
172      * AttachApplication, get all the information needed to start the Application
173      * (data related to the Application ).
174      *
175      * @param appScheduler, information needed to start the Application.
176      *
177      * @return
178      */
179     virtual void AttachApplication(const pid_t pid, const sptr<IAppScheduler> &appScheduler);
180 
181     /**
182      * ApplicationForegrounded, set the application to Foreground State.
183      *
184      * @param recordId, a unique record that identifies this Application from others.
185      *
186      * @return
187      */
188     virtual void ApplicationForegrounded(const int32_t recordId);
189 
190     /**
191      * ApplicationBackgrounded, set the application to Backgrounded State.
192      *
193      * @param recordId, a unique record that identifies this Application from others.
194      *
195      * @return
196      */
197     virtual void ApplicationBackgrounded(const int32_t recordId);
198 
199     /**
200      * ApplicationTerminated, terminate the application.
201      *
202      * @param recordId, a unique record that identifies this Application from others.
203      *
204      * @return
205      */
206     virtual void ApplicationTerminated(const int32_t recordId);
207 
208     /**
209      * AbilityTerminated, terminate the ability.
210      *
211      * @param token, the unique identification to terminated the ability.
212      *
213      * @return
214      */
215     virtual void AbilityTerminated(const sptr<IRemoteObject> &token);
216 
217      /**
218      * UpdateApplicationInfoInstalled, update the application info after new module installed.
219      *
220      * @param bundleName, bundle name in Application record.
221      * @param  uid, uid.
222      * @return ERR_OK, return back success, others fail.
223      */
224     virtual int32_t UpdateApplicationInfoInstalled(const std::string &bundleName, const int uid);
225 
226     /**
227      * KillApplication, kill the application.
228      *
229      * @param  bundleName, bundle name in Application record.
230      *
231      * @return ERR_OK, return back success, others fail.
232      */
233     virtual int32_t KillApplication(const std::string &bundleName);
234 
235     /**
236      * KillApplicationByUid, call KillApplicationByUid() through proxy object, kill the application.
237      *
238      * @param  bundleName, bundle name in Application record.
239      * @param  uid, uid.
240      * @return ERR_OK, return back success, others fail.
241      */
242     virtual int32_t KillApplicationByUid(const std::string &bundleName, const int uid);
243 
244     virtual int32_t KillApplicationSelf();
245 
246     /**
247      * KillApplicationByUserId, kill the application by user ID.
248      *
249      * @param bundleName, bundle name in Application record.
250      * @param userId, user ID.
251      *
252      * @return ERR_OK, return back success, others fail.
253      */
254     virtual int32_t KillApplicationByUserId(const std::string &bundleName, const int userId);
255 
256     /**
257      * ClearUpApplicationData, clear the application data.
258      *
259      * @param bundleName, bundle name in Application record.
260      * @param callerUid, app uid in Application record.
261      * @param callerPid, app pid in Application record.
262      *
263      * @return ERR_OK, return back success, others fail.
264      */
265     virtual int32_t ClearUpApplicationData(const std::string &bundleName,
266         const int32_t callerUid, const pid_t callerPid,  const int32_t userId = -1);
267 
268     /**
269      * ClearUpApplicationDataBySelf, clear the application data.
270      *
271      * @param callerUid, app uid in Application record.
272      * @param callerPid, app pid in Application record.
273      * @param userId, user ID.
274      *
275      * @return ERR_OK, return back success, others fail.
276      */
277     virtual int32_t ClearUpApplicationDataBySelf(int32_t callerUid, pid_t callerPid,  int32_t userId = -1);
278 
279     /**
280      * GetAllRunningProcesses, Obtains information about application processes that are running on the device.
281      *
282      * @param info, app name in Application record.
283      *
284      * @return ERR_OK ,return back success,others fail.
285      */
286     virtual int32_t GetAllRunningProcesses(std::vector<RunningProcessInfo> &info);
287 
288     /**
289      * GetProcessRunningInfosByUserId, Obtains information about application processes that are running on the device.
290      *
291      * @param info, app name in Application record.
292      * @param userId, userId.
293      *
294      * @return ERR_OK ,return back success,others fail.
295      */
296     virtual int32_t GetProcessRunningInfosByUserId(std::vector<RunningProcessInfo> &info, int32_t userId);
297 
298     /**
299      * GetProcessRunningInformation, Obtains information about current application process
300      * which is running on the device.
301      * @param info, app name in Application record.
302      *
303      * @return ERR_OK ,return back success,others fail.
304      */
305     virtual int32_t GetProcessRunningInformation(RunningProcessInfo &info);
306 
307     /**
308      * GetAllRenderProcesses, Obtains information about render processes that are running on the device.
309      *
310      * @param info, render process record.
311      *
312      * @return ERR_OK, return back success, others fail.
313      */
314     virtual int32_t GetAllRenderProcesses(std::vector<RenderProcessInfo> &info);
315 
316     /**
317      * NotifyMemoryLevel, Notify applications background the current memory level.
318      *
319      * @param level, current memory level.
320      *
321      * @return ERR_OK ,return back success,others fail.
322      */
323     virtual int32_t NotifyMemoryLevel(int32_t level);
324 
325     /**
326      * DumpHeapMemory, get the application's memory info.
327      * Get the application's memory allocation info.
328      *
329      * @param pid, pid input.
330      * @param mallocInfo, dynamic storage information output.
331      *
332      * @return ERR_OK, return back success,others fail.
333      */
334     virtual int32_t DumpHeapMemory(const int32_t pid, OHOS::AppExecFwk::MallocInfo &mallocInfo);
335 
336     /**
337      * @brief Check whether the shared bundle is running.
338      *
339      * @param bundleName Shared bundle name.
340      * @param versionCode Shared bundle version code.
341      * @return Returns the shared bundle running result. The result is true if running, false otherwise.
342      */
343     virtual bool IsSharedBundleRunning(const std::string &bundleName, uint32_t versionCode);
344 
345     /**
346      * Check whether the bundle is running.
347      *
348      * @param bundleName Indicates the bundle name of the bundle.
349      * @param isRunning Obtain the running status of the application, the result is true if running, false otherwise.
350      * @return Return ERR_OK if success, others fail.
351      */
352     int32_t IsApplicationRunning(const std::string &bundleName, bool &isRunning);
353 
354     int32_t StartNativeProcessForDebugger(const AAFwk::Want &want) const;
355 
356     std::shared_ptr<AppRunningRecord> CreateAppRunningRecord(
357         const sptr<IRemoteObject> &token,
358         const sptr<IRemoteObject> &preToken,
359         const std::shared_ptr<ApplicationInfo> &appInfo,
360         const std::shared_ptr<AbilityInfo> &abilityInfo,
361         const std::string &processName,
362         const BundleInfo &bundleInfo,
363         const HapModuleInfo &hapModuleInfo,
364         const std::shared_ptr<AAFwk::Want> &want);
365 
366     /**
367      * OnStop, Application management service stopped.
368      *
369      * @return
370      */
371     void OnStop();
372 
373     /**
374      * OpenAppSpawnConnection, Open connection with appspawn.
375      *
376      * @return ERR_OK ,return back success,others fail.
377      */
378     virtual ErrCode OpenAppSpawnConnection();
379 
380     /**
381      * CloseAppSpawnConnection, Close connection with appspawn.
382      *
383      * @return
384      */
385     virtual void CloseAppSpawnConnection() const;
386 
387     /**
388      * QueryAppSpawnConnectionState, Query the connection status with appspawn.
389      *
390      * @return Returns the connection status with appspawn.
391      */
392     virtual SpawnConnectionState QueryAppSpawnConnectionState() const;
393 
394     /**
395      * SetAppSpawnClient, Setting the client to connect with appspawn.
396      *
397      * @param spawnClient, the client to connect with appspawn.
398      *
399      * @return
400      */
401     void SetAppSpawnClient(std::shared_ptr<AppSpawnClient> spawnClient);
402 
403     // Schedule launch application with specified |appRecord|
404 
405     /**
406      * LaunchApplication, Notify application to launch application.
407      *
408      * @param appRecord, the application record.
409      *
410      * @return
411      */
412     void LaunchApplication(const std::shared_ptr<AppRunningRecord> &appRecord);
413 
414     /**
415      * Notice of AddAbilityStageInfo()
416      *
417      * @param recordId, the application record.
418      */
419     virtual void AddAbilityStageDone(const int32_t recordId);
420 
421     /**
422      * GetAppRunningRecordByPid, Get process record by application pid.
423      *
424      * @param pid, the application pid.
425      *
426      * @return process record.
427      */
428     std::shared_ptr<AppRunningRecord> GetAppRunningRecordByPid(const pid_t pid) const;
429 
430     /**
431      * GetAppRunningRecordByAbilityToken, Get process record by ability token.
432      *
433      * @param abilityToken, the ability token.
434      *
435      * @return process record.
436      */
437     std::shared_ptr<AppRunningRecord> GetAppRunningRecordByAbilityToken(const sptr<IRemoteObject> &abilityToken) const;
438 
439     /**
440      * GetTerminatingAppRunningRecord, Get process record by ability token.
441      *
442      * @param abilityToken, the ability token.
443      *
444      * @return process record.
445      */
446     std::shared_ptr<AppRunningRecord> GetTerminatingAppRunningRecord(const sptr<IRemoteObject> &token) const;
447 
448     /**
449      * GetAppRunningRecordByAppRecordId, Get process record by application id.
450      *
451      * @param recordId, the application id.
452      *
453      * @return process record.
454      */
455     std::shared_ptr<AppRunningRecord> GetAppRunningRecordByAppRecordId(const int32_t recordId) const;
456 
457     /**
458      * OnAbilityStateChanged, Call ability state change.
459      *
460      * @param ability, the ability info.
461      * @param state, the ability state.
462      *
463      * @return
464      */
465     void OnAbilityStateChanged(const std::shared_ptr<AbilityRunningRecord> &ability, const AbilityState state);
466 
467     /**
468      * GetRecentAppList, Get a list of recent applications.
469      *
470      * @return a list of recent applications.
471      */
472     const std::list<const std::shared_ptr<AppTaskInfo>> &GetRecentAppList() const;
473 
474     /**
475      * GetRecentAppList, Remove the corresponding latest application list data by applying the name.
476      *
477      * @param appName, the application name.
478      * @param processName, the process name.
479      *
480      * @return
481      */
482     void RemoveAppFromRecentList(const std::string &appName, const std::string &processName);
483 
484     /**
485      * GetRecentAppList, Clear recent application list.
486      *
487      * @return
488      */
489     void ClearRecentAppList();
490 
491     /**
492      * OnRemoteDied, Equipment death notification.
493      *
494      * @param remote, Death client.
495      * @param isRenderProcess is render process died.
496      * @param isChildProcess is child process died.
497      * @return
498      */
499     void OnRemoteDied(const wptr<IRemoteObject> &remote, bool isRenderProcess = false, bool isChildProcess = false);
500 
501     void HandleTimeOut(const AAFwk::EventWrap &event);
502 
SetTaskHandler(std::shared_ptr<AAFwk::TaskHandlerWrap> taskHandler)503     void SetTaskHandler(std::shared_ptr<AAFwk::TaskHandlerWrap> taskHandler)
504     {
505         taskHandler_ = taskHandler;
506     }
507 
SetEventHandler(const std::shared_ptr<AMSEventHandler> & eventHandler)508     void SetEventHandler(const std::shared_ptr<AMSEventHandler> &eventHandler)
509     {
510         eventHandler_ = eventHandler;
511     }
512 
513     void HandleAbilityAttachTimeOut(const sptr<IRemoteObject> &token);
514 
515     void PrepareTerminate(const sptr<IRemoteObject> &token);
516 
517     void OnAppStateChanged(const std::shared_ptr<AppRunningRecord> &appRecord, const ApplicationState state,
518         bool needNotifyApp, bool isFromWindowFocusChanged);
519 
520     void OnAppStarted(const std::shared_ptr<AppRunningRecord> &appRecord);
521 
522     void OnAppStopped(const std::shared_ptr<AppRunningRecord> &appRecord);
523 
524     void GetRunningProcessInfoByToken(const sptr<IRemoteObject> &token, AppExecFwk::RunningProcessInfo &info);
525 
526     void GetRunningProcessInfoByPid(const pid_t pid, OHOS::AppExecFwk::RunningProcessInfo &info) const;
527 
528     /**
529      * Set AbilityForegroundingFlag of an app-record to true.
530      *
531      * @param pid, pid.
532      *
533      */
534     void SetAbilityForegroundingFlagToAppRecord(const pid_t pid) const;
535 
536      /**
537      * UpdateConfiguration, ANotify application update system environment changes.
538      *
539      * @param config, System environment change parameters.
540      * @return Returns ERR_OK on success, others on failure.
541      */
542     int32_t UpdateConfiguration(const Configuration &config);
543 
544     std::shared_ptr<AppExecFwk::Configuration> GetConfiguration();
545 
546     int32_t RegisterConfigurationObserver(const sptr<IConfigurationObserver>& observer);
547 
548     int32_t UnregisterConfigurationObserver(const sptr<IConfigurationObserver>& observer);
549 
550     /**
551      * Start empty process
552      */
553     void LoadResidentProcess(const std::vector<BundleInfo> &infos);
554 
555     void StartResidentProcess(const std::vector<BundleInfo> &infos,  int restartCount, bool isEmptyKeepAliveApp);
556 
557     bool CheckRemoteClient();
558 
559     /**
560      * Register application or process state observer.
561      * @param observer, ability token.
562      * @return Returns ERR_OK on success, others on failure.
563      */
564     int32_t RegisterApplicationStateObserver(const sptr<IApplicationStateObserver> &observer,
565         const std::vector<std::string> &bundleNameList = {});
566 
567     /**
568      * Unregister application or process state observer.
569      * @param observer, ability token.
570      * @return Returns ERR_OK on success, others on failure.
571      */
572     int32_t UnregisterApplicationStateObserver(const sptr<IApplicationStateObserver> &observer);
573 
574     /**
575      * Register application or process state observer.
576      * @param observer, Is ability foreground state observer
577      * @return Returns ERR_OK on success, others on failure.
578      */
579     int32_t RegisterAbilityForegroundStateObserver(const sptr<IAbilityForegroundStateObserver> &observer);
580 
581     /**
582      * Unregister application or process state observer.
583      * @param observer, Is ability foreground state observer
584      * @return Returns ERR_OK on success, others on failure.
585      */
586     int32_t UnregisterAbilityForegroundStateObserver(const sptr<IAbilityForegroundStateObserver> &observer);
587 
588     /**
589      * Get Foreground Applications.
590      *
591      * @return Foreground Applications.
592      */
593     int32_t GetForegroundApplications(std::vector<AppStateData> &list);
594 
595     /**
596      * Start user test process.
597      * @param want, want object.
598      * @param observer, test observer remote object.
599      * @param bundleInfo, bundle info.
600      * @param userId the user id.
601      * @return Returns ERR_OK on success, others on failure.
602      */
603     int StartUserTestProcess(const AAFwk::Want &want, const sptr<IRemoteObject> &observer,
604         const AppExecFwk::BundleInfo &bundleInfo, int32_t userId);
605 
606     /**
607      * @brief Finish user test.
608      * @param msg user test message.
609      * @param resultCode user test result Code.
610      * @param bundleName user test bundleName.
611      * @param pid the user test process id.
612      *
613      * @return Returns ERR_OK on success, others on failure.
614      */
615     int FinishUserTest(
616         const std::string &msg, const int64_t &resultCode, const std::string &bundleName, const pid_t &pid);
617 
618     void StartSpecifiedAbility(const AAFwk::Want &want, const AppExecFwk::AbilityInfo &abilityInfo);
619 
620     void StartSpecifiedProcess(const AAFwk::Want &want, const AppExecFwk::AbilityInfo &abilityInfo);
621 
622     void RegisterStartSpecifiedAbilityResponse(const sptr<IStartSpecifiedAbilityResponse> &response);
623 
624     void ScheduleAcceptWantDone(const int32_t recordId, const AAFwk::Want &want, const std::string &flag);
625 
626     void ScheduleNewProcessRequestDone(const int32_t recordId, const AAFwk::Want &want, const std::string &flag);
627 
628     /**
629      *  Get the token of ability records by process ID.
630      *
631      * @param pid The process id.
632      * @param tokens The token of ability records.
633      * @return Returns true on success, others on failure.
634      */
635     int GetAbilityRecordsByProcessID(const int pid, std::vector<sptr<IRemoteObject>> &tokens);
636 
637     virtual int32_t PreStartNWebSpawnProcess(const pid_t hostPid);
638 
639     virtual int32_t StartRenderProcess(const pid_t hostPid,
640                                        const std::string &renderParam,
641                                        int32_t ipcFd, int32_t sharedFd,
642                                        int32_t crashFd, pid_t &renderPid);
643 
644     virtual void AttachRenderProcess(const pid_t pid, const sptr<IRenderScheduler> &scheduler);
645 
646     virtual int GetRenderProcessTerminationStatus(pid_t renderPid, int &status);
647 
648     int VerifyProcessPermission(const sptr<IRemoteObject> &token) const;
649 
650     int VerifyAccountPermission(const std::string &permissionName, const int userId) const;
651 
652     int VerifyRequestPermission() const;
653 
654     void ClearAppRunningData(const std::shared_ptr<AppRunningRecord> &appRecord, bool containsApp);
655 
656     void TerminateApplication(const std::shared_ptr<AppRunningRecord> &appRecord);
657 
658     int GetApplicationInfoByProcessID(const int pid, AppExecFwk::ApplicationInfo &application, bool &debug);
659     /**
660      * Notify application status.
661      *
662      * @param bundleName Indicates the name of the bundle.
663      * @param eventData Indicates the event defined by CommonEventSupport
664      *
665      * @return
666      */
667     void NotifyAppStatus(const std::string &bundleName, const std::string &eventData);
668 
669     /**
670      * KillProcessByPid, Kill process by PID.
671      *
672      * @param pid_t, the app record pid.
673      *
674      * @return ERR_OK, return back success,others fail.
675      */
676     int32_t KillProcessByPid(const pid_t pid) const;
677 
678     bool GetAppRunningStateByBundleName(const std::string &bundleName);
679 
680     int32_t NotifyLoadRepairPatch(const std::string &bundleName, const sptr<IQuickFixCallback> &callback);
681 
682     int32_t NotifyHotReloadPage(const std::string &bundleName, const sptr<IQuickFixCallback> &callback);
683 
684     int32_t NotifyUnLoadRepairPatch(const std::string &bundleName, const sptr<IQuickFixCallback> &callback);
685 
686     void HandleFocused(const sptr<OHOS::Rosen::FocusChangeInfo> &focusChangeInfo);
687     void HandleUnfocused(const sptr<OHOS::Rosen::FocusChangeInfo> &focusChangeInfo);
688 
689     /**
690      * Handle window visibility changed.
691      */
692     void HandleWindowVisibilityChanged(
693             const std::vector<sptr<OHOS::Rosen::WindowVisibilityInfo>> &windowVisibilityInfos);
694 
695     /**
696      * Set the current userId, only used by abilityMgr.
697      *
698      * @param userId the user id.
699      *
700      * @return
701      */
702     void SetCurrentUserId(const int32_t userId);
703 
704 #ifdef BGTASKMGR_CONTINUOUS_TASK_ENABLE
705     int32_t SetContinuousTaskProcess(int32_t pid, bool isContinuousTask);
706 #endif
707 
708     /**
709      * Get bundleName by pid.
710      *
711      * @param pid process id.
712      * @param bundleName Output parameters, return bundleName.
713      * @param uid Output parameters, return userId.
714      * @return Returns ERR_OK on success, others on failure.
715      */
716     int32_t GetBundleNameByPid(const int32_t pid, std::string &bundleName, int32_t &uid);
717 
718     /**
719      * Notify Fault Data
720      *
721      * @param faultData the fault data.
722      * @return Returns ERR_OK on success, others on failure.
723      */
724     int32_t NotifyAppFault(const FaultData &faultData);
725 
726     /**
727      * Notify Fault Data By SA
728      *
729      * @param faultData the fault data notified by SA.
730      * @return Returns ERR_OK on success, others on failure.
731      */
732     int32_t NotifyAppFaultBySA(const AppFaultDataBySA &faultData);
733 
734     /**
735      * get memorySize by pid.
736      *
737      * @param pid process id.
738      * @param memorySize Output parameters, return memorySize in KB.
739      * @return Returns ERR_OK on success, others on failure.
740      */
741     virtual int32_t GetProcessMemoryByPid(const int32_t pid, int32_t &memorySize);
742 
743     /**
744      * get application processes information list by bundleName.
745      *
746      * @param bundleName Bundle name.
747      * @param userId user Id in Application record.
748      * @param info Output parameters, return running process info list.
749      * @return Returns ERR_OK on success, others on failure.
750      */
751     virtual int32_t GetRunningProcessInformation(
752         const std::string &bundleName, int32_t userId, std::vector<RunningProcessInfo> &info);
753 
754     /**
755      * init focusListener.
756      *
757      * @return
758      */
759     void InitFocusListener();
760 
761     /**
762      * free focusListener.
763      *
764      * @return
765      */
766     void FreeFocusListener();
767 
768     /**
769      * Init window visibility changed listener.
770      */
771     void InitWindowVisibilityChangedListener();
772 
773     /**
774      * Free window visibility changed listener.
775      */
776     void FreeWindowVisibilityChangedListener();
777 
778     /*
779      * @brief Notify NativeEngine GC of status change.
780      *
781      * @param state GC state
782      * @param pid pid
783      *
784      * @return Is the status change completed.
785      */
786     int32_t ChangeAppGcState(pid_t pid, int32_t state);
787 
788     /**
789      * @brief Register app debug listener.
790      * @param listener App debug listener.
791      * @return Returns ERR_OK on success, others on failure.
792      */
793     int32_t RegisterAppDebugListener(const sptr<IAppDebugListener> &listener);
794 
795     /**
796      * @brief Unregister app debug listener.
797      * @param listener App debug listener.
798      * @return Returns ERR_OK on success, others on failure.
799      */
800     int32_t UnregisterAppDebugListener(const sptr<IAppDebugListener> &listener);
801 
802     /**
803      * @brief Attach app debug.
804      * @param bundleName The application bundle name.
805      * @return Returns ERR_OK on success, others on failure.
806      */
807     int32_t AttachAppDebug(const std::string &bundleName);
808 
809     /**
810      * @brief Detach app debug.
811      * @param bundleName The application bundle name.
812      * @return Returns ERR_OK on success, others on failure.
813      */
814     int32_t DetachAppDebug(const std::string &bundleName);
815 
816     /**
817      * @brief Registering ability debug mode response.
818      * @param response Response for ability debug object.
819      * @return Returns ERR_OK on success, others on failure.
820      */
821     int32_t RegisterAbilityDebugResponse(const sptr<IAbilityDebugResponse> &response);
822 
823     /**
824      * @brief Determine whether it is an attachment debug application based on the bundle name.
825      * @param bundleName The application bundle name.
826      * @return Returns true if it is an attach debug application, otherwise it returns false.
827      */
828     bool IsAttachDebug(const std::string &bundleName);
829 
830     /**
831      * @brief Notify AbilityManagerService the page show.
832      * @param token Ability identify.
833      * @param pageStateData The data of ability's page state.
834      * @return Returns ERR_OK on success, others on failure.
835      */
836     virtual int32_t NotifyPageShow(const sptr<IRemoteObject> &token, const PageStateData &pageStateData);
837 
838     /**
839      * @brief Notify AbilityManagerService the page hide.
840      * @param token Ability identify.
841      * @param pageStateData The data of ability's page state.
842      * @return Returns ERR_OK on success, others on failure.
843      */
844     virtual int32_t NotifyPageHide(const sptr<IRemoteObject> &token, const PageStateData &pageStateData);
845 
846     /**
847      * Register appRunning status listener.
848      *
849      * @param listener Running status listener.
850      * @return Returns ERR_OK on success, others on failure.
851      */
852     int32_t RegisterAppRunningStatusListener(const sptr<IRemoteObject> &listener);
853 
854     /**
855      * Unregister appRunning status listener.
856      *
857      * @param listener Running status listener.
858      * @return Returns ERR_OK on success, others on failure.
859      */
860     int32_t UnregisterAppRunningStatusListener(const sptr<IRemoteObject> &listener);
861 
862     /**
863      * Register application foreground state observer.
864      * @param observer Is app foreground statue observer
865      * @return Returns ERR_OK on success, others on failure.
866      */
867     int32_t RegisterAppForegroundStateObserver(const sptr<IAppForegroundStateObserver> &observer);
868 
869     /**
870      * Unregister application foreground state observer.
871      * @param observer Is app foreground statue observer
872      * @return Returns ERR_OK on success, others on failure.
873      */
874     int32_t UnregisterAppForegroundStateObserver(const sptr<IAppForegroundStateObserver> &observer);
875 
876     /**
877      * Start child process, called by ChildProcessManager.
878      *
879      * @param hostPid Host process pid.
880      * @param srcEntry Child process source file entrance path to be started.
881      * @param childPid Created child process pid.
882      * @return Returns ERR_OK on success, others on failure.
883      */
884     virtual int32_t StartChildProcess(const pid_t hostPid, const std::string &srcEntry, pid_t &childPid);
885 
886     /**
887      * Get child process record for self.
888      *
889      * @return child process record.
890      */
891     virtual int32_t GetChildProcessInfoForSelf(ChildProcessInfo &info);
892 
893     /**
894      * Attach child process scheduler to app manager service.
895      *
896      * @param pid the child process pid to exit.
897      * @param childScheduler scheduler of child process.
898      */
899     virtual void AttachChildProcess(const pid_t pid, const sptr<IChildScheduler> &childScheduler);
900 
901     /**
902      * Exit child process safely by child process pid.
903      *
904      * @param pid child process pid.
905      */
906     virtual void ExitChildProcessSafelyByChildPid(const pid_t pid);
907 
908     /**
909      * Whether the current application process is the last surviving process.
910      * @param bundleName To query the bundle name of a process.
911      * @return Returns true is final application process, others return false.
912      */
913     bool IsFinalAppProcessByBundleName(const std::string &bundleName);
914 
915     /**
916      * To clear the process by ability token.
917      *
918      * @param token the unique identification to the ability.
919      */
920     void ClearProcessByToken(sptr<IRemoteObject> token);
921 
922 private:
923 
924     std::string FaultTypeToString(FaultDataType type);
925 
926     FaultData ConvertDataTypes(const AppFaultDataBySA &faultData);
927 
928     void StartEmptyResidentProcess(const BundleInfo &info, const std::string &processName, int restartCount,
929         bool isEmptyKeepAliveApp);
930 
931     void RestartResidentProcess(std::shared_ptr<AppRunningRecord> appRecord);
932 
933     bool CheckLoadAbilityConditions(const sptr<IRemoteObject> &token,
934         const std::shared_ptr<AbilityInfo> &abilityInfo, const std::shared_ptr<ApplicationInfo> &appInfo);
935 
936     bool GetBundleInfo(const std::string &bundleName, BundleInfo &bundleInfo);
937 
938     bool GenerateRenderUid(int32_t &renderUid);
939 
940     void MakeServiceExtProcessName(const std::shared_ptr<AbilityInfo> &abilityInfo,
941         const std::shared_ptr<ApplicationInfo> &appInfo, std::string &processName) const;
942 
943     void MakeProcessName(const std::shared_ptr<AbilityInfo> &abilityInfo,
944         const std::shared_ptr<ApplicationInfo> &appInfo,
945         const HapModuleInfo &hapModuleInfo, int32_t appIndex, std::string &processName) const;
946 
947     void MakeProcessName(const std::shared_ptr<ApplicationInfo> &appInfo, const HapModuleInfo &hapModuleInfo,
948         std::string &processName) const;
949 
950     bool CheckIsolationMode(const HapModuleInfo &hapModuleInfo) const;
951 
952     bool IsMainProcess(const std::shared_ptr<ApplicationInfo> &appInfo, const HapModuleInfo &hapModuleInfo) const;
953 
954     /**
955      * StartAbility, load the ability that needed to be started(Start on the basis of the original process).
956      *  Start on a new boot process
957      * @param token, the unique identification to start the ability.
958      * @param preToken, the unique identification to call the ability.
959      * @param abilityInfo, the ability information.
960      * @param appInfo, the app information.
961      *
962      * @return
963      */
964     void StartAbility(const sptr<IRemoteObject> &token, const sptr<IRemoteObject> &preToken,
965         const std::shared_ptr<AbilityInfo> &abilityInfo, const std::shared_ptr<AppRunningRecord> &appRecord,
966         const HapModuleInfo &hapModuleInfo, const std::shared_ptr<AAFwk::Want> &want);
967 
968     int32_t StartPerfProcess(const std::shared_ptr<AppRunningRecord> &appRecord, const std::string& perfCmd,
969         const std::string& debugCmd, bool isSandboxApp) const;
970 
971     void StartProcessVerifyPermission(const BundleInfo &bundleInfo, bool &hasAccessBundleDirReq,
972         uint8_t &setAllowInternet, uint8_t &allowInternet, std::vector<int32_t> &gids,
973         std::set<std::string> &permissions);
974 
975     /**
976      * StartProcess, load the ability that needed to be started(Start on a new boot process).
977      *
978      * @param appName, the app name.
979      * @param processName, the process name.
980      * @param appRecord, the app information.
981      * @param uid, the process uid.
982      * @param bundleName, the app bundleName.
983      *
984      * @return
985      */
986     void StartProcess(const std::string &appName, const std::string &processName, uint32_t startFlags,
987                       std::shared_ptr<AppRunningRecord> appRecord, const int uid, const BundleInfo &bundleInfo,
988                       const std::string &bundleName, const int32_t bundleIndex, bool appExistFlag = true);
989 
990     /**
991      * PushAppFront, Adjust the latest application record to the top level.
992      *
993      * @param recordId, the app record id.
994      *
995      * @return
996      */
997     void PushAppFront(const int32_t recordId);
998 
999     /**
1000      * RemoveAppFromRecentListById, Remove the specified recent application record by application record id.
1001      *
1002      * @param recordId, the app record id.
1003      *
1004      * @return
1005      */
1006     void RemoveAppFromRecentListById(const int32_t recordId);
1007 
1008     /**
1009      * AddAppToRecentList, Add application to recent list.
1010      *
1011      * @param appName, the app name.
1012      * @param processName, the process name.
1013      * @param pid, the app pid.
1014      * @param recordId, the app record id.
1015      *
1016      * @return
1017      */
1018     void AddAppToRecentList(
1019         const std::string &appName, const std::string &processName, const pid_t pid, const int32_t recordId);
1020 
1021     /**
1022      * AddAppToRecentList, Get application task information through ID.
1023      *
1024      * @param recordId, the app record id.
1025      *
1026      * @return application task information.
1027      */
1028     const std::shared_ptr<AppTaskInfo> GetAppTaskInfoById(const int32_t recordId) const;
1029 
1030     /**
1031      * KillApplicationByUserId, kill the application by user ID.
1032      *
1033      * @param bundleName, bundle name in Application record.
1034      * @param userId, user ID.
1035      *
1036      * @return ERR_OK, return back success, others fail.
1037      */
1038     int32_t KillApplicationByUserIdLocked(const std::string &bundleName, const int userId);
1039 
1040     /**
1041      * WaitForRemoteProcessExit, Wait for the process to exit normally.
1042      *
1043      * @param pids, process number collection to exit.
1044      * @param startTime, execution process security exit start time.
1045      *
1046      * @return true, return back success,others fail.
1047      */
1048     bool WaitForRemoteProcessExit(std::list<pid_t> &pids, const int64_t startTime);
1049 
1050     /**
1051      * GetAllPids, Get the corresponding pid collection.
1052      *
1053      * @param pids, process number collection to exit.
1054      *
1055      * @return true, return back success,others fail.
1056      */
1057     bool GetAllPids(std::list<pid_t> &pids);
1058 
1059     /**
1060      * ProcessExist, Judge whether the process exists.
1061      *
1062      * @param pids, process number collection to exit.
1063      *
1064      * @return true, return back existed,others non-existent.
1065      */
1066     bool ProcessExist(pid_t &pid);
1067 
1068     /**
1069      * CheckAllProcessExist, Determine whether all processes exist .
1070      *
1071      * @param pids, process number collection to exit.
1072      *
1073      * @return true, Returns that a process exists and all other processes do not exist.
1074      */
1075     bool CheckAllProcessExist(std::list<pid_t> &pids);
1076 
1077     /**
1078      * SystemTimeMillisecond, Get system time.
1079      *
1080      * @return the system time.
1081      */
1082     int64_t SystemTimeMillisecond();
1083 
1084     // Test add the bundle manager instance.
1085     void SetBundleManagerHelper(const std::shared_ptr<BundleMgrHelper> &bundleMgrHelper);
1086 
1087     void HandleTerminateApplicationTimeOut(const int64_t eventId);
1088 
1089     void HandleAddAbilityStageTimeOut(const int64_t eventId);
1090 
1091     void ClipStringContent(const std::regex &re, const std::string &source, std::string &afterCutStr);
1092 
1093     bool GetBundleAndHapInfo(const AbilityInfo &abilityInfo, const std::shared_ptr<ApplicationInfo> &appInfo,
1094         BundleInfo &bundleInfo, HapModuleInfo &hapModuleInfo, int32_t appIndex = 0) const;
1095     AppProcessData WrapAppProcessData(const std::shared_ptr<AppRunningRecord> &appRecord,
1096         const ApplicationState state);
1097 
1098     int UserTestAbnormalFinish(const sptr<IRemoteObject> &observer, const std::string &msg);
1099     int GetHapModuleInfoForTestRunner(const AAFwk::Want &want, const sptr<IRemoteObject> &observer,
1100         const BundleInfo &bundleInfo, HapModuleInfo &hapModuleInfo);
1101     int StartEmptyProcess(const AAFwk::Want &want, const sptr<IRemoteObject> &observer, const BundleInfo &info,
1102         const std::string &processName, const int userId);
1103 
1104     void HandleStartSpecifiedAbilityTimeOut(const int64_t eventId);
1105 
1106     void HandleStartSpecifiedProcessTimeout(const int64_t eventId);
1107 
1108     void InitGlobalConfiguration();
1109 
1110     void GetRunningProcesses(const std::shared_ptr<AppRunningRecord> &appRecord, std::vector<RunningProcessInfo> &info);
1111     void GetRunningProcess(const std::shared_ptr<AppRunningRecord> &appRecord, RunningProcessInfo &info);
1112 
1113     void GetRenderProcesses(const std::shared_ptr<AppRunningRecord> &appRecord, std::vector<RenderProcessInfo> &info);
1114 
1115     int StartRenderProcessImpl(const std::shared_ptr<RenderRecord> &renderRecord,
1116         const std::shared_ptr<AppRunningRecord> appRecord, pid_t &renderPid);
1117 
1118     void OnRenderRemoteDied(const wptr<IRemoteObject> &remote);
1119 
1120     void AddWatchParameter();
1121 
1122     bool VerifyAPL() const;
1123 
1124     void RegisterFocusListener();
1125 
1126     static void PointerDeviceEventCallback(const char *key, const char *value, void *context);
1127 
1128     int VerifyProcessPermission() const;
1129 
1130     int VerifyProcessPermission(const std::string &bundleName) const;
1131 
1132     bool CheckCallerIsAppGallery();
1133 
1134     void ApplicationTerminatedSendProcessEvent(const std::shared_ptr<AppRunningRecord> &appRecord);
1135     void ClearAppRunningDataForKeepAlive(const std::shared_ptr<AppRunningRecord> &appRecord);
1136 
1137     /**
1138      * Check appRunning status listener permission.
1139      *
1140      * @param listener Running status listener.
1141      * @return Returns ERR_OK on success, others on failure.
1142      */
1143     int32_t CheckPermission(const sptr<IRemoteObject> &listener);
1144 
1145     int32_t StartChildProcessPreCheck(const pid_t callingPid);
1146 
1147     int32_t StartChildProcessImpl(const std::shared_ptr<ChildProcessRecord> childProcessRecord,
1148         const std::shared_ptr<AppRunningRecord> appRecord, pid_t &childPid);
1149 
1150     int32_t GetChildProcessInfo(const std::shared_ptr<ChildProcessRecord> childProcessRecord,
1151         const std::shared_ptr<AppRunningRecord> appRecord, ChildProcessInfo &info);
1152 
1153     void OnChildProcessRemoteDied(const wptr<IRemoteObject> &remote);
1154 
1155     void KillChildProcess(const std::shared_ptr<AppRunningRecord> &appRecord);
1156 
1157 private:
1158     /**
1159      * ClearUpApplicationData, clear the application data.
1160      *
1161      * @param bundleName, bundle name in Application record.
1162      * @param uid, app uid in Application record.
1163      * @param pid, app pid in Application record.
1164      * @param userId, userId.
1165      * @param isBySelf, clear data by application self.
1166      *
1167      * @return Returns ERR_OK on success, others on failure.
1168      */
1169     int32_t ClearUpApplicationDataByUserId(const std::string &bundleName,
1170         int32_t callerUid, pid_t callerPid, const int userId, bool isBySelf = false);
1171 
1172     uint32_t BuildStartFlags(const AAFwk::Want &want, const AbilityInfo &abilityInfo);
1173 
1174     bool CheckGetRunningInfoPermission() const;
1175 
1176     int32_t KillApplicationByBundleName(const std::string &bundleName);
1177 
1178     bool SendProcessStartEvent(const std::shared_ptr<AppRunningRecord> &appRecord);
1179 
1180     void SendAppStartupTypeEvent(const std::shared_ptr<AppRunningRecord> &appRecord,
1181         const std::shared_ptr<AbilityInfo> &abilityInfo, const AppStartType startType);
1182 
1183     void SendProcessExitEvent(pid_t pid);
1184 
1185     void SendProcessExitEventTask(pid_t pid, time_t exitTime, int32_t count);
1186 
1187     void UpDateStartupType(const std::shared_ptr<AbilityInfo> &info, int32_t &abilityType, int32_t &extensionType);
1188 
1189     void SetRunningSharedBundleList(const std::string &bundleName,
1190         const std::vector<BaseSharedBundleInfo> baseSharedBundleInfoList);
1191 
1192     void RemoveRunningSharedBundleList(const std::string &bundleName);
1193 
1194     void KillRenderProcess(const std::shared_ptr<AppRunningRecord> &appRecord);
1195 
1196     void SetOverlayInfo(const std::string& bundleName, const int32_t userId, AppSpawnStartMsg& startMsg);
1197 
1198     void TimeoutNotifyApp(int32_t pid, int32_t uid, const std::string& bundleName, const FaultData &faultData);
1199 
1200     void AppRecoveryNotifyApp(int32_t pid, const std::string& bundleName,
1201         FaultDataType faultType, const std::string& markers);
1202 
1203     void ProcessAppDebug(const std::shared_ptr<AppRunningRecord> &appRecord, const bool &isDebugStart);
1204     AppDebugInfo MakeAppDebugInfo(const std::shared_ptr<AppRunningRecord> &appRecord, const bool &isDebugStart);
1205     int32_t NotifyAbilitysDebugChange(const std::string &bundleName, const bool &isAppDebug);
1206 
1207     bool JudgeSelfCalledByToken(const sptr<IRemoteObject> &token, const PageStateData &pageStateData);
1208 
1209     void ParseServiceExtMultiProcessWhiteList();
1210     int32_t GetFlag() const;
1211     void ClearData(std::shared_ptr<AppRunningRecord> appRecord);
1212 
1213     /**
1214      * Notify the app running status.
1215      *
1216      * @param bundle Bundle name in application record.
1217      * @param uid Uid of bundle.
1218      * @param runningStatus The app running status.
1219      *
1220      * @return
1221      */
1222     void NotifyAppRunningStatusEvent(
1223         const std::string &bundle, int32_t uid, AbilityRuntime::RunningStatus runningStatus);
1224 
1225 private:
1226     /**
1227      * Notify application status.
1228      *
1229      * @param bundleName Indicates the name of the bundle.
1230      * @param bundleName Indicates the name of the bundle.
1231      * @param eventData Indicates the event defined by CommonEventSupport
1232      *
1233      * @return
1234      */
1235     void NotifyAppStatusByCallerUid(const std::string &bundleName, const int32_t userId, const int32_t callerUid,
1236         const std::string &eventData);
1237     void KillApplicationByRecord(const std::shared_ptr<AppRunningRecord> &appRecord);
1238     void SendHiSysEvent(const int32_t innerEventId, const int64_t eventId);
1239     int FinishUserTestLocked(
1240         const std::string &msg, const int64_t &resultCode, const std::shared_ptr<AppRunningRecord> &appRecord);
1241     int32_t GetCurrentAccountId() const;
1242     void SendReStartProcessEvent(const AAFwk::EventInfo &eventInfo,
1243         const std::shared_ptr<AppRunningRecord> &appRecord);
1244     void SendAppLaunchEvent(const std::shared_ptr<AppRunningRecord> &appRecord);
1245     void HandleConfigurationChange(const Configuration &config);
1246     const std::string TASK_ON_CALLBACK_DIED = "OnCallbackDiedTask";
1247     std::vector<const sptr<IAppStateCallback>> appStateCallbacks_;
1248     std::shared_ptr<AppProcessManager> appProcessManager_;
1249     std::shared_ptr<RemoteClientManager> remoteClientManager_;
1250     std::shared_ptr<AppRunningManager> appRunningManager_;
1251     std::shared_ptr<AAFwk::TaskHandlerWrap> taskHandler_;
1252     std::shared_ptr<AMSEventHandler> eventHandler_;
1253     std::shared_ptr<Configuration> configuration_;
1254     ffrt::mutex userTestLock_;
1255     ffrt::mutex appStateCallbacksLock_;
1256     ffrt::mutex renderUidSetLock_;
1257     ffrt::mutex exceptionLock_;
1258     sptr<IStartSpecifiedAbilityResponse> startSpecifiedAbilityResponse_;
1259     ffrt::mutex configurationObserverLock_;
1260     std::vector<sptr<IConfigurationObserver>> configurationObservers_;
1261     sptr<WindowFocusChangedListener> focusListener_;
1262     sptr<WindowVisibilityChangedListener> windowVisibilityChangedListener_;
1263     std::vector<std::shared_ptr<AppRunningRecord>> restartResedentTaskList_;
1264     std::map<std::string, std::vector<BaseSharedBundleInfo>> runningSharedBundleList_;
1265     std::unordered_set<int32_t> renderUidSet_;
1266     std::string supportIsolationMode_ {"false"};
1267     std::string supportServiceExtMultiProcess_ {"false"};
1268     std::string deviceType_ {"default"};
1269     int32_t currentUserId_ = 0;
1270     int32_t lastRenderUid_ = Constants::START_UID_FOR_RENDER_PROCESS;
1271     sptr<IAbilityDebugResponse> abilityDebugResponse_;
1272     std::shared_ptr<AppDebugManager> appDebugManager_;
1273     ffrt::mutex killpedProcessMapLock_;
1274     mutable std::map<int64_t, std::string> killedPorcessMap_;
1275     std::shared_ptr<AbilityRuntime::AppRunningStatusModule> appRunningStatusModule_;
1276     std::vector<std::string> serviceExtensionWhiteList_;
1277 };
1278 }  // namespace AppExecFwk
1279 }  // namespace OHOS
1280 #endif  // OHOS_ABILITY_RUNTIME_APP_MGR_SERVICE_INNER_H
1281