1 /*
2  * Copyright (c) 2021-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_MAIN_THREAD_H
17 #define OHOS_ABILITY_RUNTIME_MAIN_THREAD_H
18 
19 #include <string>
20 #include <signal.h>
21 #include <mutex>
22 #include "event_handler.h"
23 #include "extension_config_mgr.h"
24 #include "idle_time.h"
25 #include "inner_event.h"
26 #include "app_scheduler_host.h"
27 #include "app_mgr_interface.h"
28 #include "ability_record_mgr.h"
29 #include "application_impl.h"
30 #include "assert_fault_task_thread.h"
31 #include "common_event_subscriber.h"
32 #include "resource_manager.h"
33 #include "foundation/ability/ability_runtime/interfaces/inner_api/runtime/include/runtime.h"
34 #include "ipc_singleton.h"
35 #ifdef CJ_FRONTEND
36 #include "cj_envsetup.h"
37 #endif
38 #include "js_runtime.h"
39 #include "native_engine/native_engine.h"
40 #include "overlay_event_subscriber.h"
41 #include "watchdog.h"
42 #include "app_malloc_info.h"
43 #include "app_jsheap_mem_info.h"
44 #define ABILITY_LIBRARY_LOADER
45 
46 #if defined(NWEB) && defined(NWEB_GRAPHIC)
47 #include "nweb_preload.h"
48 #include "ui/rs_surface_node.h"
49 #endif
50 
51 class Runtime;
52 namespace OHOS {
53 namespace AppExecFwk {
54 using namespace OHOS::Global;
55 using OHOS::AbilityRuntime::Runtime;
56 struct BaseSharedBundleInfo;
57 using HspList = std::vector<BaseSharedBundleInfo>;
58 enum class MainThreadState { INIT, ATTACH, READY, RUNNING };
59 struct BundleInfo;
60 class ContextDeal;
61 // class Global::Resource::ResourceManager;
62 class AppMgrDeathRecipient : public IRemoteObject::DeathRecipient {
63 public:
64     /**
65      *
66      * @brief Notify the AppMgrDeathRecipient that the remote is dead.
67      *
68      * @param remote The remote which is dead.
69      */
70     virtual void OnRemoteDied(const wptr<IRemoteObject> &remote) override;
71     AppMgrDeathRecipient() = default;
72     ~AppMgrDeathRecipient() override = default;
73 };
74 
75 class MainThread : public AppSchedulerHost {
76     DECLARE_DELAYED_IPCSINGLETON(MainThread);
77 
78 public:
79     /**
80      *
81      * @brief Get the current MainThreadState.
82      *
83      * @return Returns the current MainThreadState.
84      */
85     MainThreadState GetMainThreadState() const;
86 
87     /**
88      *
89      * @brief Get the runner state of mainthread.
90      *
91      * @return Returns the runner state of mainthread.
92      */
93     bool GetRunnerStarted() const;
94 
95     /**
96      *
97      * @brief Get the newThreadId.
98      *
99      * @return Returns the newThreadId.
100      */
101     int GetNewThreadId();
102 
103     /**
104      *
105      * @brief Get the application.
106      *
107      * @return Returns the application.
108      */
109     std::shared_ptr<OHOSApplication> GetApplication() const;
110 
111     /**
112      *
113      * @brief Get the applicationInfo.
114      *
115      * @return Returns the applicationInfo.
116      */
117     std::shared_ptr<ApplicationInfo> GetApplicationInfo() const;
118 
119     /**
120      *
121      * @brief Get the applicationImpl.
122      *
123      * @return Returns the applicationImpl.
124      */
125     std::shared_ptr<ApplicationImpl> GetApplicationImpl();
126 
127     /**
128      *
129      * @brief Get the eventHandler of mainthread.
130      *
131      * @return Returns the eventHandler of mainthread.
132      */
133     std::shared_ptr<EventHandler> GetMainHandler() const;
134 
135     /**
136      *
137      * @brief Schedule the foreground lifecycle of application.
138      *
139      */
140     bool ScheduleForegroundApplication() override;
141 
142     /**
143      *
144      * @brief Schedule the background lifecycle of application.
145      *
146      */
147     void ScheduleBackgroundApplication() override;
148 
149     /**
150      *
151      * @brief Schedule the terminate lifecycle of application.
152      *
153      * @param isLastProcess When it is the last application process, pass in true.
154      */
155     void ScheduleTerminateApplication(bool isLastProcess = false) override;
156 
157     /**
158      *
159      * @brief Shrink the memory which used by application.
160      *
161      * @param level Indicates the memory trim level, which shows the current memory usage status.
162      */
163     void ScheduleShrinkMemory(const int level) override;
164 
165     /**
166      *
167      * @brief Notify the current memory.
168      *
169      * @param level Indicates the memory trim level, which shows the current memory usage status.
170      */
171     void ScheduleMemoryLevel(const int level) override;
172 
173     /**
174      *
175      * @brief Get the application's memory allocation info.
176      *
177      * @param pid, pid input.
178      * @param mallocInfo, dynamic storage information output.
179      */
180     void ScheduleHeapMemory(const int32_t pid, OHOS::AppExecFwk::MallocInfo &mallocInfo) override;
181 
182     /**
183      *
184      * @brief triggerGC and dump the application's jsheap memory info.
185      *
186      * @param info, pid, tid, needGc, needSnapshot.
187      */
188     void ScheduleJsHeapMemory(OHOS::AppExecFwk::JsHeapDumpInfo &info) override;
189 
190     /**
191      *
192      * @brief Low the memory which used by application.
193      *
194      */
195     void ScheduleLowMemory() override;
196 
197     /**
198      *
199      * @brief Launch the application.
200      *
201      * @param data The launchdata of the application witch launced.
202      *
203      */
204     void ScheduleLaunchApplication(const AppLaunchData &data, const Configuration &config) override;
205 
206     /**
207      *
208      * @brief update the application info after new module installed.
209      *
210      * @param appInfo The latest application info obtained from bms for update abilityRuntimeContext.
211      *
212      */
213     void ScheduleUpdateApplicationInfoInstalled(const ApplicationInfo &appInfo) override;
214 
215     /**
216      * Notify application to launch ability stage.
217      *
218      * @param The resident process data value.
219      */
220     void ScheduleAbilityStage(const HapModuleInfo &abilityStage) override;
221 
222     void ScheduleLaunchAbility(const AbilityInfo &info, const sptr<IRemoteObject> &token,
223         const std::shared_ptr<AAFwk::Want> &want, int32_t abilityRecordId) override;
224 
225     /**
226      *
227      * @brief clean the ability by token.
228      *
229      * @param token The token belong to the ability which want to be cleaned.
230      *
231      */
232     void ScheduleCleanAbility(const sptr<IRemoteObject> &token, bool isCacheProcess = false) override;
233 
234     /**
235      *
236      * @brief send the new profile.
237      *
238      * @param profile The updated profile.
239      *
240      */
241     void ScheduleProfileChanged(const Profile &profile) override;
242 
243     /**
244      *
245      * @brief send the new config to the application.
246      *
247      * @param config The updated config.
248      *
249      */
250     void ScheduleConfigurationUpdated(const Configuration &config) override;
251 
252     /**
253      *
254      * @brief Starts the mainthread.
255      *
256      */
257     static void Start();
258 
259     static void StartChild(const std::map<std::string, int32_t> &fds);
260 
261     /**
262      *
263      * @brief Preload extensions in appspawn.
264      *
265      */
266     static void PreloadExtensionPlugin();
267 
268     /**
269      *
270      * @brief Schedule the application process exit safely.
271      *
272      */
273     void ScheduleProcessSecurityExit() override;
274 
275     void ScheduleClearPageStack() override;
276 
277     void ScheduleAcceptWant(const AAFwk::Want &want, const std::string &moduleName) override;
278 
279     void ScheduleNewProcessRequest(const AAFwk::Want &want, const std::string &moduleName) override;
280 
281     /**
282      *
283      * @brief Check the App main thread state.
284      *
285      */
286     void CheckMainThreadIsAlive();
287 
288     int32_t ScheduleNotifyLoadRepairPatch(const std::string &bundleName, const sptr<IQuickFixCallback> &callback,
289         const int32_t recordId) override;
290 
291     int32_t ScheduleNotifyHotReloadPage(const sptr<IQuickFixCallback> &callback, const int32_t recordId) override;
292 
293     int32_t ScheduleNotifyUnLoadRepairPatch(const std::string &bundleName,
294         const sptr<IQuickFixCallback> &callback, const int32_t recordId) override;
295 
296     int32_t ScheduleNotifyAppFault(const FaultData &faultData) override;
297 #ifdef CJ_FRONTEND
298     CJUncaughtExceptionInfo CreateCjExceptionInfo(const std::string &bundleName, uint32_t versionCode,
299         const std::string &hapPath);
300 #endif
301     /**
302      * @brief Notify NativeEngine GC of status change.
303      *
304      * @param state GC state
305      *
306      * @return Is the status change completed.
307      */
308     int32_t ScheduleChangeAppGcState(int32_t state) override;
309 
310     void AttachAppDebug() override;
311     void DetachAppDebug() override;
312     bool NotifyDeviceDisConnect();
313 
314     void AssertFaultPauseMainThreadDetection();
315     void AssertFaultResumeMainThreadDetection();
316 
317     /**
318      * ScheduleDumpIpcStart, call ScheduleDumpIpcStart(std::string& result) through proxy project,
319      * Start querying the application's IPC payload info.
320      *
321      * @param result, start IPC dump result output.
322      *
323      * @return Returns 0 on success, error code on failure.
324      */
325     int32_t ScheduleDumpIpcStart(std::string& result) override;
326 
327     /**
328      * ScheduleDumpIpcStop, call ScheduleDumpIpcStop(std::string& result) through proxy project,
329      * Stop querying the application's IPC payload info.
330      *
331      * @param result, stop IPC dump result output.
332      *
333      * @return Returns 0 on success, error code on failure.
334      */
335     int32_t ScheduleDumpIpcStop(std::string& result) override;
336 
337     /**
338      * ScheduleDumpIpcStat, call ScheduleDumpIpcStat(std::string& result) through proxy project,
339      * Collect the application's IPC payload info.
340      *
341      * @param result, IPC payload result output.
342      *
343      * @return Returns 0 on success, error code on failure.
344      */
345     int32_t ScheduleDumpIpcStat(std::string& result) override;
346 
347     void ScheduleCacheProcess() override;
348     /**
349      * ScheduleDumpFfrt, call ScheduleDumpFfrt(std::string& result) through proxy project,
350      * Start querying the application's ffrt usage.
351      *
352      * @param result, ffrt dump result output.
353      *
354      * @return Returns 0 on success, error code on failure.
355      */
356     int32_t ScheduleDumpFfrt(std::string& result) override;
357 
358 private:
359     /**
360      *
361      * @brief Terminate the application but don't notify ams.
362      *
363      */
364     void HandleTerminateApplicationLocal();
365 
366     void HandleScheduleAcceptWant(const AAFwk::Want &want, const std::string &moduleName);
367 
368     void HandleScheduleNewProcessRequest(const AAFwk::Want &want, const std::string &moduleName);
369 
370     void HandleJsHeapMemory(const OHOS::AppExecFwk::JsHeapDumpInfo &info);
371 
372     void PreloadModule(const AppExecFwk::HapModuleInfo &entryHapModuleInfo,
373         const std::unique_ptr<AbilityRuntime::Runtime>& runtime);
374 
375     void ProcessMainAbility(const AbilityInfo &info, const std::unique_ptr<AbilityRuntime::Runtime>& runtime);
376 
377     /**
378      *
379      * @brief Schedule the application process exit safely.
380      *
381      */
382     void HandleProcessSecurityExit();
383 
384     /**
385      *
386      * @brief Clean the ability but don't notify ams.
387      *
388      * @param token The token which belongs to the ability launched.
389      *
390      */
391     void HandleCleanAbilityLocal(const sptr<IRemoteObject> &token);
392 
393     /**
394      *
395      * @brief Launch the application.
396      *
397      * @param appLaunchData The launchdata of the application witch launced.
398      *
399      */
400     void HandleLaunchApplication(const AppLaunchData &appLaunchData, const Configuration &config);
401 
402     /**
403      *
404      * @brief update the application info after new module installed.
405      *
406      * @param appInfo The latest application info obtained from bms for update abilityRuntimeContext.
407      *
408      */
409     void HandleUpdateApplicationInfoInstalled(const ApplicationInfo &appInfo);
410 
411     /**
412      *
413      * @brief Launch the application.
414      *
415      * @param appLaunchData The launchdata of the application witch launced.
416      *
417      */
418     void HandleAbilityStage(const HapModuleInfo &abilityStage);
419 
420     /**
421      *
422      * @brief Launch the ability.
423      *
424      * @param abilityRecord The abilityRecord which belongs to the ability launched.
425      *
426      */
427     void HandleLaunchAbility(const std::shared_ptr<AbilityLocalRecord> &abilityRecord);
428 
429     /**
430      *
431      * @brief Clean the ability.
432      *
433      * @param token The token which belongs to the ability launched.
434      *
435      */
436     void HandleCleanAbility(const sptr<IRemoteObject> &token, bool isCacheProcess = false);
437 
438     /**
439      *
440      * @brief Foreground the application.
441      *
442      */
443     void HandleForegroundApplication();
444 
445     /**
446      *
447      * @brief Background the application.
448      *
449      */
450     void HandleBackgroundApplication();
451 
452     /**
453      *
454      * @brief Terminate the application.
455      *
456      */
457     void HandleTerminateApplication(bool isLastProcess = false);
458 
459     /**
460      *
461      * @brief Shrink the memory which used by application.
462      *
463      * @param level Indicates the memory trim level, which shows the current memory usage status.
464      *
465      */
466     void HandleShrinkMemory(const int level);
467 
468     /**
469      *
470      * @brief Notify the memory.
471      *
472      * @param level Indicates the memory trim level, which shows the current memory usage status.
473      *
474      */
475     void HandleMemoryLevel(int level);
476 
477     /**
478      *
479      * @brief send the new config to the application.
480      *
481      * @param config The updated config.
482      *
483      */
484     void HandleConfigurationUpdated(const Configuration &config);
485 
486     /**
487      *
488      * @brief remove the deathRecipient from appMgr.
489      *
490      */
491     void RemoveAppMgrDeathRecipient();
492 
493     /**
494      *
495      * @brief Attach the mainthread to the AppMgr.
496      *
497      */
498     void Attach();
499 
500     /**
501      *
502      * @brief Set the runner state of mainthread.
503      *
504      * @param runnerStart whether the runner is started.
505      */
506     void SetRunnerStarted(bool runnerStart);
507 
508     /**
509      *
510      * @brief Connect the mainthread to the AppMgr.
511      *
512      */
513     bool ConnectToAppMgr();
514 
515     /**
516      *
517      * @brief Check whether the appLaunchData is legal.
518      *
519      * @param appLaunchData The appLaunchData should be checked.
520      *
521      * @return if the appLaunchData is legal, return true. else return false.
522      */
523     bool CheckLaunchApplicationParam(const AppLaunchData &appLaunchData) const;
524 
525     /**
526      *
527      * @brief Check whether the record is legal.
528      *
529      * @param record The record should be checked.
530      *
531      * @return if the record is legal, return true. else return false.
532      */
533     bool CheckAbilityItem(const std::shared_ptr<AbilityLocalRecord> &record) const;
534 
535     /**
536      *
537      * @brief Init the mainthread.
538      *
539      * @param runner the runner belong to the mainthread.
540      *
541      */
542     void Init(const std::shared_ptr<EventRunner> &runner);
543 
544     /**
545      *
546      * @brief Task in event handler timeout detected.
547      *
548      * @param runner the runner belong to the mainthread.
549      *
550      */
551     void TaskTimeoutDetected(const std::shared_ptr<EventRunner>& runner);
552 
553     /**
554      *
555      * @brief Check whether the OHOSApplication is ready.
556      *
557      * @return if the OHOSApplication is ready, return true. else return false.
558      *
559      */
560     bool IsApplicationReady() const;
561 
562     /**
563      * @brief Load all extension so
564      *
565      * @param nativeEngine nativeEngine instance
566      */
567     void LoadAllExtensions(NativeEngine &nativeEngine);
568 
569     /**
570      *
571      * @brief Ability Delegator Prepare.
572      *
573      * @param record User Test info.
574      *
575      */
576     bool PrepareAbilityDelegator(const std::shared_ptr<UserTestRecord> &record, bool isStageBased,
577         const AppExecFwk::HapModuleInfo &entryHapModuleInfo);
578 
579     /**
580      * @brief Set current process extension type
581      *
582      * @param abilityRecord current running ability record
583      */
584     void SetProcessExtensionType(const std::shared_ptr<AbilityLocalRecord> &abilityRecord);
585 
586     /**
587      * @brief Add Extension block item
588      *
589      * @param extensionName extension name
590      * @param type extension type
591      */
592     void AddExtensionBlockItem(const std::string &extensionName, int32_t type);
593 
594     /**
595      * @brief Update runtime module checker
596      *
597      * @param runtime runtime the ability runtime
598      */
599     void UpdateRuntimeModuleChecker(const std::unique_ptr<AbilityRuntime::Runtime> &runtime);
600 
601     static void HandleDumpHeapPrepare();
602     static void HandleDumpHeap(bool isPrivate);
603     static void DestroyHeapProfiler();
604     static void ForceFullGC();
605     static void HandleSignal(int signal, siginfo_t *siginfo, void *context);
606 
607     void NotifyAppFault(const FaultData &faultData);
608 
609     void OnOverlayChanged(const EventFwk::CommonEventData &data,
610         const std::shared_ptr<Global::Resource::ResourceManager> &resourceManager, const std::string &bundleName,
611         const std::string &moduleName, const std::string &loadPath);
612 
613     void HandleOnOverlayChanged(const EventFwk::CommonEventData &data,
614         const std::shared_ptr<Global::Resource::ResourceManager> &resourceManager, const std::string &bundleName,
615         const std::string &moduleName, const std::string &loadPath);
616 
617     int GetOverlayModuleInfos(const std::string &bundleName, const std::string &moduleName,
618         std::vector<OverlayModuleInfo> &overlayModuleInfos) const;
619 
620     std::vector<std::string> GetAddOverlayPaths(const std::vector<OverlayModuleInfo> &overlayModuleInfos);
621 
622     std::vector<std::string> GetRemoveOverlayPaths(const std::vector<OverlayModuleInfo> &overlayModuleInfos);
623 
624     int32_t ChangeAppGcState(int32_t state);
625 
626     void HandleCacheProcess();
627 
628     bool IsBgWorkingThread(const AbilityInfo &info);
629 
630     /**
631      * @brief parse app configuration params
632      *
633      * @param configuration input configuration
634      * @config the config of application
635      */
636     void ParseAppConfigurationParams(const std::string configuration, Configuration &config);
637 
638 #if defined(NWEB) && defined(NWEB_GRAPHIC)
639     void HandleNWebPreload();
640 #endif
641 
642     class MainHandler : public EventHandler {
643     public:
644         MainHandler(const std::shared_ptr<EventRunner> &runner, const sptr<MainThread> &thread);
645         virtual ~MainHandler() = default;
646 
647         /**
648          *
649          * @brief Process the event.
650          *
651          * @param event the event want to be processed.
652          *
653          */
654         void ProcessEvent(const OHOS::AppExecFwk::InnerEvent::Pointer &event) override;
655 
656     private:
657         wptr<MainThread> mainThreadObj_ = nullptr;
658     };
659 
660     bool isRunnerStarted_ = false;
661     int newThreadId_ = -1;
662     std::shared_ptr<ApplicationInfo> applicationInfo_ = nullptr;
663     std::shared_ptr<ProcessInfo> processInfo_ = nullptr;
664     std::shared_ptr<OHOSApplication> application_ = nullptr;
665     std::shared_ptr<ApplicationImpl> applicationImpl_ = nullptr;
666     static std::shared_ptr<MainHandler> mainHandler_;
667     std::shared_ptr<AbilityRecordMgr> abilityRecordMgr_ = nullptr;
668     std::shared_ptr<Watchdog> watchdog_ = nullptr;
669     std::unique_ptr<AbilityRuntime::ExtensionConfigMgr> extensionConfigMgr_ = nullptr;
670     MainThreadState mainThreadState_ = MainThreadState::INIT;
671     sptr<IAppMgr> appMgr_ = nullptr;  // appMgrService Handler
672     sptr<IRemoteObject::DeathRecipient> deathRecipient_ = nullptr;
673     std::string aceApplicationName_ = "AceApplication";
674     std::string pathSeparator_ = "/";
675     std::string abilityLibraryType_ = ".so";
676     static std::weak_ptr<OHOSApplication> applicationForDump_;
677     bool isDeveloperMode_ = false;
678 #if defined(NWEB) && defined(NWEB_GRAPHIC)
679     Rosen::RSSurfaceNode::SharedPtr preloadSurfaceNode_ = nullptr;
680     std::shared_ptr<NWeb::NWeb> preloadNWeb_ = nullptr;
681 #endif
682 
683 #ifdef ABILITY_LIBRARY_LOADER
684     /**
685      *
686      * @brief Load the ability library.
687      *
688      * @param libraryPaths the library paths.
689      *
690      */
691     void LoadAbilityLibrary(const std::vector<std::string> &libraryPaths);
692     void LoadAceAbilityLibrary();
693 
694     void CalcNativeLiabraryEntries(const BundleInfo &bundleInfo, std::string &nativeLibraryPath);
695     void LoadNativeLiabrary(const BundleInfo &bundleInfo, std::string &nativeLibraryPath);
696 
697     void LoadAppDetailAbilityLibrary(std::string &nativeLibraryPath);
698 
699     void LoadAppLibrary();
700 
701     void ChangeToLocalPath(const std::string &bundleName,
702         const std::vector<std::string> &sourceDirs, std::vector<std::string> &localPath);
703 
704     void ChangeToLocalPath(const std::string &bundleName,
705         const std::string &sourcDir, std::string &localPath);
706 
707     bool ScanDir(const std::string &dirPath, std::vector<std::string> &files);
708 
709     /**
710      *
711      * @brief Check the fileType.
712      *
713      * @param fileName The fileName of the lib.
714      * @param extensionName The extensionName of the lib.
715      *
716      * @return if the FileType is legal, return true. else return false.
717      *
718      */
719     bool CheckFileType(const std::string &fileName, const std::string &extensionName);
720 
721     bool InitCreate(std::shared_ptr<ContextDeal> &contextDeal, ApplicationInfo &appInfo, ProcessInfo &processInfo);
722     bool CheckForHandleLaunchApplication(const AppLaunchData &appLaunchData);
723     bool InitResourceManager(std::shared_ptr<Global::Resource::ResourceManager> &resourceManager,
724         const AppExecFwk::HapModuleInfo &entryHapModuleInfo, const std::string &bundleName,
725         bool multiProjects, const Configuration &config);
726     void OnStartAbility(const std::string& bundleName,
727         std::shared_ptr<Global::Resource::ResourceManager> &resourceManager,
728         const AppExecFwk::HapModuleInfo &entryHapModuleInfo);
729     std::vector<std::string> GetOverlayPaths(const std::string &bundleName,
730         const std::vector<OverlayModuleInfo> &overlayModuleInfos);
731     void SubscribeOverlayChange(const std::string &bundleName, const std::string &loadPath,
732         std::shared_ptr<Global::Resource::ResourceManager> &resourceManager,
733         const AppExecFwk::HapModuleInfo &entryHapModuleInfo);
734     void HandleInitAssertFaultTask(bool isDebugModule, bool isDebugApp);
735     void HandleCancelAssertFaultTask();
736 
737     bool GetHqfFileAndHapPath(const std::string &bundleName,
738         std::vector<std::pair<std::string, std::string>> &fileMap);
739     void GetNativeLibPath(const BundleInfo &bundleInfo, const HspList &hspList, AppLibPathMap &appLibPaths);
740     void SetAppDebug(uint32_t modeFlag, bool isDebug);
741 
742     std::vector<std::string> fileEntries_;
743     std::vector<std::string> nativeFileEntries_;
744     std::vector<void *> handleAbilityLib_;  // the handler of ACE Library.
745     std::shared_ptr<IdleTime> idleTime_ = nullptr;
746     std::vector<AppExecFwk::OverlayModuleInfo> overlayModuleInfos_;
747     std::weak_ptr<AbilityRuntime::AssertFaultTaskThread> assertThread_;
748 #endif                                      // ABILITY_LIBRARY_LOADER
749 #ifdef APPLICATION_LIBRARY_LOADER
750     void *handleAppLib_ = nullptr;  // the handler of ACE Library.
751     constexpr static std::string applicationLibraryPath = "/hos/lib/libapplication_native.z.so";
752 #endif  // APPLICATION_LIBRARY_LOADER
753     DISALLOW_COPY_AND_MOVE(MainThread);
754 };
755 }  // namespace AppExecFwk
756 }  // namespace OHOS
757 #endif  // OHOS_ABILITY_RUNTIME_MAIN_THREAD_H
758